summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorWojtek Kosior <koszko@koszko.org>2021-11-17 21:12:22 +0100
committerWojtek Kosior <koszko@koszko.org>2021-11-17 21:12:22 +0100
commita6721b316fca0f7a460fa2e62ed679238f97a10e (patch)
tree08600f8fb34a5f888a27f43480b1dae89e422d0f /src/test
parentc6e5d1ece9c9ddf738e4124135f33651c94baa7c (diff)
downloadhaketilo-hydrilla-a6721b316fca0f7a460fa2e62ed679238f97a10e.tar.gz
haketilo-hydrilla-a6721b316fca0f7a460fa2e62ed679238f97a10e.zip
enable querying of patterns by url
Diffstat (limited to 'src/test')
-rw-r--r--src/test/test_pydrilla.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/test/test_pydrilla.py b/src/test/test_pydrilla.py
index 660c8f3..db9a321 100644
--- a/src/test/test_pydrilla.py
+++ b/src/test/test_pydrilla.py
@@ -99,6 +99,17 @@ def test_api_basic(client, development_config):
response = client.get('/sources/random-bad-identifier')
assert response.status_code == 404
+ response = client.get('/query?url=https://hachettebugs.koszko.org')
+ definitions = json.loads(response.data.decode())
+ assert type(definitions) is list
+ assert all([d['type'] == 'mapping' for d in definitions])
+ assert any([p['pattern'] == 'https://hachettebugs.koszko.org/***'
+ for d in definitions for p in d['payloads']])
+
+ response = client.get('/query?url=https://random_bad_domain.org/something')
+ definitions = json.loads(response.data.decode())
+ assert 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]