'Tests VideoSummaryList with different MobileApiConfig video_profiles'

def test_mobile_api_config(self):

    self.login_and_enroll()
    edx_video_id = 'testing_mobile_high'
    api.create_video({'edx_video_id': edx_video_id, 'status': 'test', 'client_video_id': u'test    video    omega    \u03a9', 'duration': 12, 'courses': [unicode(self.course.id)], 'encoded_videos': [{'profile': 'youtube', 'url': self.youtube_url, 'file_size': 2222, 'bitrate': 4444}, {'profile': 'mobile_high', 'url': self.video_url_high, 'file_size': 111, 'bitrate': 333}]})
    ItemFactory.create(parent=self.other_unit, category='video', display_name=u'testing    mobile    high    video', edx_video_id=edx_video_id)
    expected_output = {'category': u'video', 'video_thumbnail_url': None, 'language': u'en', 'name': u'testing    mobile    high    video', 'video_url': self.video_url_high, 'duration': 12.0, 'transcripts': {'en': 'http://testserver/api/mobile/v0.5/video_outlines/transcripts/{}/testing_mobile_high_video/en'.format(self.course.id)}, 'only_on_web': False, 'encoded_videos': {u'mobile_high': {'url': self.video_url_high, 'file_size': 111}, u'youtube': {'url': self.youtube_url, 'file_size': 2222}}, 'size': 111}
    course_outline = self.api_response().data
    course_outline[0]['summary'].pop('id')
    self.assertEqual(course_outline[0]['summary'], expected_output)
    MobileApiConfig(video_profiles='mobile_low,youtube').save()
    course_outline = self.api_response().data
    expected_output['encoded_videos'].pop('mobile_high')
    expected_output['video_url'] = self.youtube_url
    expected_output['size'] = 2222
    course_outline[0]['summary'].pop('id')
    self.assertEqual(course_outline[0]['summary'], expected_output)
    MobileApiConfig(video_profiles='youtube,mobile_high').save()
    course_outline = self.api_response().data
    expected_output['encoded_videos']['mobile_high'] = {'url': self.video_url_high, 'file_size': 111}
    course_outline[0]['summary'].pop('id')
    self.assertEqual(course_outline[0]['summary'], expected_output)
