Skip to content

Commit 6a5038b

Browse files
feanilclaude
andcommitted
fix: update hardcoded start date literals in tests to use DEFAULT_START_DATE
Tests were asserting against the literal `2030-01-01` value instead of importing the constant, causing failures after the default was updated to 2040. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 4a7fbb3 commit 6a5038b

3 files changed

Lines changed: 9 additions & 7 deletions

File tree

cms/djangoapps/contentstore/rest_api/v1/views/tests/test_proctoring.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
from cms.djangoapps.contentstore.tests.utils import CourseTestCase
1616
from openedx.core import toggles as core_toggles
1717
from openedx.core.djangoapps.course_apps.toggles import EXAMS_IDA
18+
from xmodule.course_metadata_utils import DEFAULT_START_DATE
1819
from xmodule.modulestore.django import (
1920
modulestore,
2021
) # lint-amnesty, pylint: disable=wrong-import-order
@@ -61,7 +62,7 @@ def get_expected_response_data(
6162
"proctoring_escalation_email": course.proctoring_escalation_email,
6263
"create_zendesk_tickets": course.create_zendesk_tickets,
6364
},
64-
"course_start_date": "2030-01-01T00:00:00Z",
65+
"course_start_date": DEFAULT_START_DATE.strftime('%Y-%m-%dT%H:%M:%SZ'),
6566
"available_proctoring_providers": ["null"],
6667
"requires_escalation_email_providers": [],
6768
}
@@ -100,7 +101,7 @@ def test_providers_with_disabled_lti(self):
100101
"proctoring_escalation_email": self.course.proctoring_escalation_email,
101102
"create_zendesk_tickets": self.course.create_zendesk_tickets,
102103
},
103-
"course_start_date": "2030-01-01T00:00:00Z",
104+
"course_start_date": DEFAULT_START_DATE.strftime('%Y-%m-%dT%H:%M:%SZ'),
104105
"available_proctoring_providers": ["null"],
105106
"requires_escalation_email_providers": [],
106107
}
@@ -123,7 +124,7 @@ def test_providers_with_enabled_lti(self):
123124
"proctoring_escalation_email": self.course.proctoring_escalation_email,
124125
"create_zendesk_tickets": self.course.create_zendesk_tickets,
125126
},
126-
"course_start_date": "2030-01-01T00:00:00Z",
127+
"course_start_date": DEFAULT_START_DATE.strftime('%Y-%m-%dT%H:%M:%SZ'),
127128
"available_proctoring_providers": ["lti_external", "null"],
128129
"requires_escalation_email_providers": ["lti_external"],
129130
}

cms/djangoapps/contentstore/signals/tests/test_handlers.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from xmodule.modulestore.edit_info import EditInfoMixin
1313
from xmodule.modulestore.django import SignalHandler
1414
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
15+
from xmodule.course_metadata_utils import DEFAULT_START_DATE
1516
from xmodule.modulestore.tests.factories import SampleCourseFactory
1617

1718

@@ -34,7 +35,7 @@ def setUp(self):
3435
course_key=CourseLocator(org='TestU', course='sig101', run='Summer2022', branch=None, version_guid=None),
3536
name='Signals 101',
3637
schedule_data=CourseScheduleData(
37-
start=datetime.fromisoformat('2030-01-01T00:00+00:00'),
38+
start=DEFAULT_START_DATE,
3839
pacing='instructor',
3940
end=None,
4041
enrollment_start=None,

cms/djangoapps/contentstore/views/tests/test_block.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -606,11 +606,11 @@ def test_create_block_negative(self):
606606
self.assertEqual(resp.status_code, 200)
607607

608608
def test_create_with_future_date(self):
609-
self.assertEqual(self.course.start, datetime(2030, 1, 1, tzinfo=UTC))
609+
self.assertEqual(self.course.start, DEFAULT_START_DATE)
610610
resp = self.create_xblock(category="chapter")
611611
usage_key = self.response_usage_key(resp)
612612
obj = self.get_item_from_modulestore(usage_key)
613-
self.assertEqual(obj.start, datetime(2030, 1, 1, tzinfo=UTC))
613+
self.assertEqual(obj.start, DEFAULT_START_DATE)
614614

615615
def test_static_tabs_initialization(self):
616616
"""
@@ -3408,7 +3408,7 @@ def validate_chapter_xblock_info(self, xblock_info, has_child_info=True):
34083408
xblock_info["course_graders"],
34093409
["Homework", "Lab", "Midterm Exam", "Final Exam"],
34103410
)
3411-
self.assertEqual(xblock_info["start"], "2030-01-01T00:00:00Z")
3411+
self.assertEqual(xblock_info["start"], DEFAULT_START_DATE.strftime('%Y-%m-%dT%H:%M:%SZ'))
34123412
self.assertEqual(xblock_info["graded"], False)
34133413
self.assertEqual(xblock_info["due"], None)
34143414
self.assertEqual(xblock_info["format"], None)

0 commit comments

Comments
 (0)