def test_li_with_create_perm_training(self): relation = AuthorizedRelationshipFactory(parent_type=self.education_group_year.education_group_type) relation.child_type.category = TRAINING relation.child_type.save() result = li_with_create_perm_training(self.context, self.url, "") self.assertHTMLEqual(result, ENABLED_LI.format("link_create_training", self.url, ""))
def test_li_tag_case_training_disabled(self): """ This test ensure that as faculty manager, the li tag is disabled for training Faculty manager must enter in proposition mode for training """ self.context['education_group_year'] = TrainingFactory() result = li_with_create_perm_training(self.context, self.url, "") msg = _("The user has not permission to create a %(category)s.") % {"category": _(TRAINING)} msg = msg.capitalize() self.assertHTMLEqual(result, DISABLED_LI.format("link_create_training", msg, ""))
def test_li_with_create_perm_training_disabled(self): result = li_with_create_perm_training(self.context, self.url, "") msg = pgettext("female", UNAUTHORIZED_TYPE_MSG) % { "child_category": _(TRAINING), "category": _(self.education_group_year.education_group_type.category), "type": self.education_group_year.education_group_type.name } msg = msg.capitalize() self.assertHTMLEqual(result, DISABLED_LI.format("link_create_training", msg, ""))
def test_li_with_create_perm_training_disabled(self): result = li_with_create_perm_training(self.context, self.url, "") msg = UNAUTHORIZED_TYPE_MSG % { "category": _( self.education_group_year.education_group_type.category), "type": self.education_group_year.education_group_type.name } self.assertHTMLEqual(result, DISABLED_LI.format("link_create", msg, ""))
def test_li_with_create_perm_training(self): relation = AuthorizedRelationshipFactory( parent_type=self.education_group_year.education_group_type) relation.child_type.category = TRAINING relation.child_type.save() result = li_with_create_perm_training(self.context, self.url, "") self.assertEqual( result, { 'load_modal': True, 'id_li': 'link_create_training', 'url': self.url, 'title': '', 'class_li': '', 'text': '' })
def test_li_with_create_perm_training_disabled(self): result = li_with_create_perm_training(self.context, self.url, "") msg = pgettext("female", UNAUTHORIZED_TYPE_MSG) % { "child_category": Categories.TRAINING.value, "category": self.education_group_year.education_group_type.get_category_display(), "type": self.education_group_year.education_group_type.get_name_display() } msg = msg.capitalize() self.assertEqual( result, { 'load_modal': False, 'title': msg, 'class_li': 'disabled', 'id_li': 'link_create_training', 'url': "#", 'text': '' } )
def test_li_tag_case_training_disabled(self): """ This test ensure that as faculty manager, the li tag is disabled for training Faculty manager must enter in proposition mode for training """ self.context['education_group_year'] = TrainingFactory() result = li_with_create_perm_training(self.context, self.url, "") msg = _("The user has not permission to create a %(category)s.") % { "category": _(TRAINING) } msg = msg.capitalize() self.assertEqual( result, { 'load_modal': False, 'title': msg, 'class_li': 'disabled', 'id_li': 'link_create_training', 'url': "#", 'text': '' })