| Total Complexity | 5 |
| Total Lines | 19 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | #! ../env/bin/python |
||
| 11 | @pytest.mark.usefixtures("testapp") |
||
| 12 | class TestModels: |
||
| 13 | def test_user_save(self, testapp): |
||
| 14 | """ Test Saving the user model to the database """ |
||
| 15 | |||
| 16 | admin = User('admin', 'supersafepassword') |
||
| 17 | db.session.add(admin) |
||
| 18 | db.session.commit() |
||
| 19 | |||
| 20 | user = User.query.filter_by(username="admin").first() |
||
| 21 | assert user is not None |
||
| 22 | |||
| 23 | def test_user_password(self, testapp): |
||
| 24 | """ Test password hashing and checking """ |
||
| 25 | |||
| 26 | admin = User('admin', 'supersafepassword') |
||
| 27 | |||
| 28 | assert admin.username == 'admin' |
||
| 29 | assert admin.check_password('supersafepassword') |
||
| 30 |