Commit c1b148dd by Noraiz Anwar Committed by GitHub

Merge pull request #14916 from edx/noraiz/TNL-6837

TNL-6837 ORAs and Drag and Drop not supported in libraries, remove both from problem types in studio
parents 7f09919c 07490063
......@@ -308,8 +308,9 @@ def get_component_templates(courselike, library=False):
)
)
# Add any advanced problem types. Note that these are different xblocks being stored as Advanced Problems.
if category == 'problem':
# Add any advanced problem types. Note that these are different xblocks being stored as Advanced Problems,
# currently not supported in libraries .
if category == 'problem' and not library:
disabled_block_names = [block.name for block in disabled_xblocks()]
advanced_problem_types = [advanced_problem_type for advanced_problem_type in ADVANCED_PROBLEM_TYPES
if advanced_problem_type['component'] not in disabled_block_names]
......
......@@ -3,6 +3,7 @@ Unit tests for contentstore.views.library
More important high-level tests are in contentstore/tests/test_libraries.py
"""
from django.conf import settings
from contentstore.tests.utils import AjaxEnabledTestClient, parse_json
from contentstore.utils import reverse_course_url, reverse_library_url
from contentstore.tests.utils import CourseTestCase
......@@ -251,6 +252,24 @@ class UnitTestLibraries(CourseTestCase):
self.assertNotIn('discussion', templates)
self.assertNotIn('advanced', templates)
def test_advanced_problem_types(self):
"""
Verify that advanced problem types are not provided in problem component for libraries.
"""
lib = LibraryFactory.create()
lib.save()
problem_type_templates = next(
(component['templates'] for component in get_component_templates(lib, library=True) if component['type'] == 'problem'),
[]
)
# Each problem template has a category which shows whether problem is a 'problem'
# or which of the advanced problem type (e.g drag-and-drop-v2).
problem_type_categories = [problem_template['category'] for problem_template in problem_type_templates]
for advance_problem_type in settings.ADVANCED_PROBLEM_TYPES:
self.assertNotIn(advance_problem_type['component'], problem_type_categories)
def test_manage_library_users(self):
"""
Simple test that the Library "User Access" view works.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment