Commit 92391a22 by Calen Pennington Committed by Don Mitchell

Don't force field inheritance of default values

parent 0a38e490
......@@ -630,10 +630,6 @@ class MongoModuleStore(ModuleStoreBase):
definition_data = {}
dbmodel = self._create_new_model_data(location.category, location, definition_data, metadata)
xmodule = xblock_class(system, dbmodel)
# force inherited fields w/ defaults to take the defaults so the children can inherit
for attr in INHERITABLE_METADATA:
if hasattr(xmodule, attr):
xmodule._model_data[attr] = getattr(xmodule, attr)
return xmodule
def save_xmodule(self, xmodule):
......
......@@ -156,11 +156,7 @@ class ImportTestCase(BaseCourseTestCase):
child = descriptor.get_children()[0]
self.assertEqual(child.lms.due, ImportTestCase.date.from_json(v))
self.assertEqual(child._inheritable_metadata, child._inherited_metadata)
self.assertEqual(2, len(child._inherited_metadata))
self.assertLessEqual(
ImportTestCase.date.from_json(child._inherited_metadata['start']),
datetime.datetime.now(UTC())
)
self.assertEqual(1, len(child._inherited_metadata))
self.assertEqual(v, child._inherited_metadata['due'])
# Now export and check things
......@@ -218,10 +214,8 @@ class ImportTestCase(BaseCourseTestCase):
self.assertEqual(child.lms.due, None)
# pylint: disable=W0212
self.assertEqual(child._inheritable_metadata, child._inherited_metadata)
self.assertEqual(1, len(child._inherited_metadata))
# why do these tests look in the internal structure v just calling child.start?
self.assertLessEqual(
ImportTestCase.date.from_json(child._inherited_metadata['start']),
child.lms.start,
datetime.datetime.now(UTC())
)
......@@ -249,12 +243,7 @@ class ImportTestCase(BaseCourseTestCase):
self.assertEqual(descriptor.lms.due, ImportTestCase.date.from_json(course_due))
self.assertEqual(child.lms.due, ImportTestCase.date.from_json(child_due))
# Test inherited metadata. Due does not appear here (because explicitly set on child).
self.assertEqual(1, len(child._inherited_metadata))
self.assertLessEqual(
ImportTestCase.date.from_json(child._inherited_metadata['start']),
datetime.datetime.now(UTC()))
# Test inheritable metadata. This has the course inheritable value for due.
self.assertEqual(2, len(child._inheritable_metadata))
self.assertEqual(1, len(child._inheritable_metadata))
self.assertEqual(course_due, child._inheritable_metadata['due'])
def test_is_pointer_tag(self):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment