summaryrefslogtreecommitdiff
path: root/src/test/test_pydrilla.py
diff options
context:
space:
mode:
authorWojtek Kosior <koszko@koszko.org>2021-11-16 18:34:46 +0100
committerWojtek Kosior <koszko@koszko.org>2021-11-16 18:34:46 +0100
commit9bbc08a2c156be4e5c960e470a85b3d98570d94b (patch)
tree4762ab0c061e191c648949b455b83262118d4e1f /src/test/test_pydrilla.py
parent5bb61d9aa41bb698a4339d281a70f0a617ee139e (diff)
downloadhaketilo-hydrilla-9bbc08a2c156be4e5c960e470a85b3d98570d94b.tar.gz
haketilo-hydrilla-9bbc08a2c156be4e5c960e470a85b3d98570d94b.zip
enable fetching of all mapping/resource versions
Diffstat (limited to 'src/test/test_pydrilla.py')
-rw-r--r--src/test/test_pydrilla.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/test/test_pydrilla.py b/src/test/test_pydrilla.py
index ed98f13..9e87704 100644
--- a/src/test/test_pydrilla.py
+++ b/src/test/test_pydrilla.py
@@ -51,9 +51,9 @@ def test_api_basic(client):
for item_type in ['mapping', 'resource']:
response = client.get(f'/{item_type}s/helloapple')
definition = json.loads(response.data.decode())
- assert definition['type'] == item_type
+ assert definition['type'] == item_type
assert definition['source_name'] == 'hello'
- assert definition['version'] == [2021, 11, 10]
+ assert definition['version'] == [2021, 11, 10]
response = client.get(f'/{item_type}s/helloapple?ver=2021.11.10.0')
assert definition == json.loads(response.data.decode())
@@ -61,6 +61,15 @@ def test_api_basic(client):
response = client.get(f'/{item_type}s/helloapple?ver=2021.11.10.999')
assert response.status_code == 404
+ response = client.get(f'/{item_type}s/helloapple?ver=random_input')
+ assert response.status_code == 400
+
+ response = client.get(f'/{item_type}s/helloapple?ver=all')
+ definitions = json.loads(response.data.decode())
+ assert type(definitions) is list
+ assert all([d['type'] == item_type for d in definitions])
+ assert any([d['version'] == [2021, 11, 10] for d in definitions])
+
def test_normalize_version():
assert pydrilla.normalize_version([4, 5, 3, 0, 0]) == [4, 5, 3]
assert pydrilla.normalize_version([1, 0, 5, 0]) == [1, 0, 5]