aboutsummaryrefslogtreecommitdiff
path: root/src/test/test_server.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/test_server.py')
-rw-r--r--src/test/test_server.py26
1 files changed, 12 insertions, 14 deletions
diff --git a/src/test/test_server.py b/src/test/test_server.py
index b3ea741..b283a00 100644
--- a/src/test/test_server.py
+++ b/src/test/test_server.py
@@ -39,10 +39,10 @@ from markupsafe import escape
from hydrilla import util as hydrilla_util
from hydrilla.builder import Build
-from hydrilla.server import create_app
+from hydrilla.server import HydrillaApp, config
here = Path(__file__).resolve().parent
-config_path = here / 'development_config.json'
+config_path = here / 'config.json'
source_path = here / 'source-package-example'
@pytest.fixture(scope="session")
@@ -62,25 +62,23 @@ def default_setup() -> Iterable[dict[str, Path]]:
yield setup
@pytest.fixture(scope="session")
-def client(default_setup: dict[str, Path]) -> Iterable[FlaskClient]:
+def test_config(default_setup) -> Iterable[dict]:
+ """Provide the contents of JSON config file fed to the client."""
+ yield config.load([default_setup['config_path']])
+
+@pytest.fixture(scope="session")
+def client(test_config: dict) -> Iterable[FlaskClient]:
"""Provide app client that serves the object from built sample package."""
- app = create_app(default_setup['config_path'],
- flask_config={'TESTING': True})
+ app = HydrillaApp(test_config, flask_config={'TESTING': True})
with app.test_client() as client:
yield client
-@pytest.fixture(scope="session")
-def development_config(default_setup) -> Iterable[dict]:
- """Provide the contents of JSON config file fed to the client."""
- contents = default_setup['config_path'].read_text()
- yield json.loads(hydrilla_util.strip_json_comments(contents))
-
-def test_project_url(client: FlaskClient, development_config: dict) -> None:
- """Fetch index.html and verify project URL fro config is present there."""
+def test_project_url(client: FlaskClient, test_config: dict) -> None:
+ """Fetch index.html and verify project URL from config is present there."""
response = client.get('/')
assert b'html' in response.data
- project_url = development_config['hydrilla_project_url']
+ project_url = test_config['hydrilla_project_url']
assert escape(project_url).encode() in response.data
@pytest.mark.parametrize('item_type', ['resource', 'mapping'])