def test_title(self): test_course_instance = { 'section': ' 001 ', 'title': 'Another Boring Course', } response = _get_course_title(test_course_instance) self.assertEqual(response, 'Another Boring Course 001')
def test_extra_whitespace_short_title_and_section(self): test_course_instance = { 'section': ' 001 ', 'short_title': '\tABC123\n', } response = _get_course_title(test_course_instance) self.assertEqual(response, 'ABC123 001')
def test_short_title(self): test_course_instance = { 'section': '001', 'short_title': 'ABC123', } response = _get_course_title(test_course_instance) self.assertEqual(response, 'ABC123 001')
def test_no_titles_or_section(self): """ if preferred data for building the course link text is blank, we fall back on data we always expect to have """ test_course_instance = { 'course': {'registrar_code': 'ABCDE12345', 'school_id': 'fake'}, } response = _get_course_title(test_course_instance) self.assertEqual(response, 'FAKE ABCDE12345')
def test_no_titles_or_section(self): """ if preferred data for building the course link text is blank, we fall back on data we always expect to have """ test_course_instance = { 'course': { 'registrar_code': 'ABCDE12345', 'school_id': 'fake' }, } response = _get_course_title(test_course_instance) self.assertEqual(response, 'FAKE ABCDE12345')