forked from getmoto/moto
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
KMS: encrypt() now validates payloads that are too large (getmoto#7102)
- Loading branch information
Showing
3 changed files
with
54 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 +1,28 @@ | ||
# This file is intentionally left blank. | ||
import os | ||
from functools import wraps | ||
|
||
from moto import mock_kms | ||
|
||
|
||
def kms_aws_verified(func): | ||
""" | ||
Function that is verified to work against AWS. | ||
Can be run against AWS at any time by setting: | ||
MOTO_TEST_ALLOW_AWS_REQUEST=true | ||
If this environment variable is not set, the function runs in a `mock_kms` context. | ||
""" | ||
|
||
@wraps(func) | ||
def pagination_wrapper(): | ||
allow_aws_request = ( | ||
os.environ.get("MOTO_TEST_ALLOW_AWS_REQUEST", "false").lower() == "true" | ||
) | ||
|
||
if allow_aws_request: | ||
return func() | ||
else: | ||
with mock_kms(): | ||
return func() | ||
|
||
return pagination_wrapper |
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