Skip to content

Commit

Permalink
fixed tests with new statuses
Browse files Browse the repository at this point in the history
  • Loading branch information
bugman80 committed Jan 3, 2025
1 parent 0f9cefe commit bd740e4
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions hotels/tests/tests_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,21 +43,21 @@ def test_update_booking_status():
)

# Verifico che la prenotazione sia in stato pending
assert prenotazione.status == "pending"
assert prenotazione.status == "verifica"

client = APIClient()
client.credentials(HTTP_AUTHORIZATION="Bearer " + access_token)
# Approvo la prenotazione
url = reverse("booking-update-status", kwargs={"pk": prenotazione.pk})
data = {"status": "approved"}
data = {"status": "approvata"}
response = client.patch(url, data, format="json")

# Verifico lo status code 200
assert response.status_code == status.HTTP_200_OK

# Verifico che lo stato ora sia approved
prenotazione.refresh_from_db()
assert prenotazione.status == "approved"
assert prenotazione.status == "approvata"


@pytest.mark.django_db
Expand Down Expand Up @@ -217,22 +217,22 @@ def test_overbooking():

# Approvo la prima prenotazione con successo
url = reverse("booking-update-status", kwargs={"pk": prenotazione1.pk})
data = {"status": "approved"}
data = {"status": "approvata"}
response = client1.patch(url, data, format="json")

assert response.status_code == status.HTTP_200_OK

# Approvo la seconda prenotazione con successo
url = reverse("booking-update-status", kwargs={"pk": prenotazione2.pk})
data = {"status": "approved"}
data = {"status": "approvata"}
response = client2.patch(url, data, format="json")

assert response.status_code == status.HTTP_200_OK

# La terza approvazione fallisce perche' l'hotel non ha piu'
# camere disponibili per il periodo scelto
url = reverse("booking-update-status", kwargs={"pk": prenotazione3.pk})
data = {"status": "approved"}
data = {"status": "approvata"}
response = client3.patch(url, data, format="json")
assert response.status_code == status.HTTP_400_BAD_REQUEST
assert (
Expand Down

0 comments on commit bd740e4

Please sign in to comment.