forked from openedx/edx-platform
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: [AXM-636] Cover Offline Mode API with unit tests (#2577)
* test: [AXM-636] Add some tests to cover Offline Mode * test: [AXM-636] Covered the all Ofline Mode app with tests * test: [AXM-636] Add test to Blocks Info API * style: [AXM-636] Improve code style * style: [AXM-636] Ivan's code improving Co-authored-by: Ivan Niedielnitsev <[email protected]> * refactor: [AXM-636] Refactor tests, add new tests * test: [AXM-653] Fix tests, refactor, add new functional tests * fix: [AXM-653] Commit forgotten base file * test: [AXM-653] Fix old tests, add new tests --------- Co-authored-by: Ivan Niedielnitsev <[email protected]>
- Loading branch information
1 parent
6fa315c
commit cf5694e
Showing
8 changed files
with
1,126 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
""" | ||
Tests for the testing xBlock renderers for Offline Mode. | ||
""" | ||
|
||
from xmodule.capa.tests.response_xml_factory import MultipleChoiceResponseXMLFactory | ||
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase | ||
from xmodule.modulestore.tests.factories import CourseFactory, BlockFactory | ||
|
||
|
||
class CourseForOfflineTestCase(ModuleStoreTestCase): | ||
""" | ||
Base class for creation course for Offline Mode testing. | ||
""" | ||
|
||
def setUp(self): | ||
super().setUp() | ||
default_store = self.store.default_modulestore.get_modulestore_type() | ||
with self.store.default_store(default_store): | ||
self.course = CourseFactory.create( # lint-amnesty, pylint: disable=attribute-defined-outside-init | ||
display_name='Offline Course', | ||
org='RaccoonGang', | ||
number='1', | ||
run='2024', | ||
) | ||
chapter = BlockFactory.create(parent=self.course, category='chapter') | ||
problem_xml = MultipleChoiceResponseXMLFactory().build_xml( | ||
question_text='The correct answer is Choice 2', | ||
choices=[False, False, True, False], | ||
choice_names=['choice_0', 'choice_1', 'choice_2', 'choice_3'] | ||
) | ||
self.vertical_block = BlockFactory.create( # lint-amnesty, pylint: disable=attribute-defined-outside-init | ||
parent_location=chapter.location, | ||
category='vertical', | ||
display_name='Vertical' | ||
) | ||
self.html_block = BlockFactory.create( # lint-amnesty, pylint: disable=attribute-defined-outside-init | ||
parent=self.vertical_block, | ||
category='html', | ||
display_name='HTML xblock for Offline', | ||
data='<p>Test HTML Content<p>' | ||
) | ||
self.problem_block = BlockFactory.create( # lint-amnesty, pylint: disable=attribute-defined-outside-init | ||
parent=self.vertical_block, | ||
category='problem', | ||
display_name='Problem xblock for Offline', | ||
data=problem_xml | ||
) |
Oops, something went wrong.