Skip to content

Commit 877eae4

Browse files
feanilclaude
andcommitted
fix: use .id instead of .pk in modulestore_migrator tests
These openedx-learning models use TypedBigAutoField, which warns when .pk is accessed outside django.*. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 929b54f commit 877eae4

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

cms/djangoapps/modulestore_migrator/tests/test_tasks.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -724,7 +724,7 @@ def test_migrate_container_creates_new_container(self):
724724
created_by=self.user.id,
725725
)
726726
child_version_1 = content_api.create_next_component_version(
727-
child_component_1.pk,
727+
child_component_1.id,
728728
media_to_replace={},
729729
created=timezone.now(),
730730
created_by=self.user.id,
@@ -740,7 +740,7 @@ def test_migrate_container_creates_new_container(self):
740740
created_by=self.user.id,
741741
)
742742
child_version_2 = content_api.create_next_component_version(
743-
child_component_2.pk,
743+
child_component_2.id,
744744
media_to_replace={},
745745
created=timezone.now(),
746746
created_by=self.user.id,
@@ -805,7 +805,7 @@ def test_migrate_container_different_container_types(self):
805805
self.assertEqual(container_version.title, f"Test {block_type.title()}") # noqa: PT009
806806
# The container is left as a draft; publishing is the caller's
807807
# responsibility (handled in _import_structure after bulk_draft_changes_for exits).
808-
self.assertTrue(content_api.contains_unpublished_changes(container_version.container.pk)) # noqa: PT009 # pylint: disable=line-too-long
808+
self.assertTrue(content_api.contains_unpublished_changes(container_version.container.id)) # noqa: PT009 # pylint: disable=line-too-long
809809

810810
def test_migrate_container_same_title(self):
811811
"""
@@ -913,7 +913,7 @@ def test_migrate_container_preserves_child_order(self):
913913
created_by=self.user.id,
914914
)
915915
child_version = content_api.create_next_component_version(
916-
child_component.pk,
916+
child_component.id,
917917
media_to_replace={},
918918
created=timezone.now(),
919919
created_by=self.user.id,
@@ -953,7 +953,7 @@ def test_migrate_container_with_mixed_child_types(self):
953953
created_by=self.user.id,
954954
)
955955
problem_version = content_api.create_next_component_version(
956-
problem_component.pk,
956+
problem_component.id,
957957
media_to_replace={},
958958
created=timezone.now(),
959959
created_by=self.user.id,
@@ -969,7 +969,7 @@ def test_migrate_container_with_mixed_child_types(self):
969969
created_by=self.user.id,
970970
)
971971
html_version = content_api.create_next_component_version(
972-
html_component.pk,
972+
html_component.id,
973973
media_to_replace={},
974974
created=timezone.now(),
975975
created_by=self.user.id,
@@ -985,7 +985,7 @@ def test_migrate_container_with_mixed_child_types(self):
985985
created_by=self.user.id,
986986
)
987987
video_version = content_api.create_next_component_version(
988-
video_component.pk,
988+
video_component.id,
989989
media_to_replace={},
990990
created=timezone.now(),
991991
created_by=self.user.id,

0 commit comments

Comments
 (0)