'Create a new course which overrides metadata and course_data'

def test_derived_course(self):

    original_locator = CourseLocator(org='guestx', course='contender', run='run', branch=BRANCH_NAME_DRAFT)
    original = modulestore().get_course(original_locator)
    original_index = modulestore().get_course_index_info(original_locator)
    fields = {'grading_policy': original.grading_policy, 'display_name': 'Derivative'}
    fields['grading_policy']['GRADE_CUTOFFS'] = {'A': 0.9, 'B': 0.8, 'C': 0.65}
    new_draft = modulestore().create_course('counter', 'leech', 'leech_run', 'leech_master', BRANCH_NAME_DRAFT, versions_dict={BRANCH_NAME_DRAFT: original_index['versions'][BRANCH_NAME_DRAFT]}, fields=fields)
    new_draft_locator = new_draft.location
    self.assertRegexpMatches(new_draft_locator.org, 'counter')
    self.assertEqual(new_draft.edited_by, 'leech_master')
    self.assertNotEqual(new_draft_locator.version_guid, original_index['versions'][BRANCH_NAME_DRAFT])
    new_index = modulestore().get_course_index_info(new_draft_locator.course_key)
    self.assertEqual(new_index['edited_by'], 'leech_master')
    self.assertEqual(new_draft.display_name, fields['display_name'])
    self.assertDictEqual(new_draft.grading_policy['GRADE_CUTOFFS'], fields['grading_policy']['GRADE_CUTOFFS'])
