Have permissions decorators check user signed in

Rather than force us to write the decorators in a specific order let’s
just have one decorator call the other. This should make fewer lines of
code, and fewer annoying test failures. It also means that the same way
of raising a `401` (through the `current_app` method) is used
everywhere.
This commit is contained in:
Chris Hill-Scott
2019-07-01 15:22:08 +01:00
parent 3da9e84ece
commit b620b677d3
24 changed files with 117 additions and 267 deletions

View File

@@ -1,6 +1,17 @@
import pytest
from app.models.user import User
from app.models.user import AnonymousUser, User
def test_anonymous_user(app_):
assert AnonymousUser().is_authenticated is False
assert AnonymousUser().logged_in_elsewhere() is False
assert AnonymousUser().default_organisation.name is None
assert AnonymousUser().default_organisation.crown is None
assert AnonymousUser().default_organisation.agreement_signed is None
assert AnonymousUser().default_organisation.domains == []
assert AnonymousUser().default_organisation.organisation_type is None
assert AnonymousUser().default_organisation.request_to_go_live_notes is None
def test_user(app_):