-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[AWS] Fix: Handle NoneType response in is_access_denied_exception (#1046
- Loading branch information
Showing
5 changed files
with
34 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[tool.poetry] | ||
name = "aws" | ||
version = "0.2.41" | ||
version = "0.2.42" | ||
description = "This integration will map all your resources in all the available accounts to your Port entities" | ||
authors = ["Shalev Avhar <[email protected]>", "Erik Zaadi <[email protected]>"] | ||
|
||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from utils.misc import is_access_denied_exception | ||
from typing import Optional, Dict, Any | ||
|
||
|
||
class MockException(Exception): | ||
def __init__(self, response: Optional[Dict[str, Any]]) -> None: | ||
self.response = response | ||
|
||
|
||
def test_access_denied_exception_with_response() -> None: | ||
e = MockException(response={"Error": {"Code": "AccessDenied"}}) | ||
assert is_access_denied_exception(e) | ||
|
||
|
||
def test_access_denied_exception_without_response() -> None: | ||
e = MockException(response=None) | ||
assert not is_access_denied_exception(e) | ||
|
||
|
||
def test_access_denied_exception_with_other_error() -> None: | ||
e = MockException(response={"Error": {"Code": "SomeOtherError"}}) | ||
assert not is_access_denied_exception(e) | ||
|
||
|
||
def test_access_denied_exception_no_response_attribute() -> None: | ||
e = Exception("Test exception") | ||
assert not is_access_denied_exception(e) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters