All methods are in the right class
This commit is contained in:
parent
0d541e82a5
commit
7f59443b64
12 changed files with 585 additions and 1729 deletions
|
@ -16,9 +16,9 @@ def test_urls(connector, club):
|
|||
assert connector.login_url == f"{base_url}/login.html"
|
||||
assert connector.booking_url == f"{base_url}/booking.html"
|
||||
assert connector.user_bookings_url == f"{base_url}/user_bookings.html"
|
||||
assert connector.booking_cancellation_url == f"{base_url}/cancel.html"
|
||||
assert connector.tournaments_sessions_url == f"{base_url}/tournaments_sessions.php"
|
||||
assert connector.tournaments_list_url == f"{base_url}/tournaments_list.html?event="
|
||||
assert connector.cancel_url == f"{base_url}/cancel.html"
|
||||
assert connector.sessions_url == f"{base_url}/tournaments_sessions.php"
|
||||
assert connector.tournaments_url == f"{base_url}/tournaments_list.html?event="
|
||||
|
||||
|
||||
@patch("config.get_resources_folder")
|
||||
|
@ -41,11 +41,11 @@ def test_urls_payload_templates(mock_resources, club):
|
|||
== path_to_resources / "gestion-sports/user-bookings-payload.txt"
|
||||
)
|
||||
assert (
|
||||
connector.booking_cancel_template
|
||||
connector.cancel_template
|
||||
== path_to_resources / "gestion-sports/booking-cancellation-payload.txt"
|
||||
)
|
||||
assert (
|
||||
connector.tournaments_sessions_template
|
||||
connector.sessions_template
|
||||
== path_to_resources / "gestion-sports/tournament-sessions-payload.txt"
|
||||
)
|
||||
|
||||
|
@ -90,29 +90,6 @@ async def test_login_failure(aioresponses, connector, user, login_failure_respon
|
|||
assert await response.json() == login_failure_response
|
||||
|
||||
|
||||
def test_get_booked_court(connector, booked_courts_response):
|
||||
booked_court = connector.get_booked_court(booked_courts_response, "Sport1")
|
||||
assert booked_court.number == 3
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_get_ongoing_bookings(
|
||||
aioresponses,
|
||||
connector,
|
||||
user,
|
||||
user_bookings_get_response,
|
||||
user_bookings_list,
|
||||
):
|
||||
responses.set_ongoing_bookings_response(
|
||||
aioresponses, connector, user_bookings_get_response, user_bookings_list
|
||||
)
|
||||
|
||||
async with ClientSession() as session:
|
||||
bookings = await connector.get_ongoing_bookings(session)
|
||||
|
||||
assert len(bookings) == 2
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_cancellation_request(
|
||||
aioresponses, connector, user_bookings_get_response, cancellation_response
|
||||
|
@ -121,31 +98,11 @@ async def test_cancellation_request(
|
|||
responses.set_cancellation_response(aioresponses, connector, cancellation_response)
|
||||
|
||||
async with ClientSession() as session:
|
||||
response = await connector.cancel_booking_id(session, 123)
|
||||
response = await connector.send_cancellation_request(session, 123, "hash")
|
||||
|
||||
assert await response.json() == cancellation_response
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_cancel_booking_success(
|
||||
aioresponses,
|
||||
connector,
|
||||
user,
|
||||
cancellation_success_booking_filter,
|
||||
cancellation_success_from_start,
|
||||
):
|
||||
responses.set_full_cancellation_responses(
|
||||
aioresponses, connector, cancellation_success_from_start
|
||||
)
|
||||
|
||||
async with ClientSession() as session:
|
||||
response = await connector.cancel_booking(
|
||||
session, cancellation_success_booking_filter
|
||||
)
|
||||
|
||||
assert await response.json() == cancellation_success_from_start[4]
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_tournament_sessions(
|
||||
aioresponses, connector, user, tournament_sessions_json
|
||||
|
@ -154,7 +111,7 @@ async def test_tournament_sessions(
|
|||
aioresponses, connector, tournament_sessions_json
|
||||
)
|
||||
async with ClientSession() as session:
|
||||
response = await connector.send_tournaments_sessions_request(session)
|
||||
response = await connector.send_session_request(session)
|
||||
|
||||
assert response.status == 200
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue