| 15 | |
| 16 | # Ensure user can register |
| 17 | def test_user_registeration(self): |
| 18 | with self.client: |
| 19 | response = self.client.post('register/', data=dict( |
| 20 | username='Michael', email='michael@realpython.com', |
| 21 | password='python', confirm='python' |
| 22 | ), follow_redirects=True) |
| 23 | self.assertIn(b'Welcome to Flask!', response.data) |
| 24 | self.assertTrue(current_user.name == "Michael") |
| 25 | self.assertTrue(current_user.is_active()) |
| 26 | user = User.query.filter_by(email='michael@realpython.com').first() |
| 27 | self.assertTrue(str(user) == '<name - Michael>') |
| 28 | |
| 29 | # Ensure errors are thrown during an incorrect user registration |
| 30 | def test_incorrect_user_registeration(self): |