Exemplo n.º 1
0
 def test_basic_curriculum_areas_loader_config(self):
     config_file = "basic-config.yaml"
     area_loader = CurriculumAreasLoader(structure_filename=config_file,
                                         base_path=self.base_path)
     area_loader.load()
     self.assertQuerysetEqual(CurriculumArea.objects.all(),
                              ["<CurriculumArea: Maths>"])
 def test_curriculum_areas_loader_correct_colour_value(self):
     config_file = "basic-config.yaml"
     area_loader = CurriculumAreasLoader(config_file, self.BASE_PATH)
     area_loader.load()
     self.assertEquals(
         CurriculumArea.objects.get(slug="maths").colour,
         "blue",
     )
 def test_basic_curriculum_areas_loader_config(self):
     config_file = "basic-config.yaml"
     area_loader = CurriculumAreasLoader(config_file, self.BASE_PATH)
     area_loader.load()
     self.assertQuerysetEqual(
         CurriculumArea.objects.all(),
         ["<CurriculumArea: Maths>"]
     )
 def test_curriculum_areas_loader_correct_children_number_value(self):
     config_file = "children.yaml"
     area_loader = CurriculumAreasLoader(config_file, self.BASE_PATH)
     area_loader.load()
     self.assertEquals(
         CurriculumArea.objects.get(slug="algebra").number,
         1,
     )
Exemplo n.º 5
0
 def test_curriculum_areas_loader_correct_number_value(self):
     config_file = "basic-config.yaml"
     area_loader = CurriculumAreasLoader(structure_filename=config_file,
                                         base_path=self.base_path)
     area_loader.load()
     self.assertEquals(
         CurriculumArea.objects.get(slug="maths").number,
         1,
     )
Exemplo n.º 6
0
 def test_curriculum_areas_loader_correct_children_colour_value(self):
     config_file = "children.yaml"
     area_loader = CurriculumAreasLoader(structure_filename=config_file,
                                         base_path=self.base_path)
     area_loader.load()
     self.assertEquals(
         CurriculumArea.objects.get(slug="algebra").colour,
         "blue",
     )
Exemplo n.º 7
0
    def test_curriculum_areas_loader_translation(self):
        config_file = "translation.yaml"
        area_loader = CurriculumAreasLoader(structure_filename=config_file,
                                            base_path=self.base_path)
        area_loader.load()

        translated = CurriculumArea.objects.get(slug="translated")
        self.assertSetEqual(set(["en", "de"]), set(translated.languages))
        self.assertEqual("English Name", translated.name)
        with translation.override("de"):
            self.assertEqual("German Name", translated.name)
Exemplo n.º 8
0
    def test_curriculum_areas_loader_missing_translation(self):
        config_file = "translation.yaml"
        area_loader = CurriculumAreasLoader(structure_filename=config_file,
                                            base_path=self.base_path)
        area_loader.load()

        translated = CurriculumArea.objects.get(slug="untranslated")
        self.assertSetEqual(set(["en"]), set(translated.languages))
        self.assertEqual("English Name", translated.name)
        # Check name does not fall back to english for missing translation
        with translation.override("de"):
            self.assertEqual("", translated.name)
 def test_curriculum_areas_loader_multiple_configuration(self):
     config_file = "multiple.yaml"
     area_loader = CurriculumAreasLoader(config_file, self.BASE_PATH)
     area_loader.load()
     self.assertQuerysetEqual(
         CurriculumArea.objects.all(),
         [
             "<CurriculumArea: Maths>",
             "<CurriculumArea: Maths: Algebra>",
             "<CurriculumArea: Maths: Geometry>",
             "<CurriculumArea: Science>",
             "<CurriculumArea: Art>",
         ],
         ordered=False,
     )
 def test_curriculum_areas_loader_correct_children_value(self):
     config_file = "children.yaml"
     area_loader = CurriculumAreasLoader(config_file, self.BASE_PATH)
     area_loader.load()
     self.assertQuerysetEqual(
         CurriculumArea.objects.all(),
         [
             "<CurriculumArea: Maths>",
             "<CurriculumArea: Maths: Algebra>",
             "<CurriculumArea: Maths: Geometry>",
         ],
         ordered=False,
     )
     parent = CurriculumArea.objects.get(slug="maths")
     self.assertQuerysetEqual(
         CurriculumArea.objects.filter(parent=parent),
         [
             "<CurriculumArea: Maths: Algebra>",
             "<CurriculumArea: Maths: Geometry>",
         ],
         ordered=False,
     )