created a gestion sports services class that handles the connection while the connector is dedicated to the requests

This commit is contained in:
Stanislas Jouffroy 2024-03-20 23:11:43 +01:00
parent bcd8dc0733
commit e6023e0687
12 changed files with 513 additions and 593 deletions

View file

@ -0,0 +1,46 @@
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"))