def test_problem_check(self):
     template = self.event_templates['problem_check']
     event = self.create_event_log_line(template=template)
     expected_key = (self.DEFAULT_DATE, self.task.PROJECT_NAME)
     expected_dict = {
         'version': VERSION,
         'input_file': '',
         'project': self.task.PROJECT_NAME,
         'event_type': 'problem_check',
         'event_source': 'server',
         'event_category': 'unknown',
         'timestamp': '2013-12-17T15:38:32.805444+00:00',
         'received_at': '2013-12-17T15:38:32.805444+00:00',
         'date': self.DEFAULT_DATE,
         'host': 'test_host',
         'ip': '127.0.0.1',
         'username': '******',
         'context_course_id': self.encoded_course_id,
         'context_org_id': self.encoded_org_id,
         'context_user_id': '10',
         'problem_id': self.encoded_problem_id,
         'success': 'incorrect',
         'agent': 'blah, blah, blah',
     }
     expected_value = EventRecord(**expected_dict).to_separated_values()
     self.assert_single_map_output(event, expected_key, expected_value)
 def _get_event_record_from_mapper(self, kwargs):
     """Returns an EventRecord constructed from mapper output."""
     line = self.create_event_log_line(**kwargs)
     mapper_output = tuple(self.task.mapper(line))
     self.assertEquals(len(mapper_output), 1)
     row = mapper_output[0]
     self.assertEquals(len(row), 2)
     _actual_key, actual_value = row
     return EventRecord.from_tsv(actual_value)
 def _get_event_record_from_mapper(self, kwargs):
     """Returns an EventRecord constructed from mapper output."""
     line = self.create_event_log_line(**kwargs)
     mapper_output = tuple(self.task.mapper(line))
     self.assertEquals(len(mapper_output), 1)
     row = mapper_output[0]
     self.assertEquals(len(row), 2)
     _actual_key, actual_value = row
     return EventRecord.from_tsv(actual_value)
Exemplo n.º 4
0
 def test_android_screen(self):
     template = self.event_templates['android_screen']
     event = self.create_event_log_line(template=template)
     expected_key = (self.DEFAULT_DATE, self.DEFAULT_PROJECT)
     expected_dict = {
         'version': VERSION,
         'input_file': '',
         'project': self.DEFAULT_PROJECT,
         'event_type': 'screen',
         'event_source': 'server',
         'event_category': 'screen',
         'timestamp': '2013-12-17T15:38:32+00:00',
         'received_at': '2013-12-17T15:38:32.796000+00:00',
         'date': self.DEFAULT_DATE,
         'agent':
         'Dalvik/2.1.0 (Linux; U; Android 5.1.1; SAMSUNG-SM-N920A Build/LMY47X)',
         'agent_type': 'tablet',
         'agent_device_name': 'Samsung SM-N920A',
         'agent_os': 'Android',
         'agent_browser': 'Android',
         'agent_touch_capable': 'True',
         'ip': '98.236.220.148',
         'channel': 'server',
         'anonymous_id': self.DEFAULT_ANONYMOUS_ID,
         'category': 'screen',
         'label': 'Launch',
         'locale': 'en-US',
         'timezone': 'America/New_York',
         'app_name': 'edX',
         'app_version': '2.3.0',
         'os_name': 'Android',
         'os_version': '5.1.1',
         'device_manufacturer': 'samsung',
         'device_model': 'SAMSUNG-SM-N920A',
         'network_carrier': "AT&T",
         'screen_width': '1440',
         'screen_height': '2560',
     }
     expected_value = EventRecord(**expected_dict).to_separated_values()
     self.assert_single_map_output(event, expected_key, expected_value)
Exemplo n.º 5
0
 def test_play_video(self):
     template = self.event_templates['play_video']
     event = self.create_event_log_line(template=template)
     expected_key = (self.DEFAULT_DATE, self.task.PROJECT_NAME)
     expected_dict = {
         'version': VERSION,
         'input_file': '',
         'project': self.task.PROJECT_NAME,
         'event_type': 'play_video',
         'event_source': 'browser',
         'event_category': 'unknown',
         'timestamp': '2013-12-17T15:38:32.805444+00:00',
         'received_at': '2013-12-17T15:38:32.805444+00:00',
         'date': self.DEFAULT_DATE,
         'host': 'test_host',
         'ip': '127.0.0.1',
         'username': '******',
         'context_course_id': 'course-v1:FooX+1.23x+2013_Spring',
         'context_org_id': 'FooX',
         'context_user_id': '10',
         'context_path': '/event',
         'page': 'long meaningful url',
         'referer': 'long meaningful url',
         'accept_language': 'en-us',
         'agent':
         "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/600.8.9 (KHTML, like Gecko) Version/8.0.8 Safari/600.8.9",
         'agent_type': 'desktop',
         'agent_device_name': 'Other',
         'agent_os': 'Mac OS X',
         'agent_browser': 'Safari',
         'agent_touch_capable': 'False',
         'session': '83ce3bd69f7fc3b72b3b9f2142a8cd09',
         'code': '6FrbD6Ro5z8',
         'id': '01955efc9ba54c73a9aa7453a440cb06',
         'currenttime': '630.437320479',
     }
     expected_value = EventRecord(**expected_dict).to_separated_values()
     self.assert_single_map_output(event, expected_key, expected_value)