Repository: getmoto/moto
Pull request #7656 (2024-05-01 18:27:27)

Update getting_started.rst
The code example is wrong:

    buckets = boto3.client("s3").list_buckets()["Buckets"]
    assert len(result["Buckets"]) == 2

Should be:

    result = boto3.client("s3").list_buckets()
    assert len(result["Buckets"]) == 2

The second line expects to assert against result, and the "Buckets" key should also be accessed in the second line.


Patch:
diff --git a/docs/docs/getting_started.rst b/docs/docs/getting_started.rst
index 5ccb080eb..e0933f88f 100644
--- a/docs/docs/getting_started.rst
+++ b/docs/docs/getting_started.rst
@@ -255,11 +255,11 @@ Here is an example:
 
     @pytest.fixture
     def create_bucket1(aws):
-        boto3.client("s3").create_bucket(Bucket="b1")
+        boto3.client("s3").create_bucket(Bucket="bb1")
 
     @pytest.fixture
     def create_bucket2(aws):
-        boto3.client("s3").create_bucket(Bucket="b2")
+        boto3.client("s3").create_bucket(Bucket="bb2")
 
     def test_s3_directly(aws):
         s3.create_bucket(Bucket="somebucket")
@@ -268,7 +268,7 @@ Here is an example:
         assert len(result["Buckets"]) == 1
 
     def test_bucket_creation(create_bucket1, create_bucket2):
-        buckets = boto3.client("s3").list_buckets()["Buckets"]
+        result = boto3.client("s3").list_buckets()
         assert len(result["Buckets"]) == 2
 
 
diff --git a/moto/ses/responses.py b/moto/ses/responses.py
index 8eba94f50..a3be227fe 100644
--- a/moto/ses/responses.py
+++ b/moto/ses/responses.py
@@ -548,7 +548,7 @@ GET_SEND_STATISTICS = """<GetSendStatisticsResponse xmlns="http://ses.amazonaws.
                 <Rejects>{{ statistics["Rejects"] }}</Rejects>
                 <Bounces>{{ statistics["Bounces"] }}</Bounces>
                 <Complaints>{{ statistics["Complaints"] }}</Complaints>
-                <Timestamp>{{ statistics["Timestamp"].isoformat() }}</Timestamp>
+                <Timestamp>{{ statistics["Timestamp"].strftime('%Y-%m-%dT%H:%M:%S.%fZ') }}</Timestamp>
             </member>
         {% endfor %}
       </SendDataPoints>


Test patch:
diff --git a/other_langs/tests_java/pom.xml b/other_langs/tests_java/pom.xml
index 4c367c91e..dda4165bc 100644
--- a/other_langs/tests_java/pom.xml
+++ b/other_langs/tests_java/pom.xml
@@ -13,8 +13,8 @@
 
   <properties>
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-    <maven.compiler.source>1.8</maven.compiler.source>
-    <maven.compiler.target>1.8</maven.compiler.target>
+    <maven.compiler.source>1.9</maven.compiler.source>
+    <maven.compiler.target>1.9</maven.compiler.target>
   </properties>
 
   <dependencyManagement>
@@ -112,5 +112,15 @@
         </plugin>
       </plugins>
     </pluginManagement>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <configuration>
+          <source>9</source>
+          <target>9</target>
+        </configuration>
+      </plugin>
+    </plugins>
   </build>
 </project>
diff --git a/other_langs/tests_java/src/test/java/moto/tests/SESTest.java b/other_langs/tests_java/src/test/java/moto/tests/SESTest.java
index 6e313cc34..804068f31 100644
--- a/other_langs/tests_java/src/test/java/moto/tests/SESTest.java
+++ b/other_langs/tests_java/src/test/java/moto/tests/SESTest.java
@@ -6,13 +6,15 @@ import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 
 import org.junit.Test;
+import software.amazon.awssdk.services.dynamodb.model.Get;
 import software.amazon.awssdk.services.ses.SesClient;
 import software.amazon.awssdk.services.ses.model.Body;
 import software.amazon.awssdk.services.ses.model.Content;
 import software.amazon.awssdk.services.ses.model.Destination;
 import software.amazon.awssdk.services.ses.model.Message;
 import software.amazon.awssdk.services.ses.model.SendEmailRequest;
-import software.amazon.awssdk.services.ses.model.SendEmailResponse;
+import software.amazon.awssdk.services.ses.model.VerifyEmailAddressRequest;
+import software.amazon.awssdk.services.ses.model.GetSendStatisticsResponse;
 import software.amazon.awssdk.services.ses.model.SesException;
 
 public class SESTest {
@@ -42,4 +44,35 @@ public class SESTest {
             assertEquals(e.awsErrorDetails().errorMessage(), "Email address not verified noreply@thedomain.com");
         }
     }
+
+    @Test
+    public void testGetSendStatistics() {
+        SesClient sesClient = DependencyFactory.sesClient();
+
+        VerifyEmailAddressRequest verifyEmailAddressRequest = VerifyEmailAddressRequest.builder().emailAddress("noreply@thedomain.com").build();
+        sesClient.verifyEmailAddress(verifyEmailAddressRequest);
+
+        Message message = Message
+                .builder()
+                .subject(Content.builder().charset("UTF-8").data("subject").build())
+                .body(Body.builder().text(Content.builder().charset("UTF-8").data("body").build()).build())
+                .build();
+
+        SendEmailRequest request = SendEmailRequest
+                .builder()
+                .source("noreply@thedomain.com")
+                .destination(Destination.builder().toAddresses(List.of("one@one.com")).build())
+                .message(message)
+                .build();
+
+        GetSendStatisticsResponse statisticsBefore = sesClient.getSendStatistics();
+        Long prev = statisticsBefore.sendDataPoints().get(0).deliveryAttempts().longValue();
+
+        sesClient.sendEmail(request);
+
+        GetSendStatisticsResponse statisticsAfter = sesClient.getSendStatistics();
+        Long after = statisticsAfter.sendDataPoints().get(0).deliveryAttempts().longValue();
+
+        assertTrue("Delivery attempts should increase", after > prev);
+    }
 }
diff --git a/tests/test_ses/test_server.py b/tests/test_ses/test_server.py
index dc4433027..d82e0e7e9 100644
--- a/tests/test_ses/test_server.py
+++ b/tests/test_ses/test_server.py
@@ -22,4 +22,4 @@ def test_ses_get_send_statistics():
     # Timestamps must be in ISO 8601 format
     groups = re.search("<Timestamp>(.*)</Timestamp>", res.data.decode("utf-8"))
     timestamp = groups.groups()[0]
-    datetime.strptime(timestamp, "%Y-%m-%dT%H:%M:%S.%f")
+    datetime.strptime(timestamp, "%Y-%m-%dT%H:%M:%S.%fZ")