mirror of
https://github.com/fhswf/aki_prj23_transparenzregister.git
synced 2025-04-22 05:02:53 +02:00
- 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
27 lines
991 B
Python
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()
|