def test_logout(self): tester = WiFinderApp.test_client(self) tester.post('/login', data=dict(username="******", password="******"), follow_redirects=True) response = tester.get('/logout', follow_redirects=True) self.assertTrue(b'You have just been logged out!' in response.data)
def test_login_fail(self): tester = WiFinderApp.test_client(self) response = tester.post( '/login', data=dict(username="******", password="******"), follow_redirects=True ) self.assertTrue(b'Login' in response.data)
def test_logout(self): tester = WiFinderApp.test_client(self) tester.post( '/login', data=dict(username="******", password="******"), follow_redirects=True ) response = tester.get('/logout', follow_redirects=True) self.assertTrue(b'You have just been logged out!' in response.data)
def test_index(self): tester = WiFinderApp.test_client(self) response = tester.get('/login', content_type='html/text') self.assertEqual(response.status_code, 200)
def test_require_login(self): tester = WiFinderApp.test_client(self) response = tester.get('/', follow_redirects=True) self.assertTrue(b'Sorry, you need to login first!' in response.data)
def test_login_fail(self): tester = WiFinderApp.test_client(self) response = tester.post('/login', data=dict(username="******", password="******"), follow_redirects=True) self.assertTrue(b'Login' in response.data)
def test_index_page_loads(self): tester = WiFinderApp.test_client(self) response = tester.get('/login', content_type='html/text') self.assertTrue(b'WiFinder' in response.data)
def test_redirect(self): tester = WiFinderApp.test_client(self) response = tester.get('/', content_type='html/text') self.assertEqual(response.status_code, 302)