def test_cidre11a_event_pg(self): '''tests when the cidre11a regexp searches event, event_type is 'problem_graded' ''' self.assertEqual( addmoduleid.guess_module_id(self.cidre11a_event_input_pg), 'ORGx/Course1x/foo/bar')
def test_cidre8_page(self): '''tests when the cidre8 regexp searches page, event_source is 'browser', event_type is 'page_close' ''' self.assertEqual(addmoduleid.guess_module_id(self.cidre8_page_input), "ORGx/Course1x/chapter/foo/")
def test_cidre5_event_list(self): '''tests when the cidre5 regexp searches first element of event list, event_source is 'browser' ''' self.assertEqual( addmoduleid.guess_module_id(self.cidre5_event_list_input), "ORGx/Course1x/problem/foo")
def test_cidre11a_event_no_problem(self): '''tests when the cidre11a regexp searches event, event_type does not contain 'problem' ''' self.assertEqual( addmoduleid.guess_module_id(self.cidre11a_event_no_problem_input), 'ORGx/Course1x/foo/bar')
def test_cidre3_event_id(self): '''tests when the cidre3 regexp searches event > id, event_source is 'browser' ''' self.assertEqual( addmoduleid.guess_module_id(self.cidre3_event_id_input), "ORGx/Course1x/foo/bar")
def test_cidre3a_event_type(self): '''tests when the cidre3a regexp searches event_type ''' self.assertEqual( addmoduleid.guess_module_id(self.cidre3a_event_type_input), "ORGx/Course1x/foo/bar/baz")
def test_cidre10_path(self): '''tests when the cidre10 regexp searches context > path ''' self.assertEqual(addmoduleid.guess_module_id(self.cidre10_path_input), "ORGx/Course1x/foo/bar")
def test_cidre9_event_type(self): '''tests when the cidre9 regexp searches event_type ''' self.assertEqual( addmoduleid.guess_module_id(self.cidre9_event_type_input), "ORGx/Course1x/jump_to_id/foo")
def test_cidre6_event_type(self): '''tests when the cidre6 regexp searches event_type ''' self.assertEqual( addmoduleid.guess_module_id(self.cidre6_event_type_input), "ORGx/Course1x/sequential/bar/")
def test_fidre8_event_type(self): '''tests when the fidre8 regexp searches event_type ''' self.assertEqual( addmoduleid.guess_module_id(self.fidre8_event_type_input), "ORGx/Course1x/forum/bar")
def test_okre5_page(self): '''tests when the okre5 regexp searches page, event_type is 'play_video' ''' self.assertEqual(addmoduleid.guess_module_id(self.okre5_page_input), 'ORGx/Course1x/video/foo')
def test_cidre4_event_id(self): '''tests when the cidre4 regexp searches event > problem_id ''' self.assertEqual( addmoduleid.guess_module_id(self.cidre4_event_id_input), "ORGx/Course1x/video/foo")
def test_undesired_event_id(self): '''tests that nothing is returned when event > id is not string ''' self.assertIsNone( addmoduleid.guess_module_id(self.undesired_event_id_input))
def test_undesired_event_type_3(self): '''tests that nothing is returned when event_type is 'recommender_upvote' ''' self.assertIsNone( addmoduleid.guess_module_id(self.undesired_event_type_3_input))
def test_undesired_event_type_2(self): '''tests that nothing is returned when event_type is 'delete_resource' ''' self.assertIsNone( addmoduleid.guess_module_id(self.undesired_event_type_2_input))
def test_okre4_event(self): '''tests when the okre4 regexp searches event ''' self.assertEqual(addmoduleid.guess_module_id(self.okre4_event_input), 'ORGx/Course1x/foo/bar')
def test_cidre3c_event(self): '''tests when the cidre3c regexp searches event ''' self.assertEqual(addmoduleid.guess_module_id(self.cidre3c_event_input), "ORGx/Course1x/foo/bar")
def test_okre2_page_pg(self): '''tests when the okre2 regexp searches page, event_type is 'problem_graded' ''' self.assertEqual(addmoduleid.guess_module_id(self.okre2_page_pg_input), 'ORGx/Course1x/problem/foo')
def test_str_event(self): '''tests when none of the previous criteria have been met, event is a string ''' self.assertIsNone(addmoduleid.guess_module_id(self.string_event_input))
def test_okre3_path(self): '''tests when the okre3 regexp searches context > path ''' self.assertEqual(addmoduleid.guess_module_id(self.okre3_path_input), 'ORGx/Course1x/foo/bar')
def test_meets_no_criteria(self): '''tests when none of the other criteria have been met ''' self.assertIsNone( addmoduleid.guess_module_id(self.meets_no_criteria_input))
def test_empty_json(self): '''tests when an empty dictionary (result of json.loads()) is passed ''' with self.assertRaises(KeyError): addmoduleid.guess_module_id(dict())