2023-09-30 07:35:11 +00:00
|
|
|
import os
|
|
|
|
from functools import wraps
|
2023-11-30 15:55:51 +00:00
|
|
|
|
2024-01-07 12:03:33 +00:00
|
|
|
from moto import mock_aws
|
2023-09-30 07:35:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
def ses_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
|
|
|
|
|
2024-01-07 12:03:33 +00:00
|
|
|
If this environment variable is not set, the function runs in a `mock_aws` context.
|
2023-09-30 07:35:11 +00:00
|
|
|
"""
|
|
|
|
|
|
|
|
@wraps(func)
|
|
|
|
def pagination_wrapper():
|
|
|
|
allow_aws_request = (
|
|
|
|
os.environ.get("MOTO_TEST_ALLOW_AWS_REQUEST", "false").lower() == "true"
|
|
|
|
)
|
|
|
|
|
|
|
|
if allow_aws_request:
|
|
|
|
resp = func()
|
|
|
|
else:
|
2024-01-07 12:03:33 +00:00
|
|
|
with mock_aws():
|
2023-09-30 07:35:11 +00:00
|
|
|
resp = func()
|
|
|
|
return resp
|
|
|
|
|
|
|
|
return pagination_wrapper
|