-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3355306
commit f108684
Showing
3 changed files
with
6 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,5 +5,5 @@ | |
|
||
|
||
@register.simple_tag | ||
def can_view_payroll(user): | ||
def can_edit_payroll(user): | ||
return user.is_superuser |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |