From dc061312080116899ce33c625feef86596877438 Mon Sep 17 00:00:00 2001 From: Rob Cannon Date: Tue, 29 Oct 2024 12:23:44 +0700 Subject: [PATCH] chore: make cmc / cg api tests context managed --- tests/integration/api/test_api_cmc.py | 7 +++++++ tests/integration/api/test_api_coingecko.py | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/tests/integration/api/test_api_cmc.py b/tests/integration/api/test_api_cmc.py index 01c7f51..3bf049b 100644 --- a/tests/integration/api/test_api_cmc.py +++ b/tests/integration/api/test_api_cmc.py @@ -4,6 +4,13 @@ from balanced_backend.config import settings +@pytest.fixture +def client(event_loop) -> TestClient: + from balanced_backend.main_api import app + with TestClient(app) as client: + yield client + + @pytest.mark.anyio def test_api_get_cmc_summary(client: TestClient): response = client.get(f"{settings.REST_PREFIX}/coin-market-cap/summary") diff --git a/tests/integration/api/test_api_coingecko.py b/tests/integration/api/test_api_coingecko.py index d546b34..f19d7a9 100644 --- a/tests/integration/api/test_api_coingecko.py +++ b/tests/integration/api/test_api_coingecko.py @@ -3,6 +3,12 @@ from balanced_backend.config import settings +@pytest.fixture +def client(event_loop) -> TestClient: + from balanced_backend.main_api import app + with TestClient(app) as client: + yield client + @pytest.mark.anyio def test_api_get_coingecko_summary(client: TestClient):