From 393c277db5af9c336534ba28a4f9d084cdef6bf3 Mon Sep 17 00:00:00 2001 From: ezkat <50319957+ezkat@users.noreply.github.com> Date: Wed, 11 Oct 2023 08:44:44 +0300 Subject: [PATCH] Fix tests --- resources/tests/conftest.py | 2 ++ resources/tests/test_reservation_api.py | 12 ++++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/resources/tests/conftest.py b/resources/tests/conftest.py index 28f2e82a9..14782a96e 100644 --- a/resources/tests/conftest.py +++ b/resources/tests/conftest.py @@ -265,8 +265,10 @@ def strong_resource(resource_with_opening_hours): @pytest.fixture def resource_with_reservation_reminders( resource_with_opening_hours, + metadataset_1, test_unit_with_reminders_enabled): resource_with_opening_hours.unit = test_unit_with_reminders_enabled + resource_with_opening_hours.reservation_metadata_set = metadataset_1 resource_with_opening_hours.save() return resource_with_opening_hours diff --git a/resources/tests/test_reservation_api.py b/resources/tests/test_reservation_api.py index 330b5d5b4..7b0261834 100644 --- a/resources/tests/test_reservation_api.py +++ b/resources/tests/test_reservation_api.py @@ -3277,11 +3277,15 @@ def test_reservation_not_allowed_during_maintenance_mode( @pytest.mark.django_db def test_reservation_reminder_create( - api_client, user, list_url, reservation_data_extra, + api_client, user, list_url, reservation_data, resource_with_reservation_reminders): api_client.force_authenticate(user=user) - reservation_data_extra['resource'] = resource_with_reservation_reminders.pk - reservation_data_extra['reserver_phone_number'] = '+358404040404' - response = api_client.post(list_url, data=reservation_data_extra, HTTP_ACCEPT_LANGUAGE='en') + reservation_data['resource'] = resource_with_reservation_reminders.pk + reservation_data['begin'] = '2115-04-04T09:00:00+02:00' + reservation_data['end'] = '2115-04-04T10:00:00+02:00' + reservation_data['reserver_name'] = 'Nordea Demo' + reservation_data['reserver_email_address'] = 'jey@example.com' + reservation_data['reserver_phone_number'] = '+358404040404' + response = api_client.post(list_url, data=reservation_data, HTTP_ACCEPT_LANGUAGE='en') assert response.status_code == 201 assert ReservationReminder.objects.count() == 1 \ No newline at end of file