| Total Complexity | 2 | 
| Total Lines | 44 | 
| Duplicated Lines | 0 % | 
| Changes | 0 | ||
| 1 | # -*- coding: utf-8 -*- | ||
|  | |||
| 2 | import transaction | ||
| 3 | |||
| 4 | from tracim.tests import eq_ | ||
| 5 | from tracim.tests import BaseTest | ||
| 6 | |||
| 7 | from tracim.models.auth import User | ||
| 8 | |||
| 9 | |||
| 10 | class TestUserModel(BaseTest): | ||
| 11 | |||
| 12 | def test_create(self): | ||
| 13 | self.session.flush() | ||
| 14 | transaction.commit() | ||
| 15 | name = 'Damien' | ||
| 16 | email = '[email protected]' | ||
| 17 | |||
| 18 | user = User() | ||
| 19 | user.display_name = name | ||
| 20 | user.email = email | ||
| 21 | |||
| 22 | self.session.add(user) | ||
| 23 | self.session.flush() | ||
| 24 | transaction.commit() | ||
| 25 | |||
| 26 | new_user = self.session.query(User).filter(User.display_name==name).one() | ||
| 27 | |||
| 28 | eq_(new_user.display_name, name) | ||
| 29 | eq_(new_user.email, email) | ||
| 30 | eq_(new_user.email_address, email) | ||
| 31 | |||
| 32 | def test_null_password(self): | ||
| 33 | # Check bug #70 fixed | ||
| 34 | # http://tracim.org/workspaces/4/folders/5/threads/70 | ||
| 35 | |||
| 36 | name = 'Damien' | ||
| 37 | email = '[email protected]' | ||
| 38 | |||
| 39 | user = User() | ||
| 40 | user.display_name = name | ||
| 41 | user.email = email | ||
| 42 | |||
| 43 | eq_(False, user.validate_password(None)) | ||
| 44 | 
The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:
If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.