From 9f14e413290c8b70b9c5967da81ce2fc288bbdb2 Mon Sep 17 00:00:00 2001 From: Marcos Prieto Date: Wed, 8 Jan 2025 14:43:19 +0100 Subject: [PATCH] Add missing test case for course dates Test invalid dates which produce a ValueError in the course service. --- tests/unit/lms/services/course_test.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/unit/lms/services/course_test.py b/tests/unit/lms/services/course_test.py index aec5afe527..5f62fc2b97 100644 --- a/tests/unit/lms/services/course_test.py +++ b/tests/unit/lms/services/course_test.py @@ -163,11 +163,19 @@ def test_get_from_launch_when_new_and_historical_course_exists( @pytest.mark.parametrize( "custom_course_starts, course_starts_at", - [(None, None), ("2022-01-01T00:00:00Z", datetime(2022, 1, 1, tzinfo=UTC))], + [ + (None, None), + ("NOT A DATE", None), + ("2022-01-01T00:00:00Z", datetime(2022, 1, 1, tzinfo=UTC)), + ], ) @pytest.mark.parametrize( "custom_course_ends, course_ends_at", - [(None, None), ("2022-01-01T00:00:00Z", datetime(2022, 1, 1, tzinfo=UTC))], + [ + (None, None), + ("NOT A DATE", None), + ("2022-01-01T00:00:00Z", datetime(2022, 1, 1, tzinfo=UTC)), + ], ) @pytest.mark.parametrize( "custom_canvas_api_id",