- Moving xmodule folder to root as we're dissolving sub-projects of common folder in edx-platform
- More info: https://openedx.atlassian.net/browse/BOM-2579
- -e common/lib/xmodule has been removed from the requirements as xmodule has itself become the part of edx-platform and not being installed through requirements
- The test files common/lib/xmodule/test_files/ have been removed as they are not being used anymore
33 lines
1.1 KiB
Python
33 lines
1.1 KiB
Python
"""
|
|
Tests that policy json files import correctly when loading XML
|
|
"""
|
|
|
|
|
|
import pytest
|
|
|
|
from xmodule.tests.xml import XModuleXmlImportTest
|
|
from xmodule.tests.xml.factories import CourseFactory
|
|
|
|
|
|
class TestPolicy(XModuleXmlImportTest):
|
|
"""
|
|
Tests that policy json files import correctly when loading xml
|
|
"""
|
|
|
|
def test_no_attribute_mapping(self):
|
|
# Policy files are json, and thus the values aren't passed through 'deserialize_field'
|
|
# Therefor, the string 'null' is passed unchanged to the Float field, which will trigger
|
|
# a ValueError
|
|
with pytest.raises(ValueError):
|
|
course = self.process_xml(CourseFactory.build(policy={'days_early_for_beta': 'null'}))
|
|
|
|
# Trigger the exception by looking at the imported data
|
|
course.days_early_for_beta # pylint: disable=pointless-statement
|
|
|
|
def test_course_policy(self):
|
|
course = self.process_xml(CourseFactory.build(policy={'days_early_for_beta': None}))
|
|
assert course.days_early_for_beta is None
|
|
|
|
course = self.process_xml(CourseFactory.build(policy={'days_early_for_beta': 9}))
|
|
assert course.days_early_for_beta == 9
|