Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
patryk-dabrowski committed Sep 13, 2024
1 parent 2ba9bf2 commit 1b4c140
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 91 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 1 addition & 5 deletions backend/hct_mis_api/apps/core/tests/test_resolve_asset.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 1b4c140

Please sign in to comment.