'Test updating metadata, children, and definition in a single call ensuring all the versioning occurs'

def test_update_manifold(self):

    locator = BlockUsageLocator(CourseLocator('testx', 'GreekHero', 'run', branch=BRANCH_NAME_DRAFT), 'problem', block_id='problem1')
    original = modulestore().get_item(locator)
    locator = BlockUsageLocator(CourseLocator('guestx', 'contender', 'run', branch=BRANCH_NAME_DRAFT), 'course', block_id='head345679')
    category = 'problem'
    new_payload = '<problem>empty</problem>'
    modulestore().create_child('test_update_manifold', locator, category, fields={'display_name': 'problem    1', 'data': new_payload})
    another_payload = '<problem>not    empty</problem>'
    modulestore().create_child('test_update_manifold', locator, category, fields={'display_name': 'problem    2', 'data': another_payload}, definition_locator=original.definition_locator)
    modulestore()._clear_cache()
    block = modulestore().get_item(locator)
    pre_def_id = block.definition_locator.definition_id
    pre_version_guid = block.location.version_guid
    self.assertNotEqual(block.grading_policy['GRADER'][0]['min_count'], 13)
    block.grading_policy['GRADER'][0]['min_count'] = 13
    block.children = (block.children[1:] + [block.children[0]])
    block.advertised_start = 'Soon'
    block.save()
    updated_block = modulestore().update_item(block, self.user_id)
    self.assertNotEqual(updated_block.definition_locator.definition_id, pre_def_id)
    self.assertNotEqual(updated_block.location.version_guid, pre_version_guid)
    self.assertEqual(updated_block.grading_policy['GRADER'][0]['min_count'], 13)
    self.assertEqual(updated_block.children[0].version_agnostic(), block.children[0].version_agnostic())
    self.assertEqual(updated_block.advertised_start, 'Soon')
