51 lines
996 B
Python
51 lines
996 B
Python
import os
|
|
from unittest.mock import patch
|
|
|
|
import config
|
|
from pendulum import DateTime, Timezone
|
|
|
|
|
|
@patch.dict(
|
|
os.environ,
|
|
{
|
|
"SPORT_NAME": "Padel",
|
|
"DATE_TIME": "2024-02-03T22:38:45Z",
|
|
},
|
|
clear=True,
|
|
)
|
|
def test_get_booking_filter():
|
|
booking_filter = config.get_booking_filter()
|
|
assert booking_filter.sport_name == "padel"
|
|
assert booking_filter.date == DateTime(
|
|
year=2024,
|
|
month=2,
|
|
day=3,
|
|
hour=23,
|
|
minute=38,
|
|
second=45,
|
|
tzinfo=Timezone("Europe/Paris"),
|
|
)
|
|
|
|
|
|
@patch.dict(
|
|
os.environ,
|
|
{
|
|
"LOGIN": "login@user.tld",
|
|
"PASSWORD": "gloups",
|
|
},
|
|
clear=True,
|
|
)
|
|
def test_get_available_user():
|
|
user = config.get_user()
|
|
assert user.login == "login@user.tld"
|
|
assert user.password == "gloups"
|
|
|
|
|
|
def test_read_clubs():
|
|
clubs = config.get_clubs()
|
|
assert len(clubs) == 2
|
|
|
|
|
|
def test_get_users():
|
|
users = config.get_users("tpc")
|
|
assert len(users) == 2
|