Added a service that can get all current tournaments list
This commit is contained in:
parent
e6023e0687
commit
3d0bd47079
26 changed files with 4305 additions and 204 deletions
|
@ -3,7 +3,7 @@ from pathlib import Path
|
|||
|
||||
import pendulum
|
||||
import pytest
|
||||
from connectors import GestionSportsConnector
|
||||
from gestion_sport_connector import GestionSportsConnector
|
||||
from gestion_sports_services import GestionSportsServices
|
||||
from models import (
|
||||
BookingFilter,
|
||||
|
@ -43,7 +43,7 @@ def court14() -> Court:
|
|||
|
||||
|
||||
@pytest.fixture
|
||||
def sport1(court11, court12, court13, court14) -> Sport:
|
||||
def sport1(court11: Court, court12: Court, court13: Court, court14: Court) -> Sport:
|
||||
return Sport(
|
||||
name="Sport1",
|
||||
id=8,
|
||||
|
@ -75,7 +75,7 @@ def court24() -> Court:
|
|||
|
||||
|
||||
@pytest.fixture
|
||||
def sport2(court21, court22, court23, court24) -> Sport:
|
||||
def sport2(court21: Court, court22: Court, court23: Court, court24: Court) -> Sport:
|
||||
return Sport(
|
||||
name="Sport 2",
|
||||
id=10,
|
||||
|
@ -130,9 +130,26 @@ def cancellation_url() -> Url:
|
|||
)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def tournament_sessions_url() -> Url:
|
||||
return Url(
|
||||
name="tournament-sessions",
|
||||
path="/tournaments_sessions.php",
|
||||
payloadTemplate="gestion-sports/tournament-sessions-payload.txt",
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def tournaments_list_url() -> Url:
|
||||
return Url(
|
||||
name="tournaments-list",
|
||||
path="/tournaments_list.html?event=",
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def booking_opening() -> BookingOpening:
|
||||
return BookingOpening(daysBefore=10, time="03:27")
|
||||
return BookingOpening(daysBefore=7, time="00:00")
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
@ -142,15 +159,17 @@ def total_bookings() -> TotalBookings:
|
|||
|
||||
@pytest.fixture
|
||||
def booking_platform(
|
||||
booking_opening,
|
||||
total_bookings,
|
||||
sport1,
|
||||
sport2,
|
||||
landing_url,
|
||||
login_url,
|
||||
booking_url,
|
||||
user_bookings_url,
|
||||
cancellation_url,
|
||||
booking_opening: BookingOpening,
|
||||
total_bookings: TotalBookings,
|
||||
sport1: Sport,
|
||||
sport2: Sport,
|
||||
landing_url: str,
|
||||
login_url: str,
|
||||
booking_url: str,
|
||||
user_bookings_url: str,
|
||||
cancellation_url: str,
|
||||
tournament_sessions_url: str,
|
||||
tournaments_list_url: str,
|
||||
) -> BookingPlatform:
|
||||
return BookingPlatform(
|
||||
id="gestion-sports",
|
||||
|
@ -166,12 +185,14 @@ def booking_platform(
|
|||
"booking": booking_url,
|
||||
"user-bookings": user_bookings_url,
|
||||
"cancellation": cancellation_url,
|
||||
"tournament-sessions": tournament_sessions_url,
|
||||
"tournaments-list": tournaments_list_url,
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def club(booking_platform) -> Club:
|
||||
def club(booking_platform: BookingPlatform) -> Club:
|
||||
return Club(
|
||||
id="super_club",
|
||||
name="Super Club",
|
||||
|
@ -204,42 +225,42 @@ def booking_filter() -> BookingFilter:
|
|||
|
||||
@pytest.fixture
|
||||
def landing_response() -> str:
|
||||
landing_response_file = RESPONSES_FOLDER / "landing_response.html"
|
||||
return landing_response_file.read_text(encoding="utf-8")
|
||||
file = RESPONSES_FOLDER / "landing-response.html"
|
||||
return file.read_text(encoding="utf-8")
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def login_success_response() -> dict:
|
||||
login_success_file = RESPONSES_FOLDER / "login_success.json"
|
||||
login_success_file = RESPONSES_FOLDER / "login-success.json"
|
||||
return json.loads(login_success_file.read_text(encoding="utf-8"))
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def login_failure_response() -> dict:
|
||||
login_failure_file = RESPONSES_FOLDER / "login_failure.json"
|
||||
return json.loads(login_failure_file.read_text(encoding="utf-8"))
|
||||
file = RESPONSES_FOLDER / "login-failure.json"
|
||||
return json.loads(file.read_text(encoding="utf-8"))
|
||||
|
||||
|
||||
@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"))
|
||||
file = RESPONSES_FOLDER / "booking-success.json"
|
||||
return json.loads(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"))
|
||||
file = RESPONSES_FOLDER / "booking-failure.json"
|
||||
return json.loads(file.read_text(encoding="utf-8"))
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def booked_courts_response(
|
||||
court11,
|
||||
court12,
|
||||
court13,
|
||||
court14,
|
||||
booking_success_response,
|
||||
booking_failure_response,
|
||||
court11: int,
|
||||
court12: int,
|
||||
court13: int,
|
||||
court14: int,
|
||||
booking_success_response: dict,
|
||||
booking_failure_response: dict,
|
||||
) -> list[tuple[int, dict]]:
|
||||
court1_resp = court11.id, booking_failure_response
|
||||
court2_resp = court12.id, booking_failure_response
|
||||
|
@ -250,10 +271,10 @@ def booked_courts_response(
|
|||
|
||||
@pytest.fixture
|
||||
def booking_success_from_start(
|
||||
landing_response,
|
||||
login_success_response,
|
||||
booking_success_response,
|
||||
booking_failure_response,
|
||||
landing_response: str,
|
||||
login_success_response: str,
|
||||
booking_success_response: str,
|
||||
booking_failure_response: str,
|
||||
):
|
||||
return [
|
||||
landing_response,
|
||||
|
@ -267,10 +288,10 @@ def booking_success_from_start(
|
|||
|
||||
@pytest.fixture
|
||||
def booking_failure_from_start(
|
||||
landing_response,
|
||||
login_success_response,
|
||||
booking_success_response,
|
||||
booking_failure_response,
|
||||
landing_response: str,
|
||||
login_success_response: str,
|
||||
booking_success_response: str,
|
||||
booking_failure_response: str,
|
||||
):
|
||||
return [
|
||||
landing_response,
|
||||
|
@ -284,22 +305,22 @@ def booking_failure_from_start(
|
|||
|
||||
@pytest.fixture
|
||||
def user_bookings_get_response() -> str:
|
||||
user_bookings_file = RESPONSES_FOLDER / "user_bookings_get.html"
|
||||
return user_bookings_file.read_text(encoding="utf-8")
|
||||
file = RESPONSES_FOLDER / "user-bookings-get.html"
|
||||
return file.read_text(encoding="utf-8")
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def user_bookings_list() -> list:
|
||||
user_bookings_file = RESPONSES_FOLDER / "user_bookings_post.json"
|
||||
return json.loads(user_bookings_file.read_text(encoding="utf-8"))
|
||||
def user_bookings_list() -> str:
|
||||
file = RESPONSES_FOLDER / "user-bookings-post.json"
|
||||
return json.loads(file.read_text(encoding="utf-8"))
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def user_has_ongoing_bookings_from_start(
|
||||
landing_response,
|
||||
login_success_response,
|
||||
user_bookings_get_response,
|
||||
user_bookings_list,
|
||||
landing_response: str,
|
||||
login_success_response: str,
|
||||
user_bookings_get_response: str,
|
||||
user_bookings_list: str,
|
||||
) -> list:
|
||||
return [
|
||||
landing_response,
|
||||
|
@ -316,10 +337,10 @@ def user_bookings_empty_list() -> list:
|
|||
|
||||
@pytest.fixture
|
||||
def user_has_no_ongoing_bookings_from_start(
|
||||
landing_response,
|
||||
login_success_response,
|
||||
user_bookings_get_response,
|
||||
user_bookings_empty_list,
|
||||
landing_response: str,
|
||||
login_success_response: str,
|
||||
user_bookings_get_response: str,
|
||||
user_bookings_empty_list: str,
|
||||
) -> list:
|
||||
return [
|
||||
landing_response,
|
||||
|
@ -331,16 +352,16 @@ def user_has_no_ongoing_bookings_from_start(
|
|||
|
||||
@pytest.fixture
|
||||
def cancellation_response() -> list:
|
||||
cancellation_response_file = RESPONSES_FOLDER / "cancellation_response.json"
|
||||
return json.loads(cancellation_response_file.read_text(encoding="utf-8"))
|
||||
file = RESPONSES_FOLDER / "cancellation-response.json"
|
||||
return json.loads(file.read_text(encoding="utf-8"))
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def cancellation_by_id_from_start(
|
||||
landing_response,
|
||||
login_success_response,
|
||||
user_bookings_get_response,
|
||||
cancellation_response,
|
||||
landing_response: str,
|
||||
login_success_response: str,
|
||||
user_bookings_get_response: str,
|
||||
cancellation_response: str,
|
||||
):
|
||||
return [
|
||||
landing_response,
|
||||
|
@ -352,11 +373,11 @@ def cancellation_by_id_from_start(
|
|||
|
||||
@pytest.fixture
|
||||
def cancellation_success_from_start(
|
||||
landing_response,
|
||||
login_success_response,
|
||||
user_bookings_get_response,
|
||||
user_bookings_list,
|
||||
cancellation_response,
|
||||
landing_response: str,
|
||||
login_success_response: str,
|
||||
user_bookings_get_response: str,
|
||||
user_bookings_list: str,
|
||||
cancellation_response: str,
|
||||
):
|
||||
return [
|
||||
landing_response,
|
||||
|
@ -377,3 +398,30 @@ def cancellation_success_booking_filter() -> BookingFilter:
|
|||
@pytest.fixture
|
||||
def service() -> GestionSportsServices:
|
||||
return GestionSportsServices()
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def tournament_sessions_json() -> str:
|
||||
file = RESPONSES_FOLDER / "tournament-sessions.json"
|
||||
return file.read_text(encoding="utf-8")
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def tournaments_html() -> str:
|
||||
file = RESPONSES_FOLDER / "tournaments.html"
|
||||
return file.read_text(encoding="utf-8")
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def full_tournaments_responses(
|
||||
landing_response: str,
|
||||
login_success_response: str,
|
||||
tournament_sessions_json: str,
|
||||
tournaments_html: str,
|
||||
) -> list[str]:
|
||||
return [
|
||||
landing_response,
|
||||
login_success_response,
|
||||
tournament_sessions_json,
|
||||
tournaments_html,
|
||||
]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue