diff options
author | Wojtek Kosior <koszko@koszko.org> | 2022-02-12 11:31:36 +0100 |
---|---|---|
committer | Wojtek Kosior <koszko@koszko.org> | 2022-02-12 16:10:26 +0100 |
commit | 40c24168fcaf9251f56e8570538e9a7dd48795e9 (patch) | |
tree | 42e68ea29d5c809c4b5e37e2a7237917433d7303 /src/test/test_server.py | |
parent | ded47952fc7f3e4484c6ae4a559e514cb660f2bc (diff) | |
download | haketilo-hydrilla-40c24168fcaf9251f56e8570538e9a7dd48795e9.tar.gz haketilo-hydrilla-40c24168fcaf9251f56e8570538e9a7dd48795e9.zip |
remake internationalization, using Babel this time
Diffstat (limited to 'src/test/test_server.py')
-rw-r--r-- | src/test/test_server.py | 26 |
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']) |