def assert_bumper_payload_contains_ids(self, video_event, sources, duration): """ Bumper video events should all contain "host_component_id", "bumper_id", "duration", "code" attributes in their payload. This function asserts that those fields are present and have correct values. """ self.add_bumper() video_descriptors = self.course_fixture.get_nested_xblocks(category='video') video_desc = video_descriptors[0] video_locator = UsageKey.from_string(video_desc.locator) expected_event = { 'event': { 'host_component_id': video_locator.html_id(), 'bumper_id': sources, 'duration': _parse_time_str(duration), 'code': 'html5' } } self.assert_events_match([expected_event], [video_event])