def test_li_with_create_perm_mini_training(self): relation = AuthorizedRelationshipFactory(parent_type=self.education_group_year.education_group_type) relation.child_type.category = MINI_TRAINING relation.child_type.save() result = li_with_create_perm_mini_training(self.context, self.url, "") self.assertHTMLEqual(result, ENABLED_LI.format("link_create_mini_training", self.url, ""))
def test_li_with_create_perm_mini_training_disabled(self): result = li_with_create_perm_mini_training(self.context, self.url, "") msg = pgettext("female", UNAUTHORIZED_TYPE_MSG) % { "child_category": _(MINI_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_mini_training", msg, ""))
def test_li_with_create_perm_mini_training_disabled(self): result = li_with_create_perm_mini_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_tag_case_mini_training_disabled(self): """ This test ensure that as faculty manager, the li tag is disabled for mini training Faculty manager must enter in proposition mode for mini training """ self.context['education_group_year'] = MiniTrainingFactory() result = li_with_create_perm_mini_training(self.context, self.url, "") msg = _("The user has not permission to create a %(category)s.") % {"category": _(MINI_TRAINING)} msg = msg.capitalize() self.assertHTMLEqual(result, DISABLED_LI.format("link_create_mini_training", msg, ""))
def test_li_with_create_perm_mini_training(self): relation = AuthorizedRelationshipFactory( parent_type=self.education_group_year.education_group_type) relation.child_type.category = MINI_TRAINING relation.child_type.save() result = li_with_create_perm_mini_training(self.context, self.url, "") self.assertEqual( result, { 'load_modal': True, 'id_li': 'link_create_mini_training', 'url': self.url, 'title': '', 'class_li': '', 'text': '' })
def test_li_with_create_perm_mini_training_disabled(self): result = li_with_create_perm_mini_training(self.context, self.url, "") msg = pgettext("female", UNAUTHORIZED_TYPE_MSG) % { "child_category": Categories.MINI_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_mini_training', 'url': "#", 'text': '' } )
def test_li_with_create_perm_mini_training(self): """ This test ensure that as faculty manager, the li tag is enable for mini training """ relation = AuthorizedRelationshipFactory( parent_type=self.education_group_year.education_group_type) relation.child_type.category = Categories.MINI_TRAINING.name relation.child_type.save() result = li_with_create_perm_mini_training(self.context, self.url, "") self.assertEqual( result, { 'load_modal': True, 'id_li': 'link_create_mini_training', 'url': self.url, 'title': '', 'class_li': '', 'text': '' })
def test_li_tag_case_mini_training_disabled(self): """ This test ensure that as faculty manager, the li tag is disabled for mini training Faculty manager must enter in proposition mode for mini training """ self.context['education_group_year'] = MiniTrainingFactory() result = li_with_create_perm_mini_training(self.context, self.url, "") msg = _("The user has not permission to create a %(category)s.") % { "category": _(MINI_TRAINING) } msg = msg.capitalize() self.assertEqual( result, { 'load_modal': False, 'title': msg, 'class_li': 'disabled', 'id_li': 'link_create_mini_training', 'url': "#", 'text': '' })