@@ -234,7 +234,7 @@ def _container_of_uninstalled_type(lp: LearningPackage, child_entity1: TestEntit
234234 """
235235 # First create a TestContainer, then we'll modify it to simulate it being from an uninstalled plugin
236236 container , _ = containers_api .create_container_and_version (
237- lp .pk ,
237+ lp .id ,
238238 key = "abandoned-container" ,
239239 title = "Abandoned Container 1" ,
240240 entities = [child_entity1 ],
@@ -301,7 +301,7 @@ def test_create_generic_empty_container(lp: LearningPackage, admin_user) -> None
301301 Creating an empty TestContainer. It will have only a draft version.
302302 """
303303 container , container_v1 = containers_api .create_container_and_version (
304- lp .pk ,
304+ lp .id ,
305305 key = "new-container-1" ,
306306 title = "Test Container 1" ,
307307 container_cls = TestContainer ,
@@ -356,10 +356,10 @@ def test_create_container_queries(lp: LearningPackage, child_entity1: TestEntity
356356 }
357357 # The exact numbers here aren't too important - this is just to alert us if anything significant changes.
358358 with django_assert_num_queries (31 ):
359- containers_api .create_container_and_version (lp .pk , key = "c1" , ** base_args )
359+ containers_api .create_container_and_version (lp .id , key = "c1" , ** base_args )
360360 # And try with a a container that has children:
361361 with django_assert_num_queries (32 ):
362- containers_api .create_container_and_version (lp .pk , key = "c2" , ** base_args , entities = [child_entity1 ])
362+ containers_api .create_container_and_version (lp .id , key = "c2" , ** base_args , entities = [child_entity1 ])
363363
364364
365365# versioning helpers
@@ -761,7 +761,7 @@ def test_get_container_by_key(lp: LearningPackage, parent_of_two: TestContainer)
761761 """
762762 Test getting a specific container by key
763763 """
764- result = containers_api .get_container_by_key (lp .pk , parent_of_two .key )
764+ result = containers_api .get_container_by_key (lp .id , parent_of_two .key )
765765 assert result == parent_of_two .container
766766 # The API always returns "Container", not specific subclasses like TestContainer:
767767 assert result .__class__ is Container
@@ -1015,7 +1015,7 @@ def test_add_entity_after_publish(lp: LearningPackage, parent_of_two: TestContai
10151015 assert parent_of_two_v1 .version_num == 1
10161016 assert parent_of_two .versioning .published is None
10171017 # Publish everything in the learning package:
1018- publishing_api .publish_all_drafts (lp .pk )
1018+ publishing_api .publish_all_drafts (lp .id )
10191019 parent_of_two .refresh_from_db () # Reloading is necessary
10201020 assert not parent_of_two .versioning .has_unpublished_changes # Shallow check
10211021 assert not containers_api .contains_unpublished_changes (parent_of_two ) # Deeper check
@@ -1151,7 +1151,7 @@ def test_publishing_shared_component(lp: LearningPackage):
11511151 c4_v1 = c4 .versioning .draft
11521152 c5_v1 = c5 .versioning .draft
11531153 unit1 , _ = containers_api .create_container_and_version (
1154- lp .pk ,
1154+ lp .id ,
11551155 entities = [c1 , c2 , c3 ],
11561156 title = "Unit 1" ,
11571157 key = "unit:1" ,
@@ -1160,15 +1160,15 @@ def test_publishing_shared_component(lp: LearningPackage):
11601160 container_cls = TestContainer ,
11611161 )
11621162 unit2 , _ = containers_api .create_container_and_version (
1163- lp .pk ,
1163+ lp .id ,
11641164 entities = [c2 , c4 , c5 ],
11651165 title = "Unit 2" ,
11661166 key = "unit:2" ,
11671167 created = now ,
11681168 created_by = None ,
11691169 container_cls = TestContainer ,
11701170 )
1171- publishing_api .publish_all_drafts (lp .pk )
1171+ publishing_api .publish_all_drafts (lp .id )
11721172 assert containers_api .contains_unpublished_changes (unit1 .id ) is False
11731173 assert containers_api .contains_unpublished_changes (unit2 .id ) is False
11741174
@@ -1541,7 +1541,7 @@ def test_get_container_children_count(
15411541 grandparent : ContainerContainer ,
15421542):
15431543 """Test `get_container_children_count()`"""
1544- publishing_api .publish_all_drafts (lp .pk )
1544+ publishing_api .publish_all_drafts (lp .id )
15451545 assert containers_api .get_container_children_count (parent_of_two , published = False ) == 2
15461546 assert containers_api .get_container_children_count (parent_of_two , published = True ) == 2
15471547
@@ -1574,7 +1574,7 @@ def test_get_container_children_count_soft_deletion(
15741574 child_entity2 : TestEntity ,
15751575):
15761576 """Test `get_container_children_count()` when an entity is soft deleted"""
1577- publishing_api .publish_all_drafts (lp .pk )
1577+ publishing_api .publish_all_drafts (lp .id )
15781578 publishing_api .soft_delete_draft (child_entity2 .pk )
15791579 # "parent_of_two" contains the soft deleted child, so its draft child count is decreased by one:
15801580 assert containers_api .get_container_children_count (parent_of_two , published = False ) == 1
@@ -1592,7 +1592,7 @@ def test_get_container_children_count_queries(
15921592 django_assert_num_queries ,
15931593):
15941594 """Test how many database queries `get_container_children_count()` needs"""
1595- publishing_api .publish_all_drafts (lp .pk )
1595+ publishing_api .publish_all_drafts (lp .id )
15961596 # The 6 queries are:
15971597 # - Draft.objects.get()
15981598 # - PublishableEntityVersion.objects.get()
0 commit comments