From 9f488ecb5a89cee344b34627093425db39850fb2 Mon Sep 17 00:00:00 2001 From: EdgeNeko Date: Fri, 10 May 2024 22:25:48 +0800 Subject: [PATCH] Fix integrate test --- tests/api/conftest.py | 13 +++++++------ tests/api/integrate_test.py | 2 ++ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/tests/api/conftest.py b/tests/api/conftest.py index 1c0dc6a..1a60c83 100644 --- a/tests/api/conftest.py +++ b/tests/api/conftest.py @@ -6,16 +6,17 @@ TEST_ACCESS_TOKEN = 'test_token' TEST_ADMIN_TOKEN = 'test_admin_token' +config.config.qdrant.mode = "memory" +config.config.admin_api_enable = True +config.config.access_protected = True +config.config.access_token = TEST_ACCESS_TOKEN +config.config.admin_token = TEST_ADMIN_TOKEN +config.config.storage.method = config.StorageMode.LOCAL + @pytest.fixture(scope="session") def test_client(tmp_path_factory) -> TestClient: # Modify the configuration for testing - config.config.qdrant.mode = "memory" - config.config.admin_api_enable = True - config.config.access_protected = True - config.config.access_token = 'test_token' - config.config.admin_token = 'test_admin_token' - config.config.storage.method = config.StorageMode.LOCAL config.config.storage.local.path = tmp_path_factory.mktemp("static_files") from app.webapp import app diff --git a/tests/api/integrate_test.py b/tests/api/integrate_test.py index ae83595..18e0621 100644 --- a/tests/api/integrate_test.py +++ b/tests/api/integrate_test.py @@ -15,6 +15,8 @@ @pytest.mark.asyncio async def test_integrate(test_client): credentials = {'x-admin-token': TEST_ADMIN_TOKEN, 'x-access-token': TEST_ACCESS_TOKEN} + resp = test_client.get("/", headers=credentials) + assert resp.status_code == 200 img_ids = dict() for img_cls in test_images: img_ids[img_cls] = []