test_user.py 1019B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. # -*- coding: utf-8 -*-
  2. import transaction
  3. from tracim.tests import eq_
  4. from tracim.tests import BaseTest
  5. from tracim.models.auth import User
  6. class TestUserModel(BaseTest):
  7. def test_create(self):
  8. self.session.flush()
  9. transaction.commit()
  10. name = 'Damien'
  11. email = 'damien@accorsi.info'
  12. user = User()
  13. user.display_name = name
  14. user.email = email
  15. self.session.add(user)
  16. self.session.flush()
  17. transaction.commit()
  18. new_user = self.session.query(User).filter(User.display_name==name).one()
  19. eq_(new_user.display_name, name)
  20. eq_(new_user.email, email)
  21. eq_(new_user.email_address, email)
  22. def test_null_password(self):
  23. # Check bug #70 fixed
  24. # http://tracim.org/workspaces/4/folders/5/threads/70
  25. name = 'Damien'
  26. email = 'tracim@trac.im'
  27. user = User()
  28. user.display_name = name
  29. user.email = email
  30. eq_(False, user.validate_password(None))