API - add route to get access token

This commit is contained in:
Sam
2022-05-27 14:08:07 +02:00
parent 249c975810
commit 64b813a44b
4 changed files with 199 additions and 2 deletions

View File

@@ -6,7 +6,10 @@ from flask import Flask
from flask.testing import FlaskClient
from werkzeug.test import TestResponse
from .custom_asserts import assert_errored_response
from .custom_asserts import (
assert_errored_response,
assert_oauth_errored_response,
)
from .utils import random_email, random_string
@@ -122,6 +125,28 @@ class ApiTestCaseMixin(RandomMixin):
response, 500, error_message=error_message, status=status
)
@staticmethod
def assert_unsupported_grant_type(response: TestResponse) -> Dict:
return assert_oauth_errored_response(
response, 400, error='unsupported_grant_type'
)
@staticmethod
def assert_invalid_client(response: TestResponse) -> Dict:
return assert_oauth_errored_response(
response,
400,
error='invalid_client',
)
@staticmethod
def assert_invalid_request(response: TestResponse) -> Dict:
return assert_oauth_errored_response(
response,
400,
error='invalid_request',
)
class CallArgsMixin:
@staticmethod