mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-20 14:29:51 -04:00
Check for unknown permissions
This guards against anyone mispelling or using the wrong words for a permission, which could introduce unexpected or hard to catch errors.
This commit is contained in:
@@ -38,7 +38,7 @@ def test_user_has_permissions_on_endpoint_fail(
|
||||
_test_permissions(
|
||||
client,
|
||||
user,
|
||||
['something'],
|
||||
['send_texts'],
|
||||
'',
|
||||
False)
|
||||
|
||||
@@ -66,7 +66,7 @@ def test_user_has_permissions_or(
|
||||
_test_permissions(
|
||||
client,
|
||||
user,
|
||||
['something', 'manage_users'],
|
||||
['send_texts', 'manage_users'],
|
||||
'',
|
||||
True,
|
||||
any_=True)
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import pytest
|
||||
from app.notify_client.user_api_client import User
|
||||
|
||||
|
||||
@@ -25,3 +26,6 @@ def test_user():
|
||||
# set failed logins to threshold
|
||||
user.failed_login_count = 3
|
||||
assert user.is_locked()
|
||||
|
||||
with pytest.raises(TypeError):
|
||||
user.has_permissions('to_do_bad_things')
|
||||
|
||||
Reference in New Issue
Block a user