Пример #1
0
 def test_user_registration_error(self):
     self.app.get('register/', follow_redirects=True)
     helper.register(self, 'Michael', '*****@*****.**', 'python', 'python')
     self.app.get('register/', follow_redirects=True)
     response = helper.register(self,
                                'Michael', '*****@*****.**', 'python', 'python')
     self.assertIn(
         b'That username and/or email already exist.',
         response.data)
Пример #2
0
 def test_logged_in_users_can_logout(self):
     helper.register(self, 'Fletcher', '*****@*****.**', 'python101', 'python101')
     helper.login(self, 'Fletcher', 'python101')
     response = helper.logout(self)
     self.assertIn(b'Goodbye!', response.data)
Пример #3
0
 def test_users_can_login(self):
     helper.register(self, 'Michael', '*****@*****.**', 'python', 'python')
     response = helper.login(self, 'Michael', 'python')
     self.assertIn(b'Welcome!', response.data)
Пример #4
0
 def test_invalid_form_data(self):
     helper.register(self, 'Michael', '*****@*****.**', 'python', 'python')
     response = helper.login(self, 'alert("alert box!");', 'foo')
     self.assertIn(b'Invalid username or password.', response.data)
Пример #5
0
 def test_user_registration(self):
     self.app.get('register/', follow_redirects=True)
     response = helper.register(self, 'Michael', '*****@*****.**', 'python', 'python')
     self.assertIn(b'Thanks for registering. Please login.', response.data)