Exemple #1
0
 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)
Exemple #2
0
 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)
Exemple #3
0
 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)
Exemple #4
0
 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)
Exemple #5
0
 def test_index(self):
     tester = weblogin.test_client(self)
     response = tester.get('/login', content_type='html/text')
     self.assertEqual(response.status_code, 200)
Exemple #6
0
 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)
Exemple #7
0
 def test_login_page_loads(self):
     tester = weblogin.test_client(self)
     response = tester.get('/login')
     self.assertIn(b'Please login', response.data)
Exemple #8
0
 def test_index(self):
     tester = weblogin.test_client(self)
     response = tester.get('/login', content_type='html/text')
     self.assertEqual(response.status_code, 200)
Exemple #9
0
 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)
Exemple #10
0
 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)
Exemple #11
0
 def test_login_page_loads(self):
     tester = weblogin.test_client(self)
     response = tester.get('/login')
     self.assertIn(b'Please login', response.data)