Skip to content

Commit 0d66a2f

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 a67adf5 commit 0d66a2f

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 modulestore # lint-amnesty, pylint: disable=wrong-import-order
1920
from xmodule.modulestore.tests.django_utils import ( # lint-amnesty, pylint: disable=wrong-import-order
2021
ModuleStoreTestCase,
@@ -59,7 +60,7 @@ def get_expected_response_data(
5960
"proctoring_escalation_email": course.proctoring_escalation_email,
6061
"create_zendesk_tickets": course.create_zendesk_tickets,
6162
},
62-
"course_start_date": "2030-01-01T00:00:00Z",
63+
"course_start_date": DEFAULT_START_DATE.strftime('%Y-%m-%dT%H:%M:%SZ'),
6364
"available_proctoring_providers": ["null"],
6465
"requires_escalation_email_providers": [],
6566
}
@@ -98,7 +99,7 @@ def test_providers_with_disabled_lti(self):
9899
"proctoring_escalation_email": self.course.proctoring_escalation_email,
99100
"create_zendesk_tickets": self.course.create_zendesk_tickets,
100101
},
101-
"course_start_date": "2030-01-01T00:00:00Z",
102+
"course_start_date": DEFAULT_START_DATE.strftime('%Y-%m-%dT%H:%M:%SZ'),
102103
"available_proctoring_providers": ["null"],
103104
"requires_escalation_email_providers": [],
104105
}
@@ -121,7 +122,7 @@ def test_providers_with_enabled_lti(self):
121122
"proctoring_escalation_email": self.course.proctoring_escalation_email,
122123
"create_zendesk_tickets": self.course.create_zendesk_tickets,
123124
},
124-
"course_start_date": "2030-01-01T00:00:00Z",
125+
"course_start_date": DEFAULT_START_DATE.strftime('%Y-%m-%dT%H:%M:%SZ'),
125126
"available_proctoring_providers": ["lti_external", "null"],
126127
"requires_escalation_email_providers": ["lti_external"],
127128
}

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.django import SignalHandler
1313
from xmodule.modulestore.edit_info import EditInfoMixin
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
@@ -593,11 +593,11 @@ def test_create_block_negative(self):
593593
self.assertEqual(resp.status_code, 200) # noqa: PT009
594594

595595
def test_create_with_future_date(self):
596-
self.assertEqual(self.course.start, datetime(2030, 1, 1, tzinfo=UTC)) # noqa: PT009
596+
self.assertEqual(self.course.start, DEFAULT_START_DATE) # noqa: PT009
597597
resp = self.create_xblock(category="chapter")
598598
usage_key = self.response_usage_key(resp)
599599
obj = self.get_item_from_modulestore(usage_key)
600-
self.assertEqual(obj.start, datetime(2030, 1, 1, tzinfo=UTC)) # noqa: PT009
600+
self.assertEqual(obj.start, DEFAULT_START_DATE) # noqa: PT009
601601

602602
def test_static_tabs_initialization(self):
603603
"""
@@ -3395,7 +3395,7 @@ def validate_chapter_xblock_info(self, xblock_info, has_child_info=True):
33953395
xblock_info["course_graders"],
33963396
["Homework", "Lab", "Midterm Exam", "Final Exam"],
33973397
)
3398-
self.assertEqual(xblock_info["start"], "2030-01-01T00:00:00Z") # noqa: PT009
3398+
self.assertEqual(xblock_info["start"], DEFAULT_START_DATE.strftime('%Y-%m-%dT%H:%M:%SZ')) # noqa: PT009
33993399
self.assertEqual(xblock_info["graded"], False) # noqa: PT009
34003400
self.assertEqual(xblock_info["due"], None) # noqa: PT009
34013401
self.assertEqual(xblock_info["format"], None) # noqa: PT009

0 commit comments

Comments
 (0)