@@ -56,27 +56,13 @@ def setUpTestData(cls) -> None:
5656 package_ref = "ComponentTestCase-test-key" ,
5757 title = "Components Test Case Learning Package" ,
5858 )
59- cls .component , cls .component_version = components_api .create_component_and_version (
60- cls .learning_package .id ,
61- component_type = cls .problem_type ,
62- component_code = "my_problem" ,
63- title = "My Problem" ,
64- created = cls .now ,
65- created_by = None ,
66- )
67-
6859 # ProblemBlock content that is stored as text Content, not a file.
6960 cls .problem_media = media_api .get_or_create_text_media (
7061 cls .learning_package .id ,
7162 cls .problem_block_media_type .id ,
7263 text = "<problem>(pretend problem OLX is here)</problem>" ,
7364 created = cls .now ,
7465 )
75- components_api .create_component_version_media (
76- cls .component_version .pk ,
77- cls .problem_media .id ,
78- path = "block.xml" ,
79- )
8066
8167 # Python source file, stored as a file. This is hypothetical, as we
8268 # don't actually support bundling grader files like this today.
@@ -86,23 +72,25 @@ def setUpTestData(cls) -> None:
8672 data = b"print('hello world!')" ,
8773 created = cls .now ,
8874 )
89- components_api .create_component_version_media (
90- cls .component_version .pk ,
91- cls .python_source_asset .id ,
92- path = "src/grader.py" ,
93- )
94-
9575 # An HTML file that is student downloadable
9676 cls .html_asset_media = media_api .get_or_create_file_media (
9777 cls .learning_package .id ,
9878 cls .html_media_type .id ,
9979 data = b"<html>hello world!</html>" ,
10080 created = cls .now ,
10181 )
102- components_api .create_component_version_media (
103- cls .component_version .pk ,
104- cls .html_asset_media .id ,
105- path = "static/hello.html" ,
82+ cls .component , cls .component_version = components_api .create_component_and_version (
83+ cls .learning_package .id ,
84+ component_type = cls .problem_type ,
85+ component_code = "my_problem" ,
86+ title = "My Problem" ,
87+ created = cls .now ,
88+ created_by = None ,
89+ media = {
90+ "block.xml" : cls .problem_media ,
91+ "src/grader.py" : cls .python_source_asset ,
92+ "static/hello.html" : cls .html_asset_media ,
93+ }
10694 )
10795
10896 def test_no_component_version (self ):
0 commit comments