def test_single_template_exists_for_another_school(self):
     """
     Data api method should raise an NoTemplateExistsForSchool exception if no template exists for school,
     even if there are templates that exist for other schools
     """
     CanvasSchoolTemplate.objects.create(school_id='another-school', template_id=self.template_id)
     with self.assertRaises(NoTemplateExistsForSchool):
         get_default_template_for_school(self.school_id)
Ejemplo n.º 2
0
 def test_single_template_exists_for_another_school(self):
     """
     Data api method should raise an NoTemplateExistsForSchool exception if no template exists for school,
     even if there are templates that exist for other schools
     """
     CanvasSchoolTemplate.objects.create(school_id='another-school',
                                         template_id=self.template_id)
     with self.assertRaises(NoTemplateExistsForSchool):
         get_default_template_for_school(self.school_id)
    def test_multiple_default_templates_exist_for_school(self):
        """
        Data api method should raise a MultipleDefaultTemplatesExistForSchool exception
        if > 1 default templates exist for school
        """
        CanvasSchoolTemplate.objects.create(school_id=self.school_id, template_id=self.template_id)
        CanvasSchoolTemplate.objects.create(school_id=self.school_id, template_id=self.template_id + 1)

        with self.assertRaises(MultipleDefaultTemplatesExistForSchool):
            get_default_template_for_school(self.school_id)
Ejemplo n.º 4
0
    def test_multiple_default_templates_exist_for_school(self):
        """
        Data api method should raise a MultipleDefaultTemplatesExistForSchool exception
        if > 1 default templates exist for school
        """
        CanvasSchoolTemplate.objects.create(school_id=self.school_id,
                                            template_id=self.template_id)
        CanvasSchoolTemplate.objects.create(school_id=self.school_id,
                                            template_id=self.template_id + 1)

        with self.assertRaises(MultipleDefaultTemplatesExistForSchool):
            get_default_template_for_school(self.school_id)
 def test_no_default_template_exists_for_school(self):
     """ Data api method should raise an NoTemplateExistsForSchool exception if no template exists for school """
     with self.assertRaises(NoTemplateExistsForSchool):
         get_default_template_for_school(self.school_id)
 def test_single_template_exists_for_school(self):
     """ Data api method should return the template_id for a given school that has a matching row """
     CanvasSchoolTemplate.objects.create(school_id=self.school_id, template_id=self.template_id)
     res = get_default_template_for_school(self.school_id)
     self.assertEqual(res.template_id, self.template_id)
Ejemplo n.º 7
0
 def test_no_default_template_exists_for_school(self):
     """ Data api method should raise an NoTemplateExistsForSchool exception if no template exists for school """
     with self.assertRaises(NoTemplateExistsForSchool):
         get_default_template_for_school(self.school_id)
Ejemplo n.º 8
0
 def test_single_template_exists_for_school(self):
     """ Data api method should return the template_id for a given school that has a matching row """
     CanvasSchoolTemplate.objects.create(school_id=self.school_id,
                                         template_id=self.template_id)
     res = get_default_template_for_school(self.school_id)
     self.assertEqual(res.template_id, self.template_id)