Big refactoring.

- clubs, booking platforms and user are now defined in customization files -> there are less environment variables
- the responsibility of the session moved
- booking cancellation is available
This commit is contained in:
Stanislas Jouffroy 2024-03-17 23:57:50 +01:00 committed by stanislas
parent dbda5a158e
commit 0938fb98b7
27 changed files with 3050 additions and 696 deletions

View file

@ -3,19 +3,16 @@ from pathlib import Path
import pendulum
import pytest
from gestion_sports.payload_builders import GestionSportsBookingPayloadBuilder
from resa_padel.models import BookingFilter, Club, User
from resa_padel.models import BookingFilter, User
user = User(login="padel.testing@jouf.fr", password="ridicule", club_id="123")
url = "https://tpc.padel.com"
club = Club(id="123", url=url, courts_ids=[606, 607, 608])
courts = [606, 607, 608]
sport_id = 217
sport_name = "padel"
tz_info = "Europe/Paris"
booking_date = pendulum.now().add(days=6).set(hour=18, minute=0, second=0, tz=tz_info)
booking_filter = BookingFilter(sport_id=sport_id, date=booking_date)
booking_filter = BookingFilter(sport_name=sport_name, date=booking_date)
booking_failure_response = json.dumps(
{
@ -36,12 +33,6 @@ booking_success_response = json.dumps(
date_format = "%d/%m/%Y"
time_format = "%H:%M"
booking_payload = (
GestionSportsBookingPayloadBuilder()
.booking_filter(booking_filter)
.court_id(courts[0])
.build()
)
html_file = Path(__file__).parent / "data" / "mes_resas.html"
_mes_resas_html = html_file.read_text(encoding="utf-8")
@ -57,11 +48,6 @@ def a_booking_filter() -> BookingFilter:
return booking_filter
@pytest.fixture
def a_club() -> Club:
return club
@pytest.fixture
def a_booking_success_response() -> str:
return booking_success_response
@ -72,11 +58,6 @@ def a_booking_failure_response() -> str:
return booking_failure_response
@pytest.fixture
def a_booking_payload() -> str:
return booking_payload
@pytest.fixture
def mes_resas_html() -> str:
return _mes_resas_html