def test_init_obj_dont_match_model(self): luy = LearningUnitYearFactory() expected_exception_message = "The provided obj must be a {}".format( EducationGroupYear.__name__) with self.assertRaisesMessage(AttributeError, expected_exception_message): event_perms.EventPermEducationGroupEdition(obj=luy, raise_exception=False)
def test_is_not_open_for_spec_egy_with_exception_raise(self): egy = TrainingFactory(academic_year=self.current_academic_year) expected_exception_message = str( _("This education group is not editable during this period.")) with self.assertRaisesMessage(PermissionDenied, expected_exception_message): event_perms.EventPermEducationGroupEdition( obj=egy, raise_exception=True).is_open()
def test_init_obj_matches_model(self): egy = TrainingFactory() event_perms.EventPermEducationGroupEdition(obj=egy, raise_exception=False)
def test_is_not_open_other_rules(self): self.assertFalse( event_perms.EventPermEducationGroupEdition().is_open())
def test_is_not_open_for_spec_egy_without_exception_raise(self): egy = TrainingFactory(academic_year=self.current_academic_year) self.assertFalse( event_perms.EventPermEducationGroupEdition( obj=egy, raise_exception=False).is_open())
def test_is_open_for_spec_egy(self): egy = TrainingFactory(academic_year=self.current_academic_year) self.assertTrue( event_perms.EventPermEducationGroupEdition(obj=egy).is_open())