def test_postcode_sibling_finder_returns_postcode_if_in_list(self): country_finder = PageFactory.create_country_finder_page(title='Country Finder') PageFactory.create_postcode_page(title='Postcode', path='11111112', parent_page=country_finder.get_parent()) output = postcode_sibling_finder(country_finder) self.assertIsNotNone(output) self.assertEquals(type(output), CourseFinderPostcode)
def test_postcode_sibling_finder_returns_first_entry_if_multiple_postcode_in_list(self): country_finder = PageFactory.create_country_finder_page(title='Country Finder') postcode_1 = PageFactory.create_postcode_page(title='Postcode', path='11111112', parent_page=country_finder.get_parent()) postcode_2 = PageFactory.create_postcode_page(title='Postcode 2', path='11111113', parent_page=country_finder.get_parent()) output = postcode_sibling_finder(country_finder) self.assertIsNotNone(output) self.assertEquals(type(output), CourseFinderPostcode) self.assertNotEquals(postcode_1.title, postcode_2.title) self.assertEquals(output.title, postcode_1.title)
def test_postcode_sibling_finder_returns_postcode_if_multiple_page_types_exists(self): country_finder = PageFactory.create_country_finder_page(title='Country Finder') mode_of_study_finder = PageFactory.create_mode_of_study_finder_page(title='Mode of Study Finder', path='11111112', parent_page=country_finder.get_parent()) postcode = PageFactory.create_postcode_page(title='Postcode', path='11111113', parent_page=country_finder.get_parent()) output = postcode_sibling_finder(country_finder) self.assertIsNotNone(output) self.assertEquals(type(output), CourseFinderPostcode) self.assertNotEquals(mode_of_study_finder.title, postcode.title) self.assertEquals(output.title, postcode.title)
def test_postcode_sibling_finder_returns_none_if_no_postcode_page_exists( self): country_finder = PageFactory.create_country_finder_page( title='Country Finder') output = postcode_sibling_finder(country_finder) self.assertIsNone(output)