diff options
author | Wojtek Kosior <koszko@koszko.org> | 2021-11-17 17:31:35 +0100 |
---|---|---|
committer | Wojtek Kosior <koszko@koszko.org> | 2021-11-17 17:31:35 +0100 |
commit | c6e5d1ece9c9ddf738e4124135f33651c94baa7c (patch) | |
tree | a3407dbcfe51ac291ed14ef48e73be7902100428 /src/test/test_pydrilla.py | |
parent | c00ed7f9ef28f6aee946e168a535d7f637fe46ae (diff) | |
download | haketilo-hydrilla-c6e5d1ece9c9ddf738e4124135f33651c94baa7c.tar.gz haketilo-hydrilla-c6e5d1ece9c9ddf738e4124135f33651c94baa7c.zip |
add link to software sources to ease compliance with AGPL
Diffstat (limited to 'src/test/test_pydrilla.py')
-rw-r--r-- | src/test/test_pydrilla.py | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/test/test_pydrilla.py b/src/test/test_pydrilla.py index 9ec6ba6..660c8f3 100644 --- a/src/test/test_pydrilla.py +++ b/src/test/test_pydrilla.py @@ -30,23 +30,31 @@ import shutil from pathlib import Path from os import mkdir, unlink, environ import json +from markupsafe import escape from pydrilla import pydrilla, create_app test_dir = Path(__file__).resolve().parent packages_dir = test_dir.parent -test_config_path = test_dir / 'development_config.json' +development_config_path = test_dir / 'development_config.json' @pytest.fixture def client(): - app = create_app(test_config_path, flask_config={'TESTING': True}) + app = create_app(development_config_path, flask_config={'TESTING': True}) with app.test_client() as client: yield client -def test_api_basic(client): +@pytest.fixture +def development_config(): + with open(development_config_path) as config_file: + yield json.loads(pydrilla.strip_json_comments(config_file.read())) + +def test_api_basic(client, development_config): response = client.get('/') assert b'html' in response.data + sources_uri = development_config['hydrilla_sources_uri'] + assert escape(sources_uri).encode() in response.data for item_type in ['mapping', 'resource']: response = client.get(f'/{item_type}s/helloapple') @@ -95,3 +103,6 @@ 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] assert pydrilla.normalize_version([3, 3]) == [3, 3] + +def test_strip_json_comments(development_config): + assert development_config['static_resource_uri'] == 'http://localhost:8000/' |