Enforce service permissions

This should catch typos more quickly and obviously.
This commit is contained in:
Chris Hill-Scott
2020-06-03 14:54:37 +01:00
parent d846a73438
commit a95d9b5152
2 changed files with 20 additions and 0 deletions

View File

@@ -1,5 +1,7 @@
import uuid
import pytest
from app.models.organisation import Organisation
from app.models.service import Service
from app.models.user import User
@@ -247,3 +249,9 @@ def test_service_without_organisation_doesnt_need_org_api(mocker, service_one):
assert mock_redis_get.called is False
assert mock_get_organisation.called is False
def test_bad_permission_raises(service_one):
with pytest.raises(KeyError) as e:
Service(service_one).has_permission('foo')
assert str(e.value) == "'foo is not a service permission'"