created a gestion sports services class that handles the connection while the connector is dedicated to the requests
This commit is contained in:
parent
bcd8dc0733
commit
e6023e0687
12 changed files with 513 additions and 593 deletions
|
@ -2,10 +2,6 @@ import asyncio
|
|||
import os
|
||||
from unittest.mock import patch
|
||||
|
||||
import config
|
||||
import pendulum
|
||||
from models import BookingFilter, User
|
||||
|
||||
from resa_padel import booking
|
||||
|
||||
|
||||
|
@ -14,12 +10,7 @@ from resa_padel import booking
|
|||
{"CLUB_ID": "tpc"},
|
||||
clear=True,
|
||||
)
|
||||
def test_booking():
|
||||
club = config.get_club()
|
||||
user = User(login="padel.testing@jouf.fr", password="ridicule")
|
||||
booking_filter = BookingFilter(
|
||||
sport_name="Padel", date=pendulum.parse("2024-03-21T13:30:00+01:00")
|
||||
)
|
||||
def test_booking(club, user, booking_filter):
|
||||
booked_court, user_that_booked = asyncio.run(
|
||||
booking.book_court(club, [user], booking_filter)
|
||||
)
|
||||
|
@ -32,10 +23,8 @@ def test_booking():
|
|||
{"CLUB_ID": "tpc"},
|
||||
clear=True,
|
||||
)
|
||||
def test_cancellation():
|
||||
club = config.get_club()
|
||||
user = User(login="padel.testing@jouf.fr", password="ridicule")
|
||||
asyncio.run(booking.cancel_booking_id(club, user, 3605033))
|
||||
def test_cancellation(club, user, booking_filter):
|
||||
asyncio.run(booking.cancel_booking(club, user, booking_filter))
|
||||
|
||||
|
||||
@patch.dict(
|
||||
|
@ -49,9 +38,9 @@ def test_cancellation():
|
|||
clear=True,
|
||||
)
|
||||
def test_main_booking():
|
||||
court, user = booking.main()
|
||||
court, player = booking.main()
|
||||
assert court is not None
|
||||
assert user.username == "padel.testing@jouf"
|
||||
assert player.login == "padel.testing@jouf.fr"
|
||||
|
||||
|
||||
@patch.dict(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue