46 lines
1.1 KiB
Python
46 lines
1.1 KiB
Python
import json
|
|
from pathlib import Path
|
|
|
|
import config
|
|
import pendulum
|
|
import pytest
|
|
from connectors 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:
|
|
booking_failure_file = RESPONSES_FOLDER / "booking_failure.json"
|
|
return json.loads(booking_failure_file.read_text(encoding="utf-8"))
|