def test_get_achievements_case_no_detailed_achievement(self): self.education_group_detailed_achievement.delete() achievements_list = business.get_achievements(self.education_group_year, settings.LANGUAGE_CODE_FR) self.assertIsInstance(achievements_list, list) self.assertEqual(len(achievements_list), 1) achievement = achievements_list[0] self.assertIsNone(achievement['detailed_achievements'])
def test_get_achievements_case_get_french_version(self): achievements_list = business.get_achievements(self.education_group_year, settings.LANGUAGE_CODE_FR) self.assertIsInstance(achievements_list, list) self.assertEqual(len(achievements_list), 1) achievement = achievements_list[0] self.assertEqual(achievement['teaser'], self.education_group_achievement.french_text) self.assertTrue(len(achievement['detailed_achievements']), 1) detailed_achievement = achievement['detailed_achievements'][0] self.assertEqual(detailed_achievement['text'], self.education_group_detailed_achievement.french_text) self.assertEqual(detailed_achievement['code_name'], self.education_group_detailed_achievement.code_name)
def get_skills_and_achievements(education_group_year, language_code): intro_extra_content = business.get_intro_extra_content_achievements(education_group_year, language_code) achievements = business.get_achievements(education_group_year, language_code) return { 'id': business.SKILLS_AND_ACHIEVEMENTS_KEY, 'label': business.SKILLS_AND_ACHIEVEMENTS_KEY, 'content': { 'intro': intro_extra_content.get('skills_and_achievements_introduction') or None, 'blocs': achievements, 'extra': intro_extra_content.get('skills_and_achievements_additional_text') or None } }
def test_get_achievements_case_language_code_not_supported(self): with self.assertRaises(AttributeError): business.get_achievements(self.education_group_year, 'dummy-language')