diff --git a/backend/hct_mis_api/apps/core/tests/cassettes/TestResolveAsset.test_resolve_asset.yaml b/backend/hct_mis_api/apps/core/tests/cassettes/TestResolveAsset.test_resolve_asset.yaml index 0241097d77..d818d994bc 100644 --- a/backend/hct_mis_api/apps/core/tests/cassettes/TestResolveAsset.test_resolve_asset.yaml +++ b/backend/hct_mis_api/apps/core/tests/cassettes/TestResolveAsset.test_resolve_asset.yaml @@ -13,48 +13,6 @@ interactions: User-Agent: - python-requests/2.31.0 method: GET - uri: https://kf.hope.unicef.org/api/v2/assets/aWnA2d5YBBDgQ5WZXpbaRe?format=json&limit=30000 - response: - body: - string: '' - headers: - Connection: - - keep-alive - Content-Language: - - en - Content-Length: - - '0' - Content-Type: - - text/html; charset=utf-8 - Date: - - Thu, 16 May 2024 13:27:54 GMT - Location: - - /api/v2/assets/aWnA2d5YBBDgQ5WZXpbaRe/?format=json&limit=30000 - Referrer-Policy: - - same-origin - Server: - - nginx/1.23.0 - Vary: - - Accept-Language, Origin - X-Content-Type-Options: - - nosniff - status: - code: 301 - message: Moved Permanently -- request: - body: null - headers: - Accept: - - '*/*' - Accept-Encoding: - - gzip, deflate, br - Authorization: - - token 7a07f2b7ce09178429d91de291b0f06878c05da5 - Connection: - - keep-alive - User-Agent: - - python-requests/2.31.0 - method: GET uri: https://kf.hope.unicef.org/api/v2/assets/aWnA2d5YBBDgQ5WZXpbaRe/?format=json&limit=30000 response: body: diff --git a/backend/hct_mis_api/apps/core/tests/cassettes/TestResolveAssetsList.test_resolve_assets_list.yaml b/backend/hct_mis_api/apps/core/tests/cassettes/TestResolveAssetsList.test_resolve_assets_list.yaml index 6972d726c3..07ae79b2f4 100644 --- a/backend/hct_mis_api/apps/core/tests/cassettes/TestResolveAssetsList.test_resolve_assets_list.yaml +++ b/backend/hct_mis_api/apps/core/tests/cassettes/TestResolveAssetsList.test_resolve_assets_list.yaml @@ -13,49 +13,7 @@ interactions: User-Agent: - python-requests/2.31.0 method: GET - uri: https://kf.hope.unicef.org/api/v2/assets?format=json&limit=30000&q=settings__country_codes__icontains:AFG - response: - body: - string: '' - headers: - Connection: - - keep-alive - Content-Language: - - en - Content-Length: - - '0' - Content-Type: - - text/html; charset=utf-8 - Date: - - Thu, 16 May 2024 13:21:20 GMT - Location: - - /api/v2/assets/?format=json&limit=30000&q=settings__country_codes__icontains:AFG - Referrer-Policy: - - same-origin - Server: - - nginx/1.23.0 - Vary: - - Accept-Language, Origin - X-Content-Type-Options: - - nosniff - status: - code: 301 - message: Moved Permanently -- request: - body: null - headers: - Accept: - - '*/*' - Accept-Encoding: - - gzip, deflate, br - Authorization: - - token 7a07f2b7ce09178429d91de291b0f06878c05da5 - Connection: - - keep-alive - User-Agent: - - python-requests/2.31.0 - method: GET - uri: https://kf.hope.unicef.org/api/v2/assets/?format=json&limit=30000&q=settings__country_codes__icontains:AFG + uri: https://kf.hope.unicef.org/api/v2/project-views/pvEsUUfAgYyyV7jpR6i3FvM/assets/?format=json&limit=30000&q=settings__country_codes__icontains:AFG response: body: string: "{\"count\":117,\"next\":null,\"previous\":null,\"results\":[{\"url\":\"https://kf.hope.unicef.org/api/v2/assets/aWnA2d5YBBDgQ5WZXpbaRe/?format=json\",\"date_created\":\"2022-12-05T11:03:08.754929Z\",\"date_modified\":\"2023-10-04T10:38:23.610534Z\",\"date_deployed\":\"2022-12-05T11:03:20.533209Z\",\"owner\":\"https://kf.hope.unicef.org/api/v2/users/afg_admin/?format=json\",\"summary\":{\"geo\":false,\"labels\":[\"Enumerator diff --git a/backend/hct_mis_api/apps/core/tests/test_resolve_asset.py b/backend/hct_mis_api/apps/core/tests/test_resolve_asset.py index 71ff755150..68a56dc888 100644 --- a/backend/hct_mis_api/apps/core/tests/test_resolve_asset.py +++ b/backend/hct_mis_api/apps/core/tests/test_resolve_asset.py @@ -3,7 +3,6 @@ import pytest from dateutil.tz import tzlocal -from graphql import GraphQLError from hct_mis_api.apps.core.fixtures import create_afghanistan from hct_mis_api.apps.core.schema import resolve_asset @@ -16,10 +15,7 @@ class TestResolveAsset: def use_kobo_master_token(self, settings: Any) -> None: settings.KOBO_MASTER_API_TOKEN = "token-from-env" settings.KOBO_KF_URL = "https://kf.hope.unicef.org" - - def test_resolve_asset_wrong_business_area(self) -> None: - with pytest.raises(GraphQLError): - resolve_asset("wrong_business_area", "aWnA2d5YBBDgQ5WZXpbaRe") + settings.KOBO_PROJECT_VIEWS_ID = "pvEsUUfAgYyyV7jpR6i3FvM" @pytest.mark.vcr() def test_resolve_asset(self) -> None: diff --git a/backend/hct_mis_api/apps/core/tests/test_resolve_assets_list.py b/backend/hct_mis_api/apps/core/tests/test_resolve_assets_list.py index d6e7813e18..51d756b427 100644 --- a/backend/hct_mis_api/apps/core/tests/test_resolve_assets_list.py +++ b/backend/hct_mis_api/apps/core/tests/test_resolve_assets_list.py @@ -15,8 +15,9 @@ class TestResolveAssetsList: @pytest.fixture(autouse=True) def use_kobo_master_token(self, settings: Any) -> None: - settings.KOBO_MASTER_API_TOKEN = "token-from-env" + settings.KOBO_MASTER_API_TOKEN = "test-token" settings.KOBO_KF_URL = "https://kf.hope.unicef.org" + settings.KOBO_PROJECT_VIEWS_ID = "pvEsUUfAgYyyV7jpR6i3FvM" def test_resolve_assets_list_wrong_business_area(self) -> None: with pytest.raises(GraphQLError):