Skip to content

Commit 2a89736

Browse files
kdmccormickclaude
andcommitted
fix: rename remaining entity_key variables to entity_ref
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 29210ec commit 2a89736

4 files changed

Lines changed: 11 additions & 11 deletions

File tree

src/openedx_content/applets/backup_restore/toml.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ def toml_publishable_entity_version(version: PublishableEntityVersion) -> tomlki
214214
return version_table
215215

216216

217-
def toml_collection(collection: Collection, entity_keys: list[str]) -> str:
217+
def toml_collection(collection: Collection, entity_refs: list[str]) -> str:
218218
"""
219219
Create a TOML representation of a collection.
220220
@@ -232,7 +232,7 @@ def toml_collection(collection: Collection, entity_keys: list[str]) -> str:
232232
doc = tomlkit.document()
233233

234234
entities_array = tomlkit.array()
235-
entities_array.extend(entity_keys)
235+
entities_array.extend(entity_refs)
236236
entities_array.multiline(True)
237237

238238
collection_table = tomlkit.table()

src/openedx_content/applets/backup_restore/zipper.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -403,11 +403,11 @@ def create_zip(self, path: str) -> None:
403403
for collection in collections:
404404
collection_hash_slug = self.get_entity_toml_filename(collection.collection_code)
405405
collection_toml_file_path = collections_folder / f"{collection_hash_slug}.toml"
406-
entity_keys_related = collection.entities.order_by("entity_ref").values_list("entity_ref", flat=True)
406+
entity_refs_related = collection.entities.order_by("entity_ref").values_list("entity_ref", flat=True)
407407
self.add_file_to_zip(
408408
zipf,
409409
collection_toml_file_path,
410-
toml_collection(collection, list(entity_keys_related)),
410+
toml_collection(collection, list(entity_refs_related)),
411411
timestamp=collection.modified,
412412
)
413413

tests/openedx_content/applets/backup_restore/test_restore.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -193,12 +193,12 @@ def verify_collections(self, lp):
193193
assert collection.created_by is not None
194194
assert collection.created_by.username == "lp_user"
195195

196-
expected_entity_keys = [
196+
expected_entity_refs = [
197197
"xblock.v1:html:e32d5479-9492-41f6-9222-550a7346bc37",
198198
"xblock.v1:problem:256739e8-c2df-4ced-bd10-8156f6cfa90b",
199199
]
200-
entity_keys = [entity.entity_ref for entity in collection.entities.all()]
201-
assert set(entity_keys) == set(expected_entity_keys)
200+
entity_refs = [entity.entity_ref for entity in collection.entities.all()]
201+
assert set(entity_refs) == set(expected_entity_refs)
202202

203203

204204
class RestoreLearningPackageTest(RestoreTestCase):
@@ -470,7 +470,7 @@ def _serialize(self, extra=None, base=None):
470470
s.is_valid()
471471
return s
472472

473-
def test_legacy_entity_key_parsed(self):
473+
def test_legacy_entity_ref_parsed(self):
474474
"""Ulmo archives have no [entity.component] section; fall back to parsing the entity key."""
475475
s = self._serialize()
476476
assert s.is_valid(), s.errors
@@ -505,7 +505,7 @@ def test_component_section_overrides_key(self):
505505
assert s.validated_data["component_type"].name == "html"
506506
assert s.validated_data["component_code"] == "different_code"
507507

508-
def test_invalid_entity_key_format(self):
508+
def test_invalid_entity_ref_format(self):
509509
"""Entity key without enough colons raises a validation error."""
510510
s = self._serialize(base={
511511
"can_stand_alone": True,

tests/openedx_content/applets/components/test_api.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -342,8 +342,8 @@ def test_simple_get(self):
342342
with self.assertRaises(ObjectDoesNotExist):
343343
components_api.get_component(-1)
344344

345-
def test_publishing_entity_key_convention(self):
346-
"""Our mapping convention is {namespace}:{component_type}:{component_code}"""
345+
def test_publishing_entity_ref_convention(self):
346+
"""entity_ref convention: {namespace}:{component_type}:{component_code}"""
347347
assert self.problem.entity_ref == "xblock.v1:problem:my_component"
348348

349349
def test_stand_alone_flag(self):

0 commit comments

Comments
 (0)