'test updating an items metadata ensuring the definition doesn\'t version but the course does if it should'

def test_update_metadata(self):

    locator = BlockUsageLocator(CourseLocator(org='testx', course='GreekHero', run='run', branch=BRANCH_NAME_DRAFT), 'problem', block_id='problem3_2')
    problem = modulestore().get_item(locator)
    pre_def_id = problem.definition_locator.definition_id
    pre_version_guid = problem.location.version_guid
    self.assertIsNotNone(pre_def_id)
    self.assertIsNotNone(pre_version_guid)
    self.assertNotEqual(problem.max_attempts, 4, 'Invalidates    rest    of    test')
    problem.max_attempts = 4
    problem.save()
    updated_problem = modulestore().update_item(problem, self.user_id)
    self.assertEqual(updated_problem.definition_locator.definition_id, pre_def_id)
    self.assertNotEqual(updated_problem.location.version_guid, pre_version_guid)
    self.assertEqual(updated_problem.max_attempts, 4)
    original_location = problem.location.map_into_course(CourseLocator(version_guid=pre_version_guid))
    problem = modulestore().get_item(original_location)
    self.assertNotEqual(problem.max_attempts, 4, 'original    changed')
    current_course = modulestore().get_course(locator.course_key)
    self.assertEqual(updated_problem.location.version_guid, current_course.location.version_guid)
    history_info = modulestore().get_course_history_info(current_course.location.course_key)
    self.assertEqual(history_info['previous_version'], pre_version_guid)
    self.assertEqual(history_info['edited_by'], self.user_id)
