From 75784000d9d5abce1e5146e43e8cad6141d2e79a Mon Sep 17 00:00:00 2001 From: Roman Sokolov Date: Sat, 14 Dec 2024 15:16:54 +0200 Subject: [PATCH] Solution --- cinema/models.py | 2 +- cinema/tests/test_movie_session_api.py | 3 +-- cinema/tests/test_order_api.py | 1 - cinema_service/settings.py | 2 +- 4 files changed, 3 insertions(+), 5 deletions(-) diff --git a/cinema/models.py b/cinema/models.py index 229e8be5..4bfc393c 100644 --- a/cinema/models.py +++ b/cinema/models.py @@ -112,7 +112,7 @@ def clean(self): row=self.row, seat=self.seat, movie_session=self.movie_session, - error_to_raise=ValueError + error_to_raise=ValidationError ) def save( diff --git a/cinema/tests/test_movie_session_api.py b/cinema/tests/test_movie_session_api.py index cd1b509b..1bd25f3b 100644 --- a/cinema/tests/test_movie_session_api.py +++ b/cinema/tests/test_movie_session_api.py @@ -83,8 +83,7 @@ def test_get_movie_sessions_filtered_by_movie(self): def test_get_movie_sessions_filtered_by_movie_and_data(self): movie_sessions = self.client.get( - f"/api/cinema/movie_sessions/?movie=" - f"{self.movie.id}&date=2022-09-2" + f"/api/cinema/movie_sessions/?movie="{self.movie.id}&date=2022-09-2" ) self.assertEqual(movie_sessions.status_code, status.HTTP_200_OK) self.assertEqual(len(movie_sessions.data), 1) diff --git a/cinema/tests/test_order_api.py b/cinema/tests/test_order_api.py index 6d71e0df..dd15df53 100644 --- a/cinema/tests/test_order_api.py +++ b/cinema/tests/test_order_api.py @@ -82,7 +82,6 @@ def test_movie_session_detail_tickets(self): def test_movie_session_list_tickets_available(self): response = self.client.get(f"/api/cinema/movie_sessions/") - print(response.data) self.assertEqual(response.status_code, status.HTTP_200_OK) self.assertEqual( response.data[0]["tickets_available"], diff --git a/cinema_service/settings.py b/cinema_service/settings.py index ef21943b..e70e2ef9 100644 --- a/cinema_service/settings.py +++ b/cinema_service/settings.py @@ -25,7 +25,7 @@ SECRET_KEY = os.getenv("SECRET_KEY", "your_sekreat_key") # SECURITY WARNING: don't run with debug turned on in production! -DEBUG = os.getenv("DEBUG", "True") == "True" +DEBUG = os.getenv("DEBUG", "False") == "True" ALLOWED_HOSTS = os.getenv("ALLOWED_HOSTS", "localhost").split(",")