def test_correct_login(self): tester = app.test_client(self) response = tester.post( '/signin', data=dict(email="*****@*****.**", password="******"), follow_redirects = True) self.assertIn(b'Welcome [email protected]\'s profile page', response.data)
def test_incorrect_login(self): tester = app.test_client(self) response = tester.post( '/signin', data=dict(email="*****@*****.**", password="******"), follow_redirects = True ) self.assertIn(b'Invalid e-mail or password', response.data)
def test_logout(self): tester = app.test_client(self) tester.post( '/signin', data=dict(email="*****@*****.**", password="******"), follow_redirects = True ) response = tester.get('/signout', follow_redirects=True) self.assertIn(b'Welcome to APP', response.data)
def test_add_item(self): tester = app.test_client(self) tester.post( '/signin', data=dict(email="*****@*****.**", password="******"), follow_redirects = True ) tester.post('/delivery', data=dict(name="test", phone1="1234567890", phone2="1234567890", email="",city="test", address="test", floor="1", apartment="1", address_comments="test", order_comments="test", number_of_pieces="1", time_of_pickup="2000-01-01 00:00:00", time_of_delivery="2000-01-01 00:00:00", lang="ENG", condition="Use"), follow_redirects = True ) response = tester.get('/showdelivery', follow_redirects=True) self.assertIn(b'1234567890', response.data)
def test_main_route_requires_login(self): tester = app.test_client(self) response = tester.get('/showdelivery', follow_redirects=True) self.assertTrue(b'Sign In' in response.data)
def test_login_page_loads(self): tester = app.test_client(self) response = tester.get('/signin', content_type='html/text') self.assertTrue(b'Sign In' in response.data)
def test_index(self): tester = app.test_client(self) response = tester.get('/', content_type='html/text') self.assertEqual(response.status_code, 200)