Fixing mypy issues in tests
This commit is contained in:
@@ -1,20 +1,24 @@
|
|||||||
|
from typing import Any, Generator
|
||||||
|
|
||||||
|
from flask.testing import FlaskClient
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from src.app import app
|
from src.app import app
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def client():
|
def client() -> Generator[FlaskClient, Any, Any]:
|
||||||
app.config["TESTING"] = True
|
app.config["TESTING"] = True
|
||||||
with app.test_client() as client:
|
with app.test_client() as client:
|
||||||
yield client
|
yield client
|
||||||
|
|
||||||
|
|
||||||
def test_heartbeat_status_code(client):
|
def test_heartbeat_status_code(client: FlaskClient) -> None:
|
||||||
response = client.get("/heartbeat")
|
response = client.get("/heartbeat")
|
||||||
assert response.status_code == 200
|
assert response.status_code == 200
|
||||||
|
|
||||||
|
|
||||||
def test_heartbeat_payload(client):
|
def test_heartbeat_payload(client: FlaskClient) -> None:
|
||||||
response = client.get("/heartbeat")
|
response = client.get("/heartbeat")
|
||||||
data = response.get_json()
|
data = response.get_json()
|
||||||
assert data["status"] == "ok"
|
assert data["status"] == "ok"
|
||||||
|
|||||||
Reference in New Issue
Block a user