From 3b159f63e89a5ea4dc70d923776680aa0022d56e Mon Sep 17 00:00:00 2001 From: Paul D'Ambra Date: Fri, 13 Dec 2024 12:05:34 +0100 Subject: [PATCH] fix: survey tests (#26892) --- posthog/api/survey.py | 2 +- posthog/api/test/test_survey.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/posthog/api/survey.py b/posthog/api/survey.py index df100f8717b32..835860bb00906 100644 --- a/posthog/api/survey.py +++ b/posthog/api/survey.py @@ -325,7 +325,7 @@ def validate(self, data): if response_sampling_start_date < today_utc: raise serializers.ValidationError( { - "response_sampling_start_date": "Response sampling start date must be today or a future date in UTC." + "response_sampling_start_date": f"Response sampling start date must be today or a future date in UTC. Got {response_sampling_start_date} when current time is {today_utc}" } ) diff --git a/posthog/api/test/test_survey.py b/posthog/api/test/test_survey.py index c874d88abcfbc..35b0bb1cdc553 100644 --- a/posthog/api/test/test_survey.py +++ b/posthog/api/test/test_survey.py @@ -2378,6 +2378,7 @@ def test_can_clear_associated_actions(self): assert len(survey.actions.all()) == 0 +@freeze_time("2024-12-12 00:00:00") class TestSurveyResponseSampling(APIBaseTest): def _create_survey_with_sampling_limits( self, @@ -2407,6 +2408,7 @@ def _create_survey_with_sampling_limits( ) response_data = response.json() + assert response.status_code == status.HTTP_201_CREATED, response_data survey = Survey.objects.get(id=response_data["id"]) return survey