52 lines
1.3 KiB
Python
52 lines
1.3 KiB
Python
import json
|
|
from pathlib import Path
|
|
|
|
import config
|
|
import pendulum
|
|
import pytest
|
|
from gestion_sport_connector import GestionSportsConnector
|
|
from models import BookingFilter, Club, User
|
|
|
|
TEST_FOLDER = Path(__file__).parent.parent
|
|
DATA_FOLDER = TEST_FOLDER / "data"
|
|
RESPONSES_FOLDER = DATA_FOLDER / "responses"
|
|
|
|
|
|
@pytest.fixture
|
|
def club() -> Club:
|
|
return config.get_clubs()["tpc"]
|
|
|
|
|
|
@pytest.fixture
|
|
def connector(club) -> GestionSportsConnector:
|
|
return GestionSportsConnector(club)
|
|
|
|
|
|
@pytest.fixture
|
|
def user() -> User:
|
|
return User(login="padel.testing@jouf.fr", password="ridicule")
|
|
|
|
|
|
@pytest.fixture
|
|
def booking_filter() -> BookingFilter:
|
|
return BookingFilter(
|
|
sport_name="Padel", date=pendulum.parse("2024-03-21T13:30:00+01:00")
|
|
)
|
|
|
|
|
|
@pytest.fixture
|
|
def booking_success_response() -> dict:
|
|
booking_success_file = RESPONSES_FOLDER / "booking-success.json"
|
|
return json.loads(booking_success_file.read_text(encoding="utf-8"))
|
|
|
|
|
|
@pytest.fixture
|
|
def booking_failure_response() -> dict:
|
|
file = RESPONSES_FOLDER / "booking-failure.json"
|
|
return json.loads(file.read_text(encoding="utf-8"))
|
|
|
|
|
|
@pytest.fixture
|
|
def tournament_sessions_json() -> str:
|
|
file = RESPONSES_FOLDER / "tournament-sessions.json"
|
|
return file.read_text(encoding="utf-8")
|