def test_hello(self):
   with app.test_client() as c:
     request = c.get('/hello')
     assert request.data.decode() == 'hello'
 def test_root_upper(self):
   with app.test_client() as c:
     request = c.get('/?uppercase=true')
     assert request.data.decode() == 'HELLO WORLD'
 def test_root_reverse(self):
   with app.test_client() as c:
     request = c.get('/?reversed=true')
     assert request.data.decode() == 'dlrow olleh'
 def test_root_upper_reverse(self):
   with app.test_client() as c:
     request = c.get('/?uppercase=true&reversed=true')
     assert request.data.decode() == 'DLROW OLLEH'
from helloworld import app

app = app.test_client()


def test_should_return_200_status():
    response = app.get("/helloworld")
    assert response.status_code == 200


def test_should_return_hello_world_body():
    response = app.get("/helloworld")
    assert b"Hello World!" in response.data
def client():
    app.config['TESTING'] = True
    return app.test_client()
Example #7
0
 def test_index(self):
     tester = app.test_client(self)
     response = tester.get('/', content_type='html/text')
     self.assertEqual(response.data, b'Hello pooq')
Example #8
0
 def test_index(self):
     tester = app.test_client(self)
     response = tester.get('/', content_type='html/text')
     self.assertEqual(response.status_code, 200)