Simple Moto examples

Moto is a (the?) python AWS mocking package all good python AWS mockers use. The docs are pretty helpful, but personally I like a nice simple example I can copy and paste to start out with, reading is too much effort.

Here's a few I've collected from around the internet. The list is limited to the things I've needed to use so far.




Secrets Manager

@mock_secretsmanager
def test_get_secret_value():
conn = boto3.client("secretsmanager", region_name="us-west-2")

create_secret = conn.create_secret(
Name="java-util-test-password", SecretString="foosecret"
)
result = conn.get_secret_value(SecretId="java-util-test-password")
assert result["SecretString"] == "foosecret"