'This test makes a very strong assertion about the fields present in events. The goal of it is to ensure that new
fields are not added to all events mistakenly. It should be the only existing test that is updated when new top
level fields are added to all events.'

def test_strict_event_format(self):

    captured_events = []
    self.add_bumper()
    filter_event = (lambda e: (e['event_type'] == 'edx.video.bumper.loaded'))
    with self.capture_events(filter_event, captured_events=captured_events):
        self.navigate_to_video_no_render()
        self.video.click_on_poster()
    load_video_event = captured_events[0]
    (sources, duration) = (self.video.sources[0], self.video.duration)
    self.assert_bumper_payload_contains_ids(load_video_event, sources, duration)
    dynamic_string_fields = ('accept_language', 'agent', 'host', 'ip', 'event', 'session')
    for field in dynamic_string_fields:
        self.assert_field_type(load_video_event, field, basestring)
        self.assertIn(field, load_video_event, '{0}    not    found    in    the    root    of    the    event'.format(field))
        del load_video_event[field]
    self.assert_field_type(load_video_event, 'time', datetime.datetime)
    del load_video_event['time']
    course_key = CourseKey.from_string(self.course_id)
    static_fields_pattern = {'context': {'course_id': unicode(course_key), 'org_id': course_key.org, 'path': '/event', 'user_id': self.user_info['user_id']}, 'event_source': 'browser', 'event_type': 'edx.video.bumper.loaded', 'username': self.user_info['username'], 'page': self.browser.current_url, 'referer': self.browser.current_url, 'name': 'edx.video.bumper.loaded'}
    assert_events_equal(static_fields_pattern, load_video_event)
