From 6aa72a2ee260b606ea9c090091338f49d8c50c16 Mon Sep 17 00:00:00 2001 From: odrakes-cpr Date: Tue, 21 Jan 2025 17:03:55 +0000 Subject: [PATCH] chore: update db client version (#451) * chore: update db client version * update to correct version --------- Co-authored-by: Osneil Drakes --- poetry.lock | 10 +++---- pyproject.toml | 4 +-- .../non_search/routers/lookups/test_config.py | 6 +++++ .../summaries/test_geography_summaries.py | 27 ++++++++++++++++--- 4 files changed, 36 insertions(+), 11 deletions(-) diff --git a/poetry.lock b/poetry.lock index 3fa52cde..73fca5c7 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 1.8.1 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand. [[package]] name = "aiohappyeyeballs" @@ -808,7 +808,7 @@ vision = ["Pillow (>=9.4.0)"] [[package]] name = "db-client" -version = "3.8.25" +version = "3.8.28" description = "All things to do with the datamodel and its storage. Including alembic migrations and datamodel code." optional = false python-versions = "^3.9" @@ -828,8 +828,8 @@ SQLAlchemy-Utils = "^0.38.2" [package.source] type = "git" url = "https://github.com/climatepolicyradar/navigator-db-client.git" -reference = "v3.8.25" -resolved_reference = "654ce6ab5e76e6cfeb71d0a57376bc084d14c694" +reference = "v3.8.28" +resolved_reference = "68fa86b06b58f1bafacc79935b85ea1f8f3b675d" [[package]] name = "deprecation" @@ -4298,4 +4298,4 @@ type = ["pytest-mypy"] [metadata] lock-version = "2.0" python-versions = "^3.10" -content-hash = "9b60febffea038babd3cf9511a0f9f560fd51d35172d66a48e87bdf191a580b3" +content-hash = "866b8f465409c1fc9c8b0dca48a3b911783a968701a29871b3cc43da5b16258c" diff --git a/pyproject.toml b/pyproject.toml index 2b79e3ca..6770a186 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "navigator_backend" -version = "1.23.0" +version = "1.23.1" description = "" authors = ["CPR-dev-team "] packages = [{ include = "app" }, { include = "tests" }] @@ -31,7 +31,7 @@ starlette = "^0.27.0" tenacity = "^8.0.1" uvicorn = { extras = ["standard"], version = "^0.20.0" } botocore = "^1.34.19" -db-client = { git = "https://github.com/climatepolicyradar/navigator-db-client.git", tag = "v3.8.25" } +db-client = { git = "https://github.com/climatepolicyradar/navigator-db-client.git", tag = "v3.8.28" } urllib3 = "<2" apscheduler = "^3.10.4" numpy = "1.26.4" diff --git a/tests/non_search/routers/lookups/test_config.py b/tests/non_search/routers/lookups/test_config.py index 068faaa8..7fd8e730 100644 --- a/tests/non_search/routers/lookups/test_config.py +++ b/tests/non_search/routers/lookups/test_config.py @@ -140,6 +140,7 @@ def test_config_endpoint_content(data_client, data_db, app_token_factory, valid_ "Legislative": 0, "UNFCCC": 0, "MCF": 0, + "Reports": 0, } assert cclw_corpus["corpus_import_id"] == "CCLW.corpus.i00000001.n0000" @@ -254,6 +255,7 @@ def test_config_endpoint_returns_stats_for_all_allowed_corpora( "Legislative": 0, "MCF": 0, "UNFCCC": 0, + "Reports": 0, } cclw_corpora = response_json["corpus_types"]["Laws and Policies"]["corpora"] @@ -266,6 +268,7 @@ def test_config_endpoint_returns_stats_for_all_allowed_corpora( "Legislative": 1, "MCF": 0, "UNFCCC": 0, + "Reports": 0, } second_cclw_corpus = cclw_corpora[0] assert second_cclw_corpus["total"] == 1 @@ -274,6 +277,7 @@ def test_config_endpoint_returns_stats_for_all_allowed_corpora( "Legislative": 1, "MCF": 0, "UNFCCC": 0, + "Reports": 0, } @@ -335,6 +339,7 @@ def test_config_endpoint_does_not_return_stats_for_not_allowed_corpora( "Legislative": 1, "MCF": 0, "UNFCCC": 0, + "Reports": 0, } @@ -389,6 +394,7 @@ def test_config_endpoint_returns_stats_for_all_orgs_if_no_allowed_corpora_in_app "Legislative": 0, "MCF": 0, "UNFCCC": 0, + "Reports": 0, } diff --git a/tests/non_search/routers/summaries/test_geography_summaries.py b/tests/non_search/routers/summaries/test_geography_summaries.py index 4d1339e3..ceff30d6 100644 --- a/tests/non_search/routers/summaries/test_geography_summaries.py +++ b/tests/non_search/routers/summaries/test_geography_summaries.py @@ -6,6 +6,15 @@ TEST_HOST = "http://localhost:3000/" GEOGRAPHY_PAGE_ENDPOINT = "/api/v1/summaries/geography" +EXPECTED_NUM_FAMILY_CATEGORIES = 5 +EXPECTED_FAMILY_CATEGORIES = { + "Executive", + "Legislative", + "UNFCCC", + "MCF", + "Reports", +} + def _make_request( client, @@ -29,18 +38,23 @@ def test_endpoint_returns_families_ok_with_slug(data_client, valid_token): """Test the endpoint returns an empty sets of data""" resp = _make_request(data_client, valid_token, "moldova") - assert len(resp["family_counts"]) == 4 - assert len(resp["top_families"]) == 4 + assert len(resp["family_counts"]) == EXPECTED_NUM_FAMILY_CATEGORIES + assert len(resp["top_families"]) == EXPECTED_NUM_FAMILY_CATEGORIES + + assert set(resp["family_counts"].keys()) == EXPECTED_FAMILY_CATEGORIES + assert set(resp["top_families"].keys()) == EXPECTED_FAMILY_CATEGORIES assert resp["family_counts"]["Executive"] == 0 assert resp["family_counts"]["Legislative"] == 0 assert resp["family_counts"]["UNFCCC"] == 0 assert resp["family_counts"]["MCF"] == 0 + assert resp["family_counts"]["Reports"] == 0 assert len(resp["top_families"]["Executive"]) == 0 assert len(resp["top_families"]["Legislative"]) == 0 assert len(resp["top_families"]["UNFCCC"]) == 0 assert len(resp["top_families"]["MCF"]) == 0 + assert len(resp["top_families"]["Reports"]) == 0 assert len(resp["targets"]) == 0 @@ -49,18 +63,23 @@ def test_endpoint_returns_families_ok_with_code(data_client, valid_token): """Test the endpoint returns an empty sets of data""" resp = _make_request(data_client, valid_token, "MDA") - assert len(resp["family_counts"]) == 4 - assert len(resp["top_families"]) == 4 + assert len(resp["family_counts"]) == EXPECTED_NUM_FAMILY_CATEGORIES + assert len(resp["top_families"]) == EXPECTED_NUM_FAMILY_CATEGORIES + + assert set(resp["family_counts"].keys()) == EXPECTED_FAMILY_CATEGORIES + assert set(resp["top_families"].keys()) == EXPECTED_FAMILY_CATEGORIES assert resp["family_counts"]["Executive"] == 0 assert resp["family_counts"]["Legislative"] == 0 assert resp["family_counts"]["UNFCCC"] == 0 assert resp["family_counts"]["MCF"] == 0 + assert resp["family_counts"]["Reports"] == 0 assert len(resp["top_families"]["Executive"]) == 0 assert len(resp["top_families"]["Legislative"]) == 0 assert len(resp["top_families"]["UNFCCC"]) == 0 assert len(resp["top_families"]["MCF"]) == 0 + assert len(resp["top_families"]["Reports"]) == 0 assert len(resp["targets"]) == 0