forked from openedx/edx-platform
-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: [AXM-636] Cover Offline Mode API with unit tests #2577
Merged
GlugovGrGlib
merged 9 commits into
mob-develop
from
kireiev/AXM-636/test/Unit_tests_for_Offline_mode
Jun 24, 2024
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
83e9f2e
test: [AXM-636] Add some tests to cover Offline Mode
KyryloKireiev e7427d8
test: [AXM-636] Covered the all Ofline Mode app with tests
KyryloKireiev b16d675
test: [AXM-636] Add test to Blocks Info API
KyryloKireiev 1dceee1
style: [AXM-636] Improve code style
KyryloKireiev 687b79b
style: [AXM-636] Ivan's code improving
KyryloKireiev a7dc6a2
refactor: [AXM-636] Refactor tests, add new tests
KyryloKireiev 34aa2cf
test: [AXM-653] Fix tests, refactor, add new functional tests
KyryloKireiev 8cb8daa
fix: [AXM-653] Commit forgotten base file
KyryloKireiev fc5be32
test: [AXM-653] Fix old tests, add new tests
KyryloKireiev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's worth adding a test to check for the absence of a new field in version 3 of this API
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added tests for versions less then v4