mirror of
https://github.com/fhswf/aki_prj23_transparenzregister.git
synced 2025-06-22 00:23:55 +02:00
build first set of docker container in pipline and place them in the the github registry (#142)
- added a Dockerfile for the thre containers - added a workflow step to build and placing the container in the registry - added a docker-compose.yaml to use the build images - added a docker compose to build the images locally and a script for prebuild steps
This commit is contained in:
@ -58,6 +58,13 @@ def test_json_provider_get_postgres() -> None:
|
||||
assert config.host == data["postgres"]["host"]
|
||||
assert config.database == data["postgres"]["database"]
|
||||
assert config.port == data["postgres"]["port"]
|
||||
assert isinstance(str(config), str)
|
||||
assert "Mongo" not in str(config)
|
||||
assert "Postgre" in str(config)
|
||||
|
||||
assert isinstance(str(JsonFileConfigProvider("someWhere")), str)
|
||||
assert str(config) in str(JsonFileConfigProvider("someWhere"))
|
||||
assert "Mongo" not in str(JsonFileConfigProvider("someWhere"))
|
||||
|
||||
|
||||
def test_json_provider_get_mongo() -> None:
|
||||
@ -82,6 +89,14 @@ def test_json_provider_get_mongo() -> None:
|
||||
assert config.database == data["mongo"]["database"]
|
||||
assert config.port == data["mongo"]["port"]
|
||||
|
||||
assert isinstance(str(config), str)
|
||||
assert "Mongo" in str(config)
|
||||
assert "Postgre" not in str(config)
|
||||
|
||||
assert isinstance(str(JsonFileConfigProvider("someWhere")), str)
|
||||
assert str(config) in str(JsonFileConfigProvider("someWhere"))
|
||||
assert "Postgre" not in str(JsonFileConfigProvider("someWhere"))
|
||||
|
||||
|
||||
def test_env_provider_constructor() -> None:
|
||||
with patch("aki_prj23_transparenzregister.config.config_providers.os") as mock_os:
|
||||
|
26
tests/ui/protection_test.py
Normal file
26
tests/ui/protection_test.py
Normal file
@ -0,0 +1,26 @@
|
||||
"""Tests the addition of an authentication framework."""
|
||||
from _pytest.monkeypatch import MonkeyPatch
|
||||
from dash import Dash
|
||||
from pytest_mock import MockerFixture
|
||||
|
||||
from aki_prj23_transparenzregister.ui import protection
|
||||
|
||||
|
||||
def test_no_auth(monkeypatch: MonkeyPatch, mocker: MockerFixture) -> None:
|
||||
"""Tests if no authentication is added."""
|
||||
monkeypatch.setenv("PYTHON_DASH_LOGIN_USERNAME", "")
|
||||
monkeypatch.setenv("PYTHON_DASH_LOGIN_PW", "")
|
||||
|
||||
basic_auth_mocker = mocker.spy(protection.dash_auth, "BasicAuth")
|
||||
protection.add_auth(Dash())
|
||||
basic_auth_mocker.assert_not_called()
|
||||
|
||||
|
||||
def test_add_auth(monkeypatch: MonkeyPatch, mocker: MockerFixture) -> None:
|
||||
"""Tests if an authentication is added."""
|
||||
monkeypatch.setenv("PYTHON_DASH_LOGIN_USERNAME", "some-login")
|
||||
monkeypatch.setenv("PYTHON_DASH_LOGIN_PW", "some-pw")
|
||||
|
||||
basic_auth_mocker = mocker.spy(protection.dash_auth, "BasicAuth")
|
||||
protection.add_auth(Dash())
|
||||
basic_auth_mocker.assert_called_once()
|
Reference in New Issue
Block a user