Skip to content

Commit

Permalink
modify test to check that the result is superset of the reference
Browse files Browse the repository at this point in the history
  • Loading branch information
eimrek committed Nov 20, 2024
1 parent 159d8ea commit bcc912d
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion tests/test_nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ def test_get_download_formats(client):
response = client.get('/nodes/download_formats')

assert response.status_code == 200
assert response.json() == {

ref = {
'data.core.array.ArrayData.|': ['json'],
'data.core.array.bands.BandsData.|': [
'agr',
Expand All @@ -56,6 +57,16 @@ def test_get_download_formats(client):
'data.core.upf.UpfData.|': ['json', 'upf'],
}

def is_ref_covered(res):
for key, val in ref.items():
if key not in res:
return False
if not set(val) <= set(res[key]):
return False
return True

assert is_ref_covered(response.json()), response.json()


def test_get_single_nodes(default_nodes, client): # pylint: disable=unused-argument
"""Test retrieving a single nodes."""
Expand Down

0 comments on commit bcc912d

Please sign in to comment.