コード例 #1
0
 def test_basic_config(self):
     self.test_data.create_curriculum_area(1)
     config_file = "basic-config.yaml"
     lo_loader = LearningOutcomesLoader(structure_filename=config_file,
                                        base_path=self.base_path)
     lo_loader.load()
     lo_objects = LearningOutcome.objects.all()
     self.assertQuerysetEqual(lo_objects, [
         "<LearningOutcome: Justify why there aren’t actual 0’s and 1’s zooming around inside a computer.>"
     ])
コード例 #2
0
    def test_basic_config(self):
        config_file = "basic-config.yaml"

        lo_loader = LearningOutcomesLoader(config_file, self.BASE_PATH)
        lo_loader.load()

        lo_objects = LearningOutcome.objects.all()

        self.assertQuerysetEqual(lo_objects, [
            "<LearningOutcome: Justify why there aren’t actual 0’s and 1’s zooming around inside a computer.>"
        ])
コード例 #3
0
 def test_curriculum_areas(self):
     config_file = "curriculum-areas.yaml"
     self.test_data.create_curriculum_area("1")
     self.test_data.create_curriculum_area("2")
     lo_loader = LearningOutcomesLoader(structure_filename=config_file,
                                        base_path=self.base_path)
     lo_loader.load()
     outcome = LearningOutcome.objects.get(slug="outcome-key")
     self.assertQuerysetEqual(outcome.curriculum_areas.order_by("name"), [
         "<CurriculumArea: Area 1>",
         "<CurriculumArea: Area 2>",
     ])
コード例 #4
0
    def test_translation(self):
        self.test_data.create_curriculum_area(1)
        config_file = "translation.yaml"

        lo_loader = LearningOutcomesLoader(structure_filename=config_file,
                                           base_path=self.base_path)
        lo_loader.load()

        translated = LearningOutcome.objects.get(slug="translated")
        self.assertSetEqual(set(["en", "de"]), set(translated.languages))
        self.assertEqual("English text", translated.text)
        with translation.override("de"):
            self.assertEqual("German text", translated.text)
コード例 #5
0
    def test_missing_translation(self):
        self.test_data.create_curriculum_area(1)
        config_file = "translation.yaml"

        lo_loader = LearningOutcomesLoader(structure_filename=config_file,
                                           base_path=self.base_path)
        lo_loader.load()

        untranslated = LearningOutcome.objects.get(slug="untranslated")
        self.assertSetEqual(set(["en"]), set(untranslated.languages))
        self.assertEqual("English text", untranslated.text)

        # Check name does not fall back to english for missing translation
        with translation.override("de"):
            self.assertEqual("", untranslated.text)