Files
Tirsvad 2fa9e15ab5 Add Chrome profile, navigation and automated login (steps 1 and 2)
Chrome options with detach and the chrome_profile folder, Selenium adapter
with explicit waits, login use case, credentials from environment
variables, command line, unit tests, container tests against local
fixtures and the step-1 screenshot.

Task: MIL-003#1
Task: MIL-003#2
Task: MIL-003#3
Task: MIL-003#4
2026-10-28 17:41:55 +08:00

28 lines
786 B
Python

"""@file test_session.py
@brief The login use case hands the credentials to the gym site.
"""
import pytest
from tests.unit.fakes import FakeGym
from snack_and_lift.application.credentials import Credentials
from snack_and_lift.application.session import login
from snack_and_lift.domain.errors import LoginFailedError
CREDENTIALS = Credentials("dummy@example.invalid", "dummy-password")
def test_login_passes_the_credentials_to_the_gym() -> None:
gym = FakeGym()
login(gym, CREDENTIALS)
assert gym.logins == [("dummy@example.invalid", "dummy-password")]
def test_login_propagates_a_refused_login() -> None:
gym = FakeGym(login_error="Invalid credentials")
with pytest.raises(LoginFailedError, match="Invalid credentials"):
login(gym, CREDENTIALS)