'Test that if handout link is course_asset then it will contain targeted course_id in handout link.'

@ddt.data(('course-v1:test_org+test_course+test_run', '/asset-v1:test_org+test_course+test_run+type@asset+block@test.png'), ('test_org/test_course/test_run', '/c4x/test_org/test_course/asset/test.png'))
@ddt.unpack
def test_from_xml_when_handout_is_course_asset(self, course_id_string, expected_handout_link):

    module_system = DummySystem(load_error_modules=True)
    course_id = CourseKey.from_string(course_id_string)
    xml_data = '\n                                                <video    display_name="Test    Video"\n                                                                            youtube="1.0:p2Q6BrNhdh8,0.75:izygArpw-Qo,1.25:1EeWXzPdhSA,1.5:rABDYkeK0x8"\n                                                                            show_captions="false"\n                                                                            download_track="false"\n                                                                            start_time="00:00:01"\n                                                                            download_video="false"\n                                                                            end_time="00:01:00">\n                                                        <source    src="http://www.example.com/source.mp4"/>\n                                                        <track    src="http://www.example.com/track"/>\n                                                        <handout    src="/asset-v1:test_org_1+test_course_1+test_run_1+type@asset+block@test.png"/>\n                                                        <transcript    language="uk"    src="ukrainian_translation.srt"    />\n                                                        <transcript    language="de"    src="german_translation.srt"    />\n                                                </video>\n                                '
    id_generator = Mock()
    id_generator.target_course_id = course_id
    output = VideoDescriptor.from_xml(xml_data, module_system, id_generator)
    self.assert_attributes_equal(output, {'youtube_id_0_75': 'izygArpw-Qo', 'youtube_id_1_0': 'p2Q6BrNhdh8', 'youtube_id_1_25': '1EeWXzPdhSA', 'youtube_id_1_5': 'rABDYkeK0x8', 'show_captions': False, 'start_time': datetime.timedelta(seconds=1), 'end_time': datetime.timedelta(seconds=60), 'track': 'http://www.example.com/track', 'handout': expected_handout_link, 'download_track': False, 'download_video': False, 'html5_sources': ['http://www.example.com/source.mp4'], 'data': '', 'transcripts': {'uk': 'ukrainian_translation.srt', 'de': 'german_translation.srt'}})
