def test_tag_detach_education_group_not_permitted(self): self.context['can_change_education_group'] = False self.context['group_to_parent'] = '1' result = link_detach_education_group(self.context) expected_result = CUSTOM_LI_TEMPLATE.format( li_attributes=""" class="disabled" """, a_attributes=""" title="{}" """.format(_("The user has not permission to change education groups.")), text=_('Detach'), ) self.assertHTMLEqual(result, expected_result)
def test_tag_detach_education_group_not_possible(self): self.context['can_change_education_group'] = True self.context['group_to_parent'] = '0' result = link_detach_education_group(self.context) expected_result = CUSTOM_LI_TEMPLATE.format( li_attributes=""" class="disabled" """, a_attributes=""" title=" {}" """.format(_("It is not possible to detach the root element.")), text=_('Detach'), ) self.assertHTMLEqual(result, expected_result)
def test_tag_detach_education_group_permitted_and_possible(self): self.context['can_change_education_group'] = True self.context['group_to_parent'] = '1' result = link_detach_education_group(self.context) expected_result = CUSTOM_LI_TEMPLATE.format( li_attributes="""id="btn_operation_detach_1" """, a_attributes=""" href="#" title="{}" onclick="select()" """.format(_('Detach')), text=_('Detach'), ) self.assertHTMLEqual(result, expected_result)
def test_tag_detach_education_group_not_permitted_nor_possible(self): self.context['can_change_education_group'] = False self.context['group_to_parent'] = '0' result = link_detach_education_group(self.context, "#") expected_result = CUSTOM_LI_TEMPLATE.format( li_attributes=""" class="disabled" """, a_attributes=""" title="{} {}" """.format( _("The user has not permission to change education groups."), _("It is not possible to detach the root element."), ), text=_('Detach'), ) self.maxDiff = None self.assertHTMLEqual(result, expected_result)