Skip to content

Commit 2fafddb

Browse files
committed
Fix for: AttributeError: module 'genesis_core.user_api.iam.exceptions' has no attribute 'InvalidGrantType'.
1 parent aa6f563 commit 2fafddb

3 files changed

Lines changed: 17 additions & 0 deletions

File tree

genesis_core/common/api/middlewares/errors.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ class ErrorsHandlerMiddleware(middlewares.ErrorsHandlerMiddleware):
3232
)
3333
valid_exc = middlewares.ErrorsHandlerMiddleware.valid_exc + (
3434
ra_e.TypeError,
35+
common_exc.CommonValueErrorException,
3536
)
3637

3738
def _construct_error_response(self, req, e):

genesis_core/tests/functional/restapi/iam/test_clients.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,3 +397,12 @@ def test_garbage_refresh_token_with_scope_error(
397397
"scope": "project:859aaa4f-9fcb-4433-8bc0-a84232a1177f",
398398
},
399399
)
400+
401+
def test_invalid_grant_type_error(self, user_api_client, auth_test1_user):
402+
client = user_api_client(auth_test1_user)
403+
404+
with pytest.raises(bazooka_exc.BadRequestError):
405+
client.post(
406+
url=auth_test1_user.get_token_url(endpoint=client.endpoint),
407+
data={"grant_type": "obviously invalid"},
408+
)

genesis_core/user_api/iam/exceptions.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,3 +168,10 @@ class CanNotDeleteIamClient(
168168
"The current user is not permitted to delete IAM client `{uuid}`."
169169
" This action requires the `{rule}`, which has not been granted."
170170
)
171+
172+
173+
class InvalidGrantType(
174+
exceptions.CommonValueErrorException,
175+
iam_exc.InvalidGrantTypeError,
176+
):
177+
__template__ = "Invalid grant type: {grant_type}"

0 commit comments

Comments
 (0)