def test_logout(self): tester = weblogin.test_client() tester.post('/login', data=dict(username="******", password="******"), follow_redirects=True) response = tester.get('/logout', follow_redirects=True) self.assertIn(b'You were logged out', response.data)
def test_correct_login(self): tester = weblogin.test_client() response = tester.post('/login', data=dict(username="******", password="******"), follow_redirects=True) self.assertIn(b'You were logged in', response.data)
def test_incorrect_login(self): tester = weblogin.test_client() response = tester.post( '/login', data=dict(username="******", password="******"), follow_redirects=True ) self.assertIn(b'Invalid Credentials. Please try again.', response.data)
def test_correct_login(self): tester = weblogin.test_client() response = tester.post( '/login', data=dict(username="******", password="******"), follow_redirects=True ) self.assertIn(b'You were logged in', response.data)
def test_index(self): tester = weblogin.test_client(self) response = tester.get('/login', content_type='html/text') self.assertEqual(response.status_code, 200)
def test_logout_route_requires_login(self): tester = weblogin.test_client() response = tester.get('/logout', follow_redirects=True) self.assertIn(b'You need to login first.', response.data)
def test_login_page_loads(self): tester = weblogin.test_client(self) response = tester.get('/login') self.assertIn(b'Please login', response.data)
def test_incorrect_login(self): tester = weblogin.test_client() response = tester.post('/login', data=dict(username="******", password="******"), follow_redirects=True) self.assertIn(b'Invalid Credentials. Please try again.', response.data)