Philipp Horstenkamp 091e67de79
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
2023-09-24 16:32:52 +00:00

27 lines
991 B
Python

"""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()