From 29c425d85a03c35c2211bb63ad45cbcdc212b6d9 Mon Sep 17 00:00:00 2001 From: Ben Webb Date: Thu, 25 Feb 2021 13:06:39 +0000 Subject: [PATCH] tests: Update tests for translation related changes https://github.com/open-contracting/cove-ocds/issues/144 --- tests/test_common_checks.py | 14 +++++++++++--- tests/test_schema.py | 8 ++++---- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/tests/test_common_checks.py b/tests/test_common_checks.py index 984f114..127fa5e 100644 --- a/tests/test_common_checks.py +++ b/tests/test_common_checks.py @@ -221,7 +221,7 @@ def test_dupe_ids_1(): "null_clause": "", "error_id": None, "values": [{"path": "records/0/releases"}], - "instance": "[]", + "instance": [], }, ], ), @@ -356,7 +356,7 @@ def test_dupe_ids_1(): "null_clause": "", "error_id": None, "values": [{"path": "records/0/releases"}], - "instance": "[]", + "instance": [], }, ], ), @@ -558,4 +558,12 @@ def test_validation_release_or_record_package(record_pkg, filename, validation_e del validation_error_json["schema_title"] validation_error_jsons.append(validation_error_json) - assert validation_error_jsons == validation_error_jsons_expected + def strip_nones(list_of_dicts): + out = [] + for a_dict in list_of_dicts: + out.append( + {key: value for key, value in a_dict.items() if value is not None} + ) + return out + + assert strip_nones(validation_error_jsons) == strip_nones(validation_error_jsons_expected) diff --git a/tests/test_schema.py b/tests/test_schema.py index 2a1cd22..5126341 100644 --- a/tests/test_schema.py +++ b/tests/test_schema.py @@ -29,8 +29,8 @@ def test_basic_1(record_pkg): assert schema.schema_name == "release-schema.json" assert schema.pkg_schema_name == "release-package-schema.json" assert schema.default_version == "1.1" - assert schema.default_schema_host == "https://standard.open-contracting.org/schema/1__1__5/" - assert schema.schema_host == "https://standard.open-contracting.org/schema/1__1__5/" + assert schema.default_schema_host == "https://standard.open-contracting.org/1.1/en/" + assert schema.schema_host == "https://standard.open-contracting.org/1.1/en/" assert not schema.config.config["cache_all_requests"] @@ -59,8 +59,8 @@ def test_pass_config_1(record_pkg): assert schema.schema_name == "release-schema.json" assert schema.pkg_schema_name == "release-package-schema.json" assert schema.default_version == "1.0" - assert schema.default_schema_host == "https://standard.open-contracting.org/schema/1__0__3/" - assert schema.schema_host == "https://standard.open-contracting.org/schema/1__0__3/" + assert schema.default_schema_host == "https://standard.open-contracting.org/1.0/en/" + assert schema.schema_host == "https://standard.open-contracting.org/1.0/en/" assert not schema.config.config["cache_all_requests"]