- 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
63 lines
1.5 KiB
Python
63 lines
1.5 KiB
Python
import json
|
|
from pathlib import Path
|
|
|
|
import pendulum
|
|
import pytest
|
|
|
|
from resa_padel.models import BookingFilter, User
|
|
|
|
user = User(login="padel.testing@jouf.fr", password="ridicule", club_id="123")
|
|
|
|
courts = [606, 607, 608]
|
|
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_name=sport_name, date=booking_date)
|
|
|
|
booking_failure_response = json.dumps(
|
|
{
|
|
"status": "error",
|
|
"message": "Désolé mais vous avez 1 réservation en cours au Padel en heures pleines et le réglement"
|
|
" n'autorise qu'une réservation en heures pleines à la fois au Padel!",
|
|
}
|
|
)
|
|
|
|
booking_success_response = json.dumps(
|
|
{
|
|
"status": "ok",
|
|
"message": "Merci, votre réservation s'est bien effectuée, vous allez recevoir un email"
|
|
" avec le récapitulatif de votre réservation, pensez à le conserver.",
|
|
"id_resa": 3503741,
|
|
}
|
|
)
|
|
|
|
date_format = "%d/%m/%Y"
|
|
time_format = "%H:%M"
|
|
|
|
html_file = Path(__file__).parent / "data" / "mes_resas.html"
|
|
_mes_resas_html = html_file.read_text(encoding="utf-8")
|
|
|
|
|
|
@pytest.fixture
|
|
def a_user() -> User:
|
|
return user
|
|
|
|
|
|
@pytest.fixture
|
|
def a_booking_filter() -> BookingFilter:
|
|
return booking_filter
|
|
|
|
|
|
@pytest.fixture
|
|
def a_booking_success_response() -> str:
|
|
return booking_success_response
|
|
|
|
|
|
@pytest.fixture
|
|
def a_booking_failure_response() -> str:
|
|
return booking_failure_response
|
|
|
|
|
|
@pytest.fixture
|
|
def mes_resas_html() -> str:
|
|
return _mes_resas_html
|