def test_home(self): tester = app.test_client(self) response = tester.post('/login', data=dict(email="*****@*****.**", password="******"), follow_redirects=True) self.assertIn(b"Login Successfull !!", response.data)
def test_homepage(self): tester = app.test_client(self) response = tester.get("/home") self.assertEqual(response.status_code, 200) self.assertTrue(b'Welcome to Kinetic Labs' in response.data) self.assertTrue( b'New messages every time you refresh' in response.data)
def test_reset_token(self): tester = app.test_client(self) response = tester.post('/reset_password', data=dict(email="*****@*****.**"), follow_redirects=True) self.assertIn(b"An email has been sent for password reset", response.data)
def test_homepage(self): tester = app.test_client(self) response = tester.get("/home") self.assertEqual(response.status_code, 200) self.assertTrue(b'Welcome to Wipro' in response.data) self.assertTrue(b'Welcome to Digital' in response.data) self.assertTrue(b'Welcome to our demo' in response.data)
def setUp(self): """Stuff to do before every test.""" # Get the Flask test client self.client = app.test_client() # Show Flask errors that happen during tests app.config['TESTING'] = True
def setUp(self): app.config['TESTING'] = True app.config['WTF_CSRF_ENABLED'] = False app.config['DEBUG'] = False app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///' self.app = app.test_client() db.drop_all() db.create_all() self.assertEqual(app.debug, False)
def test_response_200(): response = app.test_client().get("/") assert response.status_code == 200 response = app.test_client().get("/home") assert response.status_code == 200 response = app.test_client().get("/about") assert response.status_code == 200 response = app.test_client().get("/login") assert response.status_code == 200 response = app.test_client().post("/login") assert response.status_code == 200 response = app.test_client().get("/register") assert response.status_code == 200 response = app.test_client().post("/register") assert response.status_code == 200
def setUp(self): self.app = app.test_client() self.assertEqual(app.debug, False)
def test_aboutpage(self): tester = app.test_client(self) response = tester.get("/about") self.assertEqual(response.status_code, 200) self.assertTrue((b'Hello World' in response.data)) self.assertTrue((b'This is my demo Hello World' in response.data))
def setUp(self): self.app = app.test_client()
def test_post_id(self): tester = app.test_client(self) response = tester.get('/post/4', content_type='html/text') self.assertIn(b"Computer", response.data)
def setUp(self): self.app = app.test_client() self.app.testing = True
def test_reset_route(self): tester = app.test_client(self) response = tester.get('/reset_password', content_type='html/text') self.assertEqual(response.status_code, 200)
def test_home_route(self): tester = app.test_client(self) response = tester.get('/login', content_type='html/text') self.assertEqual(response.status_code, 200)
def test_home_page(self): tester = app.test_client(self) response = tester.get('/home', follow_redirects=True, content_type='html/text') self.assertEqual(response.status_code, 200)
def test_formpage(self): tester = app.test_client(self) response = tester.get("/form") self.assertEqual(response.status_code, 200)
def client(): app.config["TESTING"] = True app.config["WTF_CSRF_ENABLED"] = False with app.test_client() as client: yield client
def test_homepage(self): tester = app.test_client(self) response = tester.get("/home") self.assertEqual(response.status_code, 200) self.assertTrue(b'Welcome to Wipro digital' in response.data) self.assertTrue(b'Thanks for your reviews :)' in response.data)
def test_aboutpage(self): tester = app.test_client(self) response = tester.get("/about") self.assertEqual(response.status_code, 200) self.assertTrue((b'About Page' in response.data))