'Check course/randomize module works fine'

def test_children(self):

    self.assertTrue(self.course.has_children)
    self.assertEquals(len(self.course.get_children()), 2)
    def inner_get_module(descriptor):
        '\n                                                Override    systems.get_module\n                                                                This    method    will    be    called    when    any    call    is    made    to    self.system.get_module\n                                                '
        if isinstance(descriptor, BlockUsageLocator):
            location = descriptor
            descriptor = self.modulestore.get_item(location, depth=None)
        descriptor.xmodule_runtime = self.get_dummy_course()
        descriptor.xmodule_runtime.descriptor_runtime = descriptor._runtime
        descriptor.xmodule_runtime.get_module = inner_get_module
        return descriptor
    self.system.get_module = inner_get_module
    randomize_descriptor = inner_get_module(self.course.id.make_usage_key('randomize', 'my_randomize'))
    self.assertTrue(randomize_descriptor.has_children)
    self.assertEquals(len(randomize_descriptor.get_children()), 2)
    randomize_module = RandomizeModule(randomize_descriptor, self.system, scope_ids=ScopeIds(None, None, self.course.id, self.course.id))
    self.assertEquals(len(randomize_module.get_child_descriptors()), 1, 'No    child    is    chosen')
    self.assertIn(randomize_module.child.display_name, ['A', 'B'], 'Unwanted    child    selected')
