def test_users_cannot_login_unless_registered(self): response = helper.login(self, 'foo', 'bar') self.assertIn(b'Invalid username or password.', response.data)
def test_users_can_login(self): helper.register(self, 'Michael', '*****@*****.**', 'python', 'python') response = helper.login(self, 'Michael', 'python') self.assertIn(b'Welcome!', response.data)
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)
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)