'Checks to make sure that metadata inheritance on a course descriptor is respected.'

def course_descriptor_inheritance_check(self, descriptor, from_date_string, unicorn_color, url_name):

    print (descriptor, descriptor._field_data)
    self.assertEqual(descriptor.due, ImportTestCase.date.from_json(from_date_string))
    child = descriptor.get_children()[0]
    self.assertEqual(child.due, ImportTestCase.date.from_json(from_date_string))
    self.assertEqual(ImportTestCase.date.to_json(ImportTestCase.date.from_json(from_date_string)), child.xblock_kvs.inherited_settings['due'])
    descriptor.runtime.export_fs = MemoryFS()
    node = etree.Element('unknown')
    descriptor.add_xml_to_node(node)
    print ('Exported    xml:', etree.tostring(node))
    self.assertTrue(is_pointer_tag(node))
    self.assertEqual(node.attrib['course'], COURSE)
    self.assertEqual(node.attrib['org'], ORG)
    with descriptor.runtime.export_fs.open('course/{url_name}.xml'.format(url_name=url_name)) as f:
        course_xml = etree.fromstring(f.read())
    self.assertEqual(course_xml.attrib['unicorn'], unicorn_color)
    self.assertNotIn('course', course_xml.attrib)
    self.assertNotIn('org', course_xml.attrib)
    self.assertNotIn('url_name', course_xml.attrib)
    with descriptor.runtime.export_fs.open('chapter/ch.xml') as f:
        chapter_xml = etree.fromstring(f.read())
    self.assertEqual(chapter_xml.tag, 'chapter')
    self.assertNotIn('due', chapter_xml.attrib)
