1313from django .test .client import RequestFactory
1414from django .urls import reverse
1515from django .test .utils import override_settings
16- from edx_toggles .toggles .testutils import override_waffle_flag
1716from openedx .core .djangoapps .video_config .toggles import PUBLIC_VIDEO_SHARE
1817from openedx_events .content_authoring .data import DuplicatedXBlockData
1918from openedx_events .content_authoring .signals import XBLOCK_DUPLICATED
2322from opaque_keys .edx .asides import AsideUsageKeyV2
2423from opaque_keys .edx .keys import CourseKey , UsageKey
2524from opaque_keys .edx .locator import BlockUsageLocator , CourseLocator
26- from pyquery import PyQuery
2725from pytz import UTC
2826from bs4 import BeautifulSoup
2927from web_fragments .fragment import Fragment
5755from xmodule .partitions .tests .test_partitions import MockPartitionService
5856from xmodule .x_module import STUDENT_VIEW , STUDIO_VIEW
5957
60- from cms .djangoapps .contentstore import toggles
6158from cms .djangoapps .contentstore .tests .utils import CourseTestCase
6259from cms .djangoapps .contentstore .utils import (
6360 reverse_course_url ,
@@ -229,7 +226,6 @@ def test_get_container_fragment(self):
229226 resp = self .create_xblock (
230227 parent_usage_key = child_vertical_usage_key ,
231228 category = "problem" ,
232- boilerplate = "multiplechoice.yaml" ,
233229 )
234230 self .assertEqual (resp .status_code , 200 )
235231
@@ -258,7 +254,6 @@ def test_get_container_nested_container_fragment(self):
258254 resp = self .create_xblock (
259255 parent_usage_key = wrapper_usage_key ,
260256 category = "problem" ,
261- boilerplate = "multiplechoice.yaml" ,
262257 )
263258 self .assertEqual (resp .status_code , 200 )
264259
@@ -286,7 +281,6 @@ def test_tag_count_in_container_fragment(self, mock_get_object_tag_counts):
286281 resp = self .create_xblock (
287282 parent_usage_key = child_vertical_usage_key ,
288283 category = "problem" ,
289- boilerplate = "multiplechoice.yaml" ,
290284 )
291285 self .assertEqual (resp .status_code , 200 )
292286 usage_key = self .response_usage_key (resp )
@@ -311,18 +305,13 @@ def test_split_test(self):
311305 resp = self .create_xblock (
312306 parent_usage_key = split_test_usage_key ,
313307 category = "html" ,
314- boilerplate = "announcement.yaml" ,
315308 )
316309 self .assertEqual (resp .status_code , 200 )
317310 resp = self .create_xblock (
318311 parent_usage_key = split_test_usage_key ,
319312 category = "html" ,
320- boilerplate = "latex_html.yaml" ,
321313 )
322314 self .assertEqual (resp .status_code , 200 )
323- html , __ = self ._get_container_preview (split_test_usage_key )
324- self .assertIn ("Announcement" , html )
325- self .assertIn ("LaTeX" , html )
326315
327316 def test_split_test_edited (self ):
328317 """
@@ -608,33 +597,12 @@ def test_create_nicely(self):
608597 course = self .get_item_from_modulestore (self .usage_key )
609598 self .assertIn (chap_usage_key , course .children )
610599
611- # use default display name
612- resp = self .create_xblock (parent_usage_key = chap_usage_key , category = "vertical" )
613- vert_usage_key = self .response_usage_key (resp )
614-
615- # create problem w/ boilerplate
616- template_id = "multiplechoice.yaml"
617- resp = self .create_xblock (
618- parent_usage_key = vert_usage_key , category = "problem" , boilerplate = template_id
619- )
620- prob_usage_key = self .response_usage_key (resp )
621- problem = self .get_item_from_modulestore (prob_usage_key )
622- # check against the template
623- course = CourseFactory .create ()
624- problem_block = BlockFactory .create (category = "problem" , parent_location = course .location )
625- template = problem_block .get_template (template_id )
626- self .assertEqual (problem .data , template ["data" ])
627- self .assertEqual (problem .display_name , template ["metadata" ]["display_name" ])
628- self .assertEqual (problem .markdown , template ["metadata" ]["markdown" ])
629-
630600 def test_create_block_negative (self ):
631601 """
632602 Negative tests for create_item
633603 """
634604 # non-existent boilerplate: creates a default
635- resp = self .create_xblock (
636- category = "problem" , boilerplate = "nosuchboilerplate.yaml"
637- )
605+ resp = self .create_xblock (category = "problem" )
638606 self .assertEqual (resp .status_code , 200 )
639607
640608 def test_create_with_future_date (self ):
@@ -836,7 +804,6 @@ def setUp(self):
836804 resp = self .create_xblock (
837805 parent_usage_key = self .vert_usage_key ,
838806 category = "problem" ,
839- boilerplate = "multiplechoice.yaml" ,
840807 )
841808 self .problem_usage_key = self .response_usage_key (resp )
842809
@@ -936,19 +903,6 @@ def verify_name(
936903 self .assertEqual (duplicated_item .display_name , expected_name )
937904 return usage_key
938905
939- # Display name comes from template.
940- dupe_usage_key = verify_name (
941- self .problem_usage_key ,
942- self .vert_usage_key ,
943- "Duplicate of 'Multiple Choice'" ,
944- )
945- # Test dupe of dupe.
946- verify_name (
947- dupe_usage_key ,
948- self .vert_usage_key ,
949- "Duplicate of 'Duplicate of 'Multiple Choice''" ,
950- )
951-
952906 # Uses default display_name of 'Text' from HTML component.
953907 verify_name (self .html_usage_key , self .vert_usage_key , "Duplicate of 'Text'" )
954908
@@ -1847,7 +1801,6 @@ def setUp(self):
18471801 resp = self .create_xblock (
18481802 parent_usage_key = self .seq_usage_key ,
18491803 category = "problem" ,
1850- boilerplate = "multiplechoice.yaml" ,
18511804 )
18521805 self .problem_usage_key = self .response_usage_key (resp )
18531806
@@ -1930,11 +1883,9 @@ def setUp(self):
19301883 self .seq2_update_url = reverse_usage_url ("xblock_handler" , self .seq2_usage_key )
19311884
19321885 # create problem w/ boilerplate
1933- template_id = "multiplechoice.yaml"
19341886 resp = self .create_xblock (
19351887 parent_usage_key = self .seq_usage_key ,
19361888 category = "problem" ,
1937- boilerplate = template_id ,
19381889 )
19391890 self .problem_usage_key = self .response_usage_key (resp )
19401891 self .problem_update_url = reverse_usage_url (
@@ -1965,19 +1916,6 @@ def test_delete_field(self):
19651916 problem = self .get_item_from_modulestore (self .problem_usage_key )
19661917 self .assertEqual (problem .rerandomize , 'never' )
19671918
1968- def test_null_field (self ):
1969- """
1970- Sending null in for a field 'deletes' it
1971- """
1972- problem = self .get_item_from_modulestore (self .problem_usage_key )
1973- self .assertIsNotNone (problem .markdown )
1974- self .client .ajax_post (
1975- self .problem_update_url ,
1976- data = {'nullout' : ['markdown' ]}
1977- )
1978- problem = self .get_item_from_modulestore (self .problem_usage_key )
1979- self .assertIsNone (problem .markdown )
1980-
19811919 def test_date_fields (self ):
19821920 """
19831921 Test setting due & start dates on sequential
@@ -2427,28 +2365,6 @@ def test_field_value_errors(self):
24272365 ) # See xmodule/fields.py
24282366
24292367
2430- class TestEditItemSplitMongo (TestEditItemSetup ):
2431- """
2432- Tests for EditItem running on top of the SplitMongoModuleStore.
2433- """
2434-
2435- def test_editing_view_wrappers (self ):
2436- """
2437- Verify that the editing view only generates a single wrapper, no matter how many times it's loaded
2438-
2439- Exposes: PLAT-417
2440- """
2441- view_url = reverse_usage_url (
2442- "xblock_view_handler" , self .problem_usage_key , {"view_name" : STUDIO_VIEW }
2443- )
2444-
2445- for __ in range (3 ):
2446- resp = self .client .get (view_url , HTTP_ACCEPT = "application/json" )
2447- self .assertEqual (resp .status_code , 200 )
2448- content = json .loads (resp .content .decode ("utf-8" ))
2449- self .assertEqual (len (PyQuery (content ["html" ])(f".xblock-{ STUDIO_VIEW } " )), 1 )
2450-
2451-
24522368class TestEditSplitModule (ItemTest ):
24532369 """
24542370 Tests around editing instances of the split_test block.
@@ -2864,7 +2780,6 @@ def get_usage_key():
28642780 assert mocked_get_aside_from_xblock .called is is_get_aside_called
28652781
28662782
2867- @override_waffle_flag (toggles .LEGACY_STUDIO_PROBLEM_EDITOR , True )
28682783class TestComponentTemplates (CourseTestCase ):
28692784 """
28702785 Unit tests for the generation of the component templates for a course.
@@ -3012,12 +2927,6 @@ def test_basic_components_support_levels(self):
30122927 self .course .allow_unsupported_xblocks = True
30132928 self .templates = get_component_templates (self .course )
30142929 self ._verify_basic_component ("video" , "Video" , "us" )
3015- problem_templates = self .get_templates_of_type ("problem" )
3016- problem_no_boilerplate = self .get_template (
3017- problem_templates , "Blank Problem"
3018- )
3019- self .assertIsNotNone (problem_no_boilerplate )
3020- self .assertEqual ("us" , problem_no_boilerplate ["support_level" ])
30212930
30222931 # Now fully disable video through XBlockConfiguration
30232932 XBlockConfiguration .objects .create (name = "video" , enabled = False )
@@ -3061,20 +2970,6 @@ def test_advanced_components(self):
30612970 self .templates = get_component_templates (self .course )
30622971 self .assertTrue ((not any (item .get ("category" ) == "done" for item in self .get_templates_of_type ("advanced" ))))
30632972
3064- def test_advanced_problems (self ):
3065- """
3066- Test the handling of advanced problem templates.
3067- """
3068- problem_templates = self .get_templates_of_type ("problem" )
3069- circuit_template = self .get_template (
3070- problem_templates , "Circuit Schematic Builder"
3071- )
3072- self .assertIsNotNone (circuit_template )
3073- self .assertEqual (circuit_template .get ("category" ), "problem" )
3074- self .assertEqual (
3075- circuit_template .get ("boilerplate_name" ), "circuitschematic.yaml"
3076- )
3077-
30782973 def test_deprecated_no_advance_component_button (self ):
30792974 """
30802975 Test that there will be no `Advanced` button on unit page if xblocks have disabled
0 commit comments