Skip to content

Commit

Permalink
test: change xblock duplication tests to be implementation independent
Browse files Browse the repository at this point in the history
  • Loading branch information
rpenido committed Mar 8, 2024
1 parent 0f2ac20 commit 672f76c
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions cms/djangoapps/contentstore/views/tests/test_block.py
Original file line number Diff line number Diff line change
Expand Up @@ -1135,15 +1135,6 @@ def test_duplicate_tags(self):
# Tag the child block
tagging_api.tag_object(str(source_block.location), taxonomyA, ["two"],)

# Refresh.
source_chapter = self.store.get_item(source_chapter.location)
expected_chapter_tags = 'A:one,two;B:four,three'
assert source_chapter.serialize_tag_data(source_chapter.location) == expected_chapter_tags

source_block = self.store.get_item(source_block.location)
expected_block_tags = 'A:two'
assert source_block.serialize_tag_data(source_block.location) == expected_block_tags

# Duplicate the chapter (and its children)
dupe_location = duplicate_block(
parent_usage_key=source_course.location,
Expand All @@ -1155,8 +1146,19 @@ def test_duplicate_tags(self):
dupe_block = dupe_chapter.get_children()[0]

# Check that the duplicated blocks also duplicated tags
assert dupe_chapter.serialize_tag_data(dupe_chapter.location) == expected_chapter_tags
assert dupe_block.serialize_tag_data(dupe_block.location) == expected_block_tags
expected_chapter_tags = [
f'<ObjectTag> {str(dupe_chapter.location)}: A=one',
f'<ObjectTag> {str(dupe_chapter.location)}: A=two',
f'<ObjectTag> {str(dupe_chapter.location)}: B=four',
f'<ObjectTag> {str(dupe_chapter.location)}: B=three',
]
dupe_chapter_tags = [str(object_tag) for object_tag in tagging_api.get_object_tags(str(dupe_chapter.location))]
assert dupe_chapter_tags == expected_chapter_tags
expected_block_tags = [
f'<ObjectTag> {str(dupe_block.location)}: A=two',
]
dupe_block_tags = [str(object_tag) for object_tag in tagging_api.get_object_tags(str(dupe_block.location))]
assert dupe_block_tags == expected_block_tags


@ddt.ddt
Expand Down

0 comments on commit 672f76c

Please sign in to comment.