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:
Chris Hill-Scott
2018-01-11 22:36:13 +00:00
parent f2418c171c
commit e573f492db
3 changed files with 14 additions and 2 deletions

View File

@@ -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)

View File

@@ -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')