-
Notifications
You must be signed in to change notification settings - Fork 427
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
helper functions to get error code and message from response (#658)
- Loading branch information
Showing
4 changed files
with
55 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,6 +60,7 @@ cover/ | |
|
||
# PyCharm | ||
.idea/ | ||
build/ | ||
|
||
# Ignore Cache | ||
.cache/ |
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
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,42 @@ | ||
from botocore.exceptions import ClientError | ||
|
||
from pynamodb.exceptions import PutError | ||
|
||
|
||
def test_get_cause_response_code(): | ||
error = PutError( | ||
cause=ClientError( | ||
error_response={ | ||
'Error': { | ||
'Code': 'hello' | ||
} | ||
}, | ||
operation_name='test' | ||
) | ||
) | ||
assert error.cause_response_code == 'hello' | ||
|
||
|
||
def test_get_cause_response_code__no_code(): | ||
error = PutError() | ||
assert error.cause_response_code is None | ||
|
||
|
||
def test_get_cause_response_message(): | ||
error = PutError( | ||
cause=ClientError( | ||
error_response={ | ||
'Error': { | ||
'Message': 'hiya' | ||
} | ||
}, | ||
operation_name='test' | ||
) | ||
) | ||
assert error.cause_response_message == 'hiya' | ||
|
||
|
||
def test_get_cause_response_message__no_message(): | ||
error = PutError() | ||
assert error.cause_response_message is None | ||
|