Skip to content

Commit

Permalink
Rename
Browse files Browse the repository at this point in the history
  • Loading branch information
CaitBarnard committed Dec 4, 2024
1 parent 3355306 commit f108684
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions core/templates/base_generic.html
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@
</a>
</li>

{% can_view_payroll user as can_view_payroll %}
{% if can_view_payroll %}
{% can_edit_payroll user as can_edit_payroll %}
{% if can_edit_payroll %}
<li class="internal-header__navigation__item">
<a class="internal-header__navigation__item__link {% if request.path|startswith:'/payroll/edit/' %}internal-header__navigation__item__link--active{% endif %}"
href="{% url 'payroll:choose_cost_centre' %}">
Expand Down
2 changes: 1 addition & 1 deletion payroll/templatetags/payroll_permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@


@register.simple_tag
def can_view_payroll(user):
def can_edit_payroll(user):
return user.is_superuser
6 changes: 3 additions & 3 deletions payroll/tests/test_template_tags.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
from django.contrib.auth import get_user_model
from django.test import TestCase

from payroll.templatetags.payroll_permissions import can_view_payroll
from payroll.templatetags.payroll_permissions import can_edit_payroll


class ViewPayrollTest(TestCase):
def test_can_edit_payroll_when_superuser(self):
test_user, _ = get_user_model().objects.get_or_create(is_superuser=True)

assert can_view_payroll(test_user)
assert can_edit_payroll(test_user)

def test_cannot_edit_payroll_when_not_superuser(self):
test_user, _ = get_user_model().objects.get_or_create()

assert not can_view_payroll(test_user)
assert not can_edit_payroll(test_user)

0 comments on commit f108684

Please sign in to comment.