Skip to content

Commit

Permalink
Fix some "expected fail" tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
apdavison committed Oct 6, 2024
1 parent 0720314 commit 510ea4a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
6 changes: 6 additions & 0 deletions validation_service_api/validation_service/data_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -906,6 +906,12 @@ def from_kg_query(cls, item, client):
ValidationTestInstance.from_kg_query(instance, client)
for instance in item.get("instances", [])
]
if len(item["instances"]) == 0:
item["implementation_status"] = ImplementationStatus.proposal
elif client.is_released(item["uri"]):
item["implementation_status"] = ImplementationStatus.published
else:
item["implementation_status"] = ImplementationStatus.dev
data_locations = []
for loc in item["data_location"]:
for field in ("IRI", "URL", "name"):
Expand Down
2 changes: 2 additions & 0 deletions validation_service_api/validation_service/resources/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,8 @@ def query_tests(
if alias:
filters["alias"] = alias
if implementation_status:
# todo: this doesn't work, and requires checking release status,
# hence this filter needs to be applied to the results of the query
filters["implementation_status"] = implementation_status
if project_id:
filters["space"] = [f"collab-{collab_id}" for collab_id in project_id]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ def assert_is_valid_url(url):
except ValueError:
raise AssertionError

@pytest.mark.xfail # todo: should pass when using a released instance

def test_get_validation_test_by_id_no_auth():
test_ids = ("01c68387-fcc4-4fd3-85f0-6eb8ce4467a1",)
test_ids = ("90ae68fa-a9e6-49dd-947a-908ab9a6dee2",)
for validation_test_uuid in test_ids:
response = client.get(f"/tests/{validation_test_uuid}")
assert response.status_code == 200
Expand Down Expand Up @@ -92,11 +92,13 @@ def test_get_validation_test_by_id(caplog):
assert response.status_code == 400


@pytest.mark.xfail # test to be updated
def test_list_validation_tests_no_auth():
response = client.get(f"/tests/")
assert response.status_code == 403
assert response.json() == {"detail": "Not authenticated"}
assert response.status_code == 200
validation_tests = response.json()
for validation_test in validation_tests:
check_validation_test(validation_test)
assert validation_test["implementation_status"] == "published"


def test_list_validation_tests_nofilters():
Expand Down

0 comments on commit 510ea4a

Please sign in to comment.