Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
amandine-sahl committed Jun 29, 2023
1 parent 18ecba7 commit 2b4cd72
Showing 1 changed file with 27 additions and 2 deletions.
29 changes: 27 additions & 2 deletions backend/test/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

from core.models import GTEvents, TReservations
from core.models import TTokens
from core.routes import EventIsFull

from .fixtures import (
events,
Expand All @@ -31,8 +32,8 @@
"nb_6_8_ans": 1,
"nb_9_12_ans": 2,
"nb_plus_12_ans": 2,
"liste_attente": True,
"num_departement": "48",
"confirmed" : True
}
TEST_BILAN = {
"commentaire": "test bilan",
Expand Down Expand Up @@ -118,10 +119,34 @@ def test_get_one_event(self, events):
== 200
)

def test_post_reservation_isfull(self, events):
login(self.client)
# POST
event = GTEvents.query.filter_by(name="Pytest").order_by(GTEvents.id.desc()).first()

data_resa = TEST_RESERVATION
data_resa["id_event"] = event.id
resp = post_json(
self.client, url_for("app_routes.post_reservations"), data_resa
)
assert resp == 200
# Placement en liste d'attente
resp = post_json(
self.client, url_for("app_routes.post_reservations"), data_resa
)
assert resp == 200
assert json_of_response(resp)["liste_attente"] == True

# Refus de l'inscription
resp = post_json(
self.client, url_for("app_routes.post_reservations"), data_resa
)
assert resp.status_code == 422

def test_post_export_and_cancel_one_reservation(self, events):
login(self.client)
# POST
event = GTEvents.query.filter_by(name="Pytest").first()
event = GTEvents.query.filter_by(name="Pytest").order_by(GTEvents.id.desc()).first()

data_resa = TEST_RESERVATION
data_resa["id_event"] = event.id
Expand Down

0 comments on commit 2b4cd72

Please sign in to comment.