def test_course_with_english_and_welsh_title(self): input_course = { "title": { "english": "mathematics", "welsh": "mathemateg" } } expected_search_title = { "english": "mathematics", "welsh": "mathemateg" } search_title = build_title(input_course) self.assertEqual(expected_search_title, search_title)
def test_course_without_title_object(self): # kis_course_id, mode.code and institution.pub_ukprn are # needed to log warning for missing title input_course = { "kis_course_id": "test_course_id", "mode": { "code": "1" }, "institution": { "pub_ukprn": "test_institution_id" }, } expected_search_title = {} search_title = build_title(input_course) self.assertEqual(expected_search_title, search_title)
def test_course_with_welsh_title_only(self): input_course = {"title": {"welsh": "mathemateg"}} expected_search_title = {"welsh": "mathemateg"} search_title = build_title(input_course) self.assertEqual(expected_search_title, search_title)
def test_course_with_empty_title_object(self): input_course = {"title": {}} expected_search_title = {} search_title = build_title(input_course) self.assertEqual(expected_search_title, search_title)