コード例 #1
0
 def test_hello(self):
   with app.test_client() as c:
     request = c.get('/hello')
     assert request.data.decode() == 'hello'
コード例 #2
0
 def test_root_upper(self):
   with app.test_client() as c:
     request = c.get('/?uppercase=true')
     assert request.data.decode() == 'HELLO WORLD'
コード例 #3
0
 def test_root_reverse(self):
   with app.test_client() as c:
     request = c.get('/?reversed=true')
     assert request.data.decode() == 'dlrow olleh'
コード例 #4
0
 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'
コード例 #5
0
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
コード例 #6
0
def client():
    app.config['TESTING'] = True
    return app.test_client()
コード例 #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')
コード例 #8
0
ファイル: test1.py プロジェクト: lapee/flask-test-for-gitlab
 def test_index(self):
     tester = app.test_client(self)
     response = tester.get('/', content_type='html/text')
     self.assertEqual(response.status_code, 200)