API - init resource protector (that also handles current authentication)
This commit is contained in:
@ -147,6 +147,18 @@ class ApiTestCaseMixin(RandomMixin):
|
||||
error='invalid_request',
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def assert_invalid_token(response: TestResponse) -> Dict:
|
||||
return assert_oauth_errored_response(
|
||||
response,
|
||||
401,
|
||||
error='invalid_token',
|
||||
error_description=(
|
||||
'The access token provided is expired, revoked, malformed, '
|
||||
'or invalid for other reasons.'
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
class CallArgsMixin:
|
||||
@staticmethod
|
||||
|
@ -477,7 +477,7 @@ class TestUserProfile(ApiTestCaseMixin):
|
||||
'/api/auth/profile', headers=dict(Authorization='Bearer invalid')
|
||||
)
|
||||
|
||||
self.assert_401(response, 'invalid token, please log in again')
|
||||
self.assert_invalid_token(response)
|
||||
|
||||
def test_it_returns_user(self, app: Flask, user_1: User) -> None:
|
||||
client, auth_token = self.get_test_client_and_auth_token(
|
||||
|
Reference in New Issue
Block a user