73 lines
1.7 KiB
Python
73 lines
1.7 KiB
Python
import json
|
|
|
|
import pendulum
|
|
import pytest
|
|
from gestion_sports.payload_builders import GestionSportsBookingPayloadBuilder
|
|
|
|
from resa_padel.models import BookingFilter, Club, 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
|
|
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_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"
|
|
booking_payload = (
|
|
GestionSportsBookingPayloadBuilder()
|
|
.booking_filter(booking_filter)
|
|
.court_id(courts[0])
|
|
.build()
|
|
)
|
|
|
|
|
|
@pytest.fixture
|
|
def a_user() -> User:
|
|
return user
|
|
|
|
|
|
@pytest.fixture
|
|
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
|
|
|
|
|
|
@pytest.fixture
|
|
def a_booking_failure_response() -> str:
|
|
return booking_failure_response
|
|
|
|
|
|
@pytest.fixture
|
|
def a_booking_payload() -> str:
|
|
return booking_payload
|