From 672f76cd7d8e54c0e6814be3616882d89857cb29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=B4mulo=20Penido?= Date: Fri, 8 Mar 2024 11:37:47 -0300 Subject: [PATCH] test: change xblock duplication tests to be implementation independent --- .../contentstore/views/tests/test_block.py | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/cms/djangoapps/contentstore/views/tests/test_block.py b/cms/djangoapps/contentstore/views/tests/test_block.py index c00300bd57e9..0a12287ac199 100644 --- a/cms/djangoapps/contentstore/views/tests/test_block.py +++ b/cms/djangoapps/contentstore/views/tests/test_block.py @@ -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, @@ -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' {str(dupe_chapter.location)}: A=one', + f' {str(dupe_chapter.location)}: A=two', + f' {str(dupe_chapter.location)}: B=four', + f' {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' {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