def test_curriculum_guides_curriculum_guide_section_loader_invalid_section_number(self):
     test_slug = "invalid-section-number"
     curriculum_guide = self.test_data.create_curriculum_guide("1")
     factory = mock.Mock()
     curriculum_guide_section_loader = CurriculumGuideSectionsLoader(
         factory,
         curriculum_guide,
         base_path=self.base_path,
         content_path=test_slug,
         structure_filename="{}.yaml".format(test_slug),
     )
     self.assertRaises(
         InvalidYAMLValueError,
         curriculum_guide_section_loader.load
     )
 def test_curriculum_guides_curriculum_guide_section_loader_missing_section_number(self):
     test_slug = "missing-section-number"
     curriculum_guide = self.test_data.create_curriculum_guide("1")
     factory = mock.Mock()
     curriculum_guide_section_loader = CurriculumGuideSectionsLoader(
         factory,
         curriculum_guide,
         base_path=self.base_path,
         content_path=test_slug,
         structure_filename="{}.yaml".format(test_slug),
     )
     self.assertRaises(
         MissingRequiredFieldError,
         curriculum_guide_section_loader.load
     )
 def test_curriculum_guides_curriculum_guide_section_loader_missing_name(self):
     test_slug = "missing-name"
     curriculum_guide = self.test_data.create_curriculum_guide("1")
     factory = mock.Mock()
     curriculum_guide_section_loader = CurriculumGuideSectionsLoader(
         factory,
         curriculum_guide,
         base_path=self.base_path,
         content_path=test_slug,
         structure_filename="{}.yaml".format(test_slug),
     )
     self.assertRaises(
         NoHeadingFoundInMarkdownFileError,
         curriculum_guide_section_loader.load
     )
 def test_curriculum_guides_curriculum_guide_section_loader_single_section(self):
     test_slug = "single-section"
     curriculum_guide = self.test_data.create_curriculum_guide("1")
     factory = mock.Mock()
     curriculum_guide_section_loader = CurriculumGuideSectionsLoader(
         factory,
         curriculum_guide,
         base_path=self.base_path,
         content_path=test_slug,
         structure_filename="{}.yaml".format(test_slug),
     )
     curriculum_guide_section_loader.load()
     self.assertQuerysetEqual(
         CurriculumGuideSection.objects.all(),
         ["<CurriculumGuideSection: This is the section heading>"]
     )
예제 #5
0
 def create_curriculum_guide_section_loader(self, curriculum_guide,
                                            **kwargs):
     """Create curriculum guide loader."""
     return CurriculumGuideSectionsLoader(self, curriculum_guide, **kwargs)