From 80ab997010f9f8a2c26272671e6216ad12fac5c3 Mon Sep 17 00:00:00 2001 From: Ben Dalby Date: Thu, 20 Oct 2022 22:21:04 +0100 Subject: [PATCH] Feature/improve SES documentation (#5585) --- docs/docs/services/ses.rst | 2 ++ moto/ses/models.py | 15 +++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/docs/docs/services/ses.rst b/docs/docs/services/ses.rst index 37055f95e..3575957f6 100644 --- a/docs/docs/services/ses.rst +++ b/docs/docs/services/ses.rst @@ -12,6 +12,8 @@ ses === +.. autoclass:: moto.ses.models.SESBackend + |start-h3| Example usage |end-h3| .. sourcecode:: python diff --git a/moto/ses/models.py b/moto/ses/models.py index 24bbb8209..b10bf450a 100644 --- a/moto/ses/models.py +++ b/moto/ses/models.py @@ -119,6 +119,21 @@ def are_all_variables_present(template, template_data): class SESBackend(BaseBackend): + """ + Responsible for mocking calls to SES. + + Sent messages are persisted in the backend. If you need to verify that a message was sent successfully, you can use the internal API to check: + + .. sourcecode:: python + + from moto.core import DEFAULT_ACCOUNT_ID + from moto.ses import ses_backends + ses_backend = ses_backends[DEFAULT_ACCOUNT_ID]["global"] + messages = ses_backend.sent_messages # sent_messages is a List of Message objects + + Note that, as this is an internal API, the exact format may differ per versions. + """ + def __init__(self, region_name, account_id): super().__init__(region_name, account_id) self.addresses = []