-
Notifications
You must be signed in to change notification settings - Fork 415
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: update permissions on classes with missing / unclear permissions (…
- Loading branch information
1 parent
9e68876
commit 19026e4
Showing
6 changed files
with
103 additions
and
4 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
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
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 |
---|---|---|
|
@@ -145,3 +145,57 @@ def test_list_organisations_filter_plan( | |
# Then | ||
assert response.status_code == 200 | ||
assert list(response.context_data["organisation_list"]) == [organisation] | ||
|
||
|
||
def test_list_organisations_fails_if_not_staff( | ||
organisation: Organisation, | ||
client: Client, | ||
) -> None: | ||
# Given | ||
user = FFAdminUser.objects.create(email="[email protected]") | ||
client.force_login(user) | ||
|
||
url = reverse("sales_dashboard:index") | ||
|
||
# When | ||
response = client.get(url) | ||
|
||
# Then | ||
assert response.status_code == 302 | ||
assert response.url == "/admin/login/?next=/sales-dashboard/" | ||
|
||
|
||
def test_get_email_usage_fails_if_not_staff( | ||
organisation: Organisation, | ||
client: Client, | ||
) -> None: | ||
# Given | ||
user = FFAdminUser.objects.create(email="[email protected]") | ||
client.force_login(user) | ||
|
||
url = reverse("sales_dashboard:email-usage") | ||
|
||
# When | ||
response = client.get(url) | ||
|
||
# Then | ||
assert response.status_code == 302 | ||
assert response.url == "/admin/login/?next=/sales-dashboard/email-usage/" | ||
|
||
|
||
def test_post_email_usage_fails_if_not_staff( | ||
organisation: Organisation, | ||
client: Client, | ||
) -> None: | ||
# Given | ||
user = FFAdminUser.objects.create(email="[email protected]") | ||
client.force_login(user) | ||
|
||
url = reverse("sales_dashboard:email-usage") | ||
|
||
# When | ||
response = client.post(url) | ||
|
||
# Then | ||
assert response.status_code == 302 | ||
assert response.url == "/admin/login/?next=/sales-dashboard/email-usage/" |