Ejemplo n.º 1
0
 def test_admin_logout(self):
     tester = app.test_client(self)
     tester.post('/', 
                 data=dict(username="******", password="******"),
                 follow_redirects=True)
     response = tester.get('/logout', follow_redirects=True)
     self.assertTrue(b'You were just logged out' in response.data)
Ejemplo n.º 2
0
	def test_index(self):
		tester = app.test_client(self)
		response = tester.get('/', content_type='html/text')
		self.assertEqual(response.status_code, 200)
Ejemplo n.º 3
0
	def test_signin_page_loads(self):
		tester = app.test_client(self)
		response = tester.get('/', content_type='html/text')
		self.assertTrue(b'Please sign in' in response.data)
Ejemplo n.º 4
0
 def test_login_requires_login(self):
     tester = app.test_client(self)
     response = tester.get('/logout', follow_redirects=True)
     self.assertIn(b'You need to login first.', response.data)
Ejemplo n.º 5
0
 def test_empty_signin_fields(self):
     tester = app.test_client(self)
     response = tester.post('/', 
                            data=dict(username="", password=""),
                            follow_redirects=True)
     self.assertIn(b'Invalid credentials. Please try again.', response.data)
Ejemplo n.º 6
0
 def test_correct_admin_signin(self):
     tester = app.test_client(self)
     response = tester.post('/', 
                            data=dict(username="******", password="******"),
                            follow_redirects=True)
     self.assertIn(b'You were just logged in', response.data)