Skip to content

Commit

Permalink
feat: [AXIMST-467] Manage Tags on block level
Browse files Browse the repository at this point in the history
  • Loading branch information
ruzniaievdm committed Feb 6, 2024
1 parent 93cb201 commit c6087e1
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from django.urls import reverse
from rest_framework import serializers

from cms.djangoapps.contentstore.toggles import use_tagging_taxonomy_list_page
from cms.djangoapps.contentstore.helpers import (
xblock_studio_url,
xblock_type_display_name,
Expand Down Expand Up @@ -110,13 +111,15 @@ def get_actions(self, obj): # pylint: disable=unused-argument
Method to get actions for each child xlock of the unit.
"""

can_manage_tags = use_tagging_taxonomy_list_page()
# temporary decision defining the default value 'True' for each xblock.
actions = {
"can_copy": True,
"can_duplicate": True,
"can_move": True,
"can_manage_access": True,
"can_delete": True,
"can_manage_tags": can_manage_tags,
}

return actions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
"""
from django.urls import reverse
from rest_framework import status
from edx_toggles.toggles.testutils import override_waffle_flag

from cms.djangoapps.contentstore.tests.utils import CourseTestCase
from cms.djangoapps.contentstore.toggles import ENABLE_TAGGING_TAXONOMY_LIST_PAGE
from xmodule.partitions.partitions import ENROLLMENT_TRACK_PARTITION_ID
from xmodule.modulestore.django import (
modulestore,
Expand Down Expand Up @@ -148,6 +150,7 @@ def test_xblock_is_published(self):
response = self.client.get(url)
self.assertTrue(response.data["is_published"])

@override_waffle_flag(ENABLE_TAGGING_TAXONOMY_LIST_PAGE, True)
def test_children_content(self):
"""
Check that returns valid response with children of vertical container.
Expand Down Expand Up @@ -187,7 +190,8 @@ def test_children_content(self):
"can_duplicate": True,
"can_move": True,
"can_manage_access": True,
"can_delete": True
"can_delete": True,
"can_manage_tags": True,
},
"user_partition_info": expected_user_partition_info,
"user_partitions": expected_user_partitions
Expand All @@ -201,7 +205,8 @@ def test_children_content(self):
"can_duplicate": True,
"can_move": True,
"can_manage_access": True,
"can_delete": True
"can_delete": True,
"can_manage_tags": True,
},
"user_partition_info": expected_user_partition_info,
"user_partitions": expected_user_partitions,
Expand All @@ -219,3 +224,13 @@ def test_not_valid_usage_key_string(self):
url = self.get_reverse_url(usage_key_string)
response = self.client.get(url)
self.assertEqual(response.status_code, status.HTTP_404_NOT_FOUND)

@override_waffle_flag(ENABLE_TAGGING_TAXONOMY_LIST_PAGE, False)
def test_actions_with_turned_off_taxonomy_flag(self):
"""
Check that action manage_tags for each child item has the same value as taxonomy flag.
"""
url = self.get_reverse_url(self.vertical.location)
response = self.client.get(url)
for children in response.data["children"]:
self.assertFalse(children["actions"]["can_manage_tags"])
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,8 @@ def get(self, request: Request, usage_key_string: str):
"can_duplicate": true,
"can_move": true,
"can_manage_access": true,
"can_delete": true
"can_delete": true,
"can_manage_tags": true,
}
},
{
Expand All @@ -207,7 +208,8 @@ def get(self, request: Request, usage_key_string: str):
"can_duplicate": true,
"can_move": true,
"can_manage_access": true,
"can_delete": true
"can_delete": true,
"can_manage_tags": true,
}
},
{
Expand All @@ -219,7 +221,8 @@ def get(self, request: Request, usage_key_string: str):
"can_duplicate": true,
"can_move": true,
"can_manage_access": true,
"can_delete": true
"can_delete": true,
"can_manage_tags": true,
}
},
],
Expand Down

0 comments on commit c6087e1

Please sign in to comment.