Skip to content

Commit

Permalink
refactor: update tests to use html
Browse files Browse the repository at this point in the history
  • Loading branch information
sylvanr committed Nov 28, 2023
1 parent f2f9489 commit 2b7aeda
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion tests/direct_indexing/cleaning/test_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def fixture_dataset_metadata():
"description": "",
"metadata_modified": "2022-05-05T23:56:00.301819",
"cache_last_updated": "",
"url": "http://formin.finland.fi/opendata/IATI/Finland_total_2012.xml",
"url": "https://formin.finland.fi/opendata/IATI/Finland_total_2012.xml",
"format": "iati-xml",
"state": "active",
"created": "2022-04-20T07:16:11.709336",
Expand Down
6 changes: 3 additions & 3 deletions tests/direct_indexing/custom_fields/test_codelists.py
Original file line number Diff line number Diff line change
Expand Up @@ -1856,14 +1856,14 @@ def fixture_cl(monkeypatch):
"code": "2",
"name": "UN Sustainable Development Goals (SDG)",
"description": "A value from the top-level list of UN sustainable development goals (SDGs) (e.g. \u20181\u2019)", # NOQA: E501
"url": "http://reference.iatistandard.org/codelists/UNSDG-Goals/",
"url": "https://reference.iatistandard.org/codelists/UNSDG-Goals/",
"status": "active"
},
{
"code": "3",
"name": "UN Sustainable Development Goals (SDG) Targets",
"description": "A value from the second-level list of UN sustainable development goals (SDGs) (e.g. \u20181.1\u2019)", # NOQA: E501
"url": "http://reference.iatistandard.org/codelists/UNSDG-Targets/",
"url": "https://reference.iatistandard.org/codelists/UNSDG-Targets/",
"status": "active"
},
{
Expand Down Expand Up @@ -2246,7 +2246,7 @@ def fixture_cl(monkeypatch):
"code": "1",
"name": "OECD DAC CRS",
"description": "The policy marker is an OECD DAC CRS policy marker, Reported in columns 20-23, 28-31 and 54 of CRS++ reporting format.", # NOQA: E501
"url": "http://reference.iatistandard.org/codelists/PolicyMarker/",
"url": "https://reference.iatistandard.org/codelists/PolicyMarker/",
"status": "active"
},
{
Expand Down
4 changes: 2 additions & 2 deletions tests/direct_indexing/metadata/test_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ def test_load_codelists(mocker):


def test__get_existing_datasets(mocker, requests_mock, fixture_solr_dataset, fixture_existing_datasets):
mocker.patch('direct_indexing.metadata.dataset.settings.SOLR_DATASET', "http://test.com")
requests_mock.get("http://test.com" + (
mocker.patch('direct_indexing.metadata.dataset.settings.SOLR_DATASET', "https://test.com")
requests_mock.get("https://test.com" + (
'/select?q=resources.hash:* AND extras.filetype:*'
' AND id:*&rows=100000&wt=json&fl=resources.hash,id,extras.filetype'
), json=fixture_solr_dataset)
Expand Down
2 changes: 1 addition & 1 deletion tests/direct_indexing/metadata/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# consts
SETTINGS_FRESH = 'direct_indexing.metadata.util.settings.FRESH'
SETTINGS_DATASET_PARENT_PATH = 'direct_indexing.metadata.util.settings.DATASET_PARENT_PATH'
TEST_URL = 'http://test.com'
TEST_URL = 'https://test.com'


def test_retrieve(mocker, tmp_path, sample_data, requests_mock):
Expand Down
4 changes: 2 additions & 2 deletions tests/direct_indexing/processing/test_activity_subtypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ def test_process_subtype_dict(mocker):
expected_res = subtype_dict.copy()
key = 'transaction'
mock = mocker.MagicMock()
res = process_subtype_dict(subtype_dict, key, mock, None, None, None)
res = process_subtype_dict(subtype_dict, key, mock, mock, None, None)
assert res == expected_res

# Test if key is in exclude fields we do not include it in the subtype dict
res = process_subtype_dict(subtype_dict, bvu, mock, None, [bvu], None)
res = process_subtype_dict(subtype_dict, bvu, mock, mock, [bvu], None)
assert res == expected_res

# Test that a specific value which is a dict can be retrieved
Expand Down
12 changes: 6 additions & 6 deletions tests/direct_indexing/processing/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def fixture_dataset_activity():
"description": None,
"metadata_modified": "2023-10-29T05:49:15.354998",
"cache_last_updated": None,
"url": "http://iati.fcdo.gov.uk/iati_files/solr/FCDO-set-1.xml",
"url": "https://iati.fcdo.gov.uk/iati_files/solr/FCDO-set-1.xml",
"format": "IATI-XML",
"state": "active",
"created": "2023-10-29T05:49:12.216564",
Expand Down Expand Up @@ -170,15 +170,15 @@ def fixture_dataset_activity():
"value": "Not Found"
}
],
"license_url": "http://reference.data.gov.uk/id/open-government-licence",
"license_url": "https://reference.data.gov.uk/id/open-government-licence",
"organization": {
"description": "",
"title": "UK - Foreign, Commonwealth and Development Office",
"created": "2020-08-19T13:55:48.059928",
"approval_status": "approved",
"is_organization": True,
"state": "active",
"image_url": "http://iati.fcdo.gov.uk/iati_files/FCDO_logo.png",
"image_url": "https://iati.fcdo.gov.uk/iati_files/FCDO_logo.png",
"type": "organization",
"id": "4da32e41-a060-4d75-86c1-4b627eb22647",
"name": "fcdo"
Expand Down Expand Up @@ -213,7 +213,7 @@ def fixture_dataset_organisation():
"description": "",
"metadata_modified": "2023-11-03T04:58:51.148529",
"cache_last_updated": None,
"url": "http://iati.fcdo.gov.uk/iati_files/organisation.xml",
"url": "https://iati.fcdo.gov.uk/iati_files/organisation.xml",
"format": "IATI-XML",
"state": "active",
"created": "2020-09-01T11:35:05.318259",
Expand Down Expand Up @@ -273,15 +273,15 @@ def fixture_dataset_organisation():
"value": "Success"
}
],
"license_url": "http://reference.data.gov.uk/id/open-government-licence",
"license_url": "https://reference.data.gov.uk/id/open-government-licence",
"organization": {
"description": "",
"title": "UK - Foreign, Commonwealth and Development Office",
"created": "2020-08-19T13:55:48.059928",
"approval_status": "approved",
"is_organization": True,
"state": "active",
"image_url": "http://iati.fcdo.gov.uk/iati_files/FCDO_logo.png",
"image_url": "https://iati.fcdo.gov.uk/iati_files/FCDO_logo.png",
"type": "organization",
"id": "4da32e41-a060-4d75-86c1-4b627eb22647",
"name": "fcdo"
Expand Down
4 changes: 2 additions & 2 deletions tests/direct_indexing/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# Test clear_core function
def test_clear_core(mocker):
# Define the core URL
core_url = "http://example.com/solr/core"
core_url = "https://example.com/solr/core"

# Mock the pysolr.Solr instance
mock_solr = mocker.patch('pysolr.Solr')
Expand Down Expand Up @@ -53,7 +53,7 @@ def test_index_to_core(tmp_path, mocker):
with open(json_path, 'w') as file:
file.write('{"key": "value"}')

url = "http://example.com/solr/core"
url = "https://example.com/solr/core"
OP = "subprocess.check_output"
# SUCCESSFUL INDEX:
# Mock subprocess.check_output to simulate success
Expand Down

0 comments on commit 2b7aeda

Please sign in to comment.