Skip to content

Commit

Permalink
Links to codelists - rewrite to OCDS Standard - tests
Browse files Browse the repository at this point in the history
  • Loading branch information
odscjames committed Dec 5, 2023
1 parent d71c81e commit 2daa4a2
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/test_general.py
Original file line number Diff line number Diff line change
Expand Up @@ -619,3 +619,24 @@ def test_get_json_data_missing_ids():
missin_ids_paths = cove_common.get_json_data_missing_ids(user_data_paths, schema_obj)

assert missin_ids_paths == results


@pytest.mark.django_db
def test_codelist_url_rewriting(client):
file_name = os.path.join(
"tests",
"fixtures",
"tenders_releases_2_releases_codelists.json",
)
with open(os.path.join(file_name)) as fp:
user_data = fp.read()
data = SuppliedData.objects.create()
data.original_file.save("test.json", ContentFile(user_data))
data.current_app = "cove_ocds"
resp = client.get(data.get_absolute_url())
assert resp.status_code == 200
assert len(resp.context["additional_closed_codelist_values"]) == 1
assert resp.context["additional_closed_codelist_values"]["releases/tag"].get("codelist_url") == "https://standard.open-contracting.org/1.1/en/schema/codelists/#release-tag"
assert len(resp.context["additional_open_codelist_values"]) == 1
assert resp.context["additional_open_codelist_values"]["releases/tender/items/classification/scheme"].get("codelist_url") == "https://standard.open-contracting.org/1.1/en/schema/codelists/#item-classification-scheme"

0 comments on commit 2daa4a2

Please sign in to comment.