added test fixture
parent
9db3510495
commit
a86ac17fd6
@ -0,0 +1,10 @@
|
|||||||
|
import pytest
|
||||||
|
from starlette.testclient import TestClient
|
||||||
|
|
||||||
|
from app.main import app
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture(scope="module")
|
||||||
|
def test_app():
|
||||||
|
client = TestClient(app)
|
||||||
|
yield client
|
@ -1,11 +1,5 @@
|
|||||||
from app.main import app
|
def test_read_main(test_app):
|
||||||
from starlette.testclient import TestClient
|
response = test_app.get('/ping')
|
||||||
|
|
||||||
client = TestClient(app)
|
|
||||||
|
|
||||||
|
|
||||||
def test_read_main():
|
|
||||||
response = client.get('/ping')
|
|
||||||
assert response.status_code == 200
|
assert response.status_code == 200
|
||||||
data = response.json()
|
data = response.json()
|
||||||
assert "pong" in data['ping']
|
assert "pong" in data['ping']
|
||||||
|
Loading…
Reference in New Issue