def test_get_publish_url_case_not_common(self): training = TrainingFactory() expected_url = "{api_url}/{endpoint}".format( api_url=settings.ESB_API_URL, endpoint=settings.ESB_REFRESH_PEDAGOGY_ENDPOINT.format( year=training.academic_year.year, code=training.acronym), ) self.assertEqual(expected_url, _get_url_to_publish(training))
def test_get_publish_url_case_common_type(self): bachelor_common = EducationGroupYearCommonBachelorFactory() expected_url = "{api_url}/{endpoint}".format( api_url=settings.ESB_API_URL, endpoint=settings.ESB_REFRESH_COMMON_ADMISSION_ENDPOINT.format( year=bachelor_common.academic_year.year), ) self.assertEqual(expected_url, _get_url_to_publish(bachelor_common))
def test_get_publish_url_case_is_common_of_common(self): common = EducationGroupYearCommonFactory() expected_url = "{api_url}/{endpoint}".format( api_url=settings.ESB_API_URL, endpoint=settings.ESB_REFRESH_COMMON_PEDAGOGY_ENDPOINT.format( year=common.academic_year.year), ) self.assertEqual(expected_url, _get_url_to_publish(common))
def test_get_publish_url_case_not_common_and_finality_case(self): training = TrainingFactory(education_group_type__name=random.choice( TrainingType.finality_types())) expected_url = "{api_url}/{endpoint}".format( api_url=settings.ESB_API_URL, endpoint=settings.ESB_REFRESH_PEDAGOGY_ENDPOINT.format( year=training.academic_year.year, code=training.partial_acronym), ) self.assertEqual(expected_url, _get_url_to_publish(training))
def test_get_publish_url_case_not_common_and_fsa_speciality_case(self): fsa_speciality = MiniTrainingFactory( education_group_type__name=MiniTrainingType.FSA_SPECIALITY.name) expected_url = "{api_url}/{endpoint}".format( api_url=settings.ESB_API_URL, endpoint=settings.ESB_REFRESH_PEDAGOGY_ENDPOINT.format( year=fsa_speciality.academic_year.year, code='fsa1ba-{partial_acronym}'.format( partial_acronym=fsa_speciality.partial_acronym)), ) self.assertEqual(expected_url, _get_url_to_publish(fsa_speciality))
def test_get_publish_url_case_not_common_and_mini_training_case(self): mini_training = MiniTrainingFactory( education_group_type__name=random.choice( [t.name for t in MiniTrainingType])) print(mini_training.education_group_type) expected_url = "{api_url}/{endpoint}".format( api_url=settings.ESB_API_URL, endpoint=settings.ESB_REFRESH_PEDAGOGY_ENDPOINT.format( year=mini_training.academic_year.year, code=self._get_correct_mini_training_code(mini_training)), ) self.assertEqual(expected_url, _get_url_to_publish(mini_training))
def test_get_publish_url_case_not_common_and_finality_or_option_case(self): training = EducationGroupYearFactory( education_group_type__name=random.choice( TrainingType.finality_types() + [MiniTrainingType.OPTION.name])) parent = TrainingFactory( education_group_type__name=TrainingType.PGRM_MASTER_120.name, academic_year=training.academic_year) GroupElementYearFactory(parent=parent, child_branch=training) expected_url = "{api_url}/{endpoint}".format( api_url=settings.ESB_API_URL, endpoint=settings.ESB_REFRESH_PEDAGOGY_ENDPOINT.format( year=training.academic_year.year, code="{parent}-{partial_acronym}".format( parent=parent.acronym, partial_acronym=training.partial_acronym)), ) self.assertEqual(expected_url, _get_url_to_publish(training))