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
|
||||
from starlette.testclient import TestClient
|
||||
|
||||
client = TestClient(app)
|
||||
|
||||
|
||||
def test_read_main():
|
||||
response = client.get('/ping')
|
||||
def test_read_main(test_app):
|
||||
response = test_app.get('/ping')
|
||||
assert response.status_code == 200
|
||||
data = response.json()
|
||||
assert "pong" in data['ping']
|
||||
|
Loading…
Reference in New Issue