@@ -56,7 +56,10 @@ def setUp(self):
5656
5757 def test_import_from_staged_content (self ):
5858 expected_imported_xblocks = [self .video , self .problem ]
59- staged_content = self .import_event .get_staged_content_by_source_usage_key (self .chapter .location )
59+ staged_content_for_import = self .import_event .staged_content_for_import .get (
60+ source_usage_key = self .chapter .location
61+ )
62+ staged_content = staged_content_for_import .staged_content
6063 import_client = ImportClient (
6164 import_event = self .import_event ,
6265 staged_content = staged_content ,
@@ -72,7 +75,10 @@ def test_import_from_staged_content(self):
7275
7376 @patch ('cms.djangoapps.import_from_modulestore.helpers.ImportClient._process_import' )
7477 def test_import_from_staged_content_block_not_found (self , mocked_process_import ):
75- staged_content = self .import_event .get_staged_content_by_source_usage_key (self .chapter .location )
78+ staged_content_for_import = self .import_event .staged_content_for_import .get (
79+ source_usage_key = self .chapter .location
80+ )
81+ staged_content = staged_content_for_import .staged_content
7682 import_client = ImportClient (
7783 import_event = self .import_event ,
7884 staged_content = staged_content ,
@@ -88,19 +94,19 @@ def test_import_from_staged_content_block_not_found(self, mocked_process_import)
8894 mocked_process_import .assert_not_called ()
8995
9096 @ddt .data (
91- # TODO: Chapter and sequential will be uncommented in the future
92- # after adding it to the Learning Core.
93- # 'chapter',
94- # 'sequential',
97+ 'chapter' ,
98+ 'sequential' ,
9599 'vertical'
96100 )
97101 def test_create_container (self , block_lvl ):
98102 container_to_import = getattr (self , block_lvl )
99103 block_usage_key_to_import = str (container_to_import .location )
100- staged_content = self .import_event .get_staged_content_by_source_usage_key (block_usage_key_to_import )
104+ staged_content_for_import = self .import_event .staged_content_for_import .get (
105+ source_usage_key = self .chapter .location
106+ )
101107 import_client = ImportClient (
102108 import_event = self .import_event ,
103- staged_content = staged_content ,
109+ staged_content = staged_content_for_import . staged_content ,
104110 target_learning_package = self .learning_package ,
105111 block_usage_key_to_import = block_usage_key_to_import ,
106112 composition_level = 'xblock' ,
@@ -117,10 +123,12 @@ def test_create_container(self, block_lvl):
117123
118124 def test_create_container_with_xblock (self ):
119125 block_usage_key_to_import = str (self .problem .location )
120- staged_content = self .import_event .get_staged_content_by_source_usage_key (block_usage_key_to_import )
126+ staged_content_for_import = self .import_event .staged_content_for_import .get (
127+ source_usage_key = self .chapter .location
128+ )
121129 import_client = ImportClient (
122130 import_event = self .import_event ,
123- staged_content = staged_content ,
131+ staged_content = staged_content_for_import . staged_content ,
124132 target_learning_package = self .learning_package ,
125133 block_usage_key_to_import = block_usage_key_to_import ,
126134 composition_level = 'xblock' ,
@@ -138,7 +146,10 @@ def test_create_container_with_xblock(self):
138146 def test_process_import_with_complicated_blocks (self , block_lvl ):
139147 container_to_import = getattr (self , block_lvl )
140148 block_usage_key_to_import = str (container_to_import .location )
141- staged_content = self .import_event .get_staged_content_by_source_usage_key (self .chapter .location )
149+ staged_content_for_import = self .import_event .staged_content_for_import .get (
150+ source_usage_key = self .chapter .location
151+ )
152+ staged_content = staged_content_for_import .staged_content
142153 expected_imported_xblocks = [self .problem , self .video ]
143154
144155 import_client = ImportClient (
@@ -160,11 +171,13 @@ def test_process_import_with_complicated_blocks(self, block_lvl):
160171 def test_process_import_with_simple_blocks (self , block_type_to_import ):
161172 block_to_import = getattr (self , block_type_to_import )
162173 block_usage_key_to_import = str (block_to_import .location )
163- staged_content = self .import_event .get_staged_content_by_source_usage_key (self .chapter .location )
174+ staged_content_for_import = self .import_event .staged_content_for_import .get (
175+ source_usage_key = self .chapter .location
176+ )
164177 expected_imported_xblocks = [block_to_import ]
165178 import_client = ImportClient (
166179 import_event = self .import_event ,
167- staged_content = staged_content ,
180+ staged_content = staged_content_for_import . staged_content ,
168181 target_learning_package = self .learning_package ,
169182 block_usage_key_to_import = block_usage_key_to_import ,
170183 composition_level = 'xblock' ,
@@ -182,11 +195,13 @@ def test_process_import_with_simple_blocks(self, block_type_to_import):
182195 def test_process_import_with_override (self , override ):
183196 block_to_import = self .problem
184197 block_usage_key_to_import = str (block_to_import .location )
185- staged_content = self .import_event .get_staged_content_by_source_usage_key (self .chapter .location )
198+ staged_content_for_import = self .import_event .staged_content_for_import .get (
199+ source_usage_key = self .chapter .location
200+ )
186201
187202 import_client = ImportClient (
188203 import_event = self .import_event ,
189- staged_content = staged_content ,
204+ staged_content = staged_content_for_import . staged_content ,
190205 target_learning_package = self .learning_package ,
191206 block_usage_key_to_import = block_usage_key_to_import ,
192207 composition_level = 'xblock' ,
@@ -200,7 +215,11 @@ def test_process_import_with_override(self, override):
200215
201216 with self .captureOnCommitCallbacks (execute = True ):
202217 new_import_event = api .stage_content_for_import (source_key = self .course .id , user_id = self .user .id )
203- new_staged_content = new_import_event .get_staged_content_by_source_usage_key (self .chapter .location )
218+
219+ staged_content_for_import = new_import_event .staged_content_for_import .get (
220+ source_usage_key = self .chapter .location
221+ )
222+ new_staged_content = staged_content_for_import .staged_content
204223 import_client = ImportClient (
205224 import_event = new_import_event ,
206225 staged_content = new_staged_content ,
@@ -234,7 +253,10 @@ def test_process_import_with_override(self, override):
234253 def test_container_override (self , mock_authoring_api ):
235254 container_to_import = self .vertical
236255 block_usage_key_to_import = str (container_to_import .location )
237- staged_content = self .import_event .get_staged_content_by_source_usage_key (self .chapter .location )
256+ staged_content_for_import = self .import_event .staged_content_for_import .get (
257+ source_usage_key = self .chapter .location
258+ )
259+ staged_content = staged_content_for_import .staged_content
238260
239261 import_client = ImportClient (
240262 import_event = self .import_event ,
@@ -283,7 +305,10 @@ def test_composition_levels(self, composition_level):
283305
284306 container_to_import = self .vertical
285307 block_usage_key_to_import = str (container_to_import .location )
286- staged_content = self .import_event .get_staged_content_by_source_usage_key (self .chapter .location )
308+ staged_content_for_import = self .import_event .staged_content_for_import .get (
309+ source_usage_key = self .chapter .location
310+ )
311+ staged_content = staged_content_for_import .staged_content
287312
288313 import_client = ImportClient (
289314 import_event = self .import_event ,
@@ -304,7 +329,10 @@ def test_composition_levels(self, composition_level):
304329 def test_process_staged_content_files (self , mock_content_staging_api ):
305330 block_to_import = self .problem
306331 block_usage_key_to_import = str (block_to_import .location )
307- staged_content = self .import_event .get_staged_content_by_source_usage_key (self .chapter .location )
332+ staged_content_for_import = self .import_event .staged_content_for_import .get (
333+ source_usage_key = self .chapter .location
334+ )
335+ staged_content = staged_content_for_import .staged_content
308336
309337 import_client = ImportClient (
310338 import_event = self .import_event ,
@@ -339,11 +367,13 @@ def test_process_staged_content_files(self, mock_content_staging_api):
339367 def test_update_container_components (self ):
340368 container_to_import = self .vertical
341369 block_usage_key_to_import = str (container_to_import .location )
342- staged_content = self .import_event .get_staged_content_by_source_usage_key (self .chapter .location )
370+ staged_content_for_import = self .import_event .staged_content_for_import .get (
371+ source_usage_key = self .chapter .location
372+ )
343373
344374 import_client = ImportClient (
345375 import_event = self .import_event ,
346- staged_content = staged_content ,
376+ staged_content = staged_content_for_import . staged_content ,
347377 target_learning_package = self .learning_package ,
348378 block_usage_key_to_import = block_usage_key_to_import ,
349379 composition_level = 'container' ,
0 commit comments