moto5.0.24
Published
pip install moto
Package Downloads
Authors
Project URLs
Requires Python
>=3.8
Dependencies
- boto3
>=1.9.201
- botocore
!=1.35.45,!=1.35.46,>=1.14.0
- cryptography
>=35.0.0
- requests
>=2.5
- xmltodict
- werkzeug
!=2.2.0,!=2.2.1,>=0.5
- python-dateutil
<3.0.0,>=2.1
- responses
>=0.15.0
- Jinja2
>=2.10.1
- antlr4-python3-runtime
; extra == "all"
- joserfc
>=0.9.0; extra == "all"
- jsonpath-ng
; extra == "all"
- docker
>=3.0.0; extra == "all"
- graphql-core
; extra == "all"
- PyYAML
>=5.1; extra == "all"
- cfn-lint
>=0.40.0; extra == "all"
- jsonschema
; extra == "all"
- openapi-spec-validator
>=0.5.0; extra == "all"
- pyparsing
>=3.0.7; extra == "all"
- jsondiff
>=1.1.2; extra == "all"
- py-partiql-parser
==0.5.6; extra == "all"
- aws-xray-sdk
!=0.96,>=0.93; extra == "all"
- setuptools
; extra == "all"
- multipart
; extra == "all"
- PyYAML
>=5.1; extra == "apigateway"
- joserfc
>=0.9.0; extra == "apigateway"
- openapi-spec-validator
>=0.5.0; extra == "apigateway"
- PyYAML
>=5.1; extra == "apigatewayv2"
- openapi-spec-validator
>=0.5.0; extra == "apigatewayv2"
- graphql-core
; extra == "appsync"
- docker
>=3.0.0; extra == "awslambda"
- docker
>=3.0.0; extra == "batch"
- joserfc
>=0.9.0; extra == "cloudformation"
- docker
>=3.0.0; extra == "cloudformation"
- graphql-core
; extra == "cloudformation"
- PyYAML
>=5.1; extra == "cloudformation"
- cfn-lint
>=0.40.0; extra == "cloudformation"
- openapi-spec-validator
>=0.5.0; extra == "cloudformation"
- pyparsing
>=3.0.7; extra == "cloudformation"
- jsondiff
>=1.1.2; extra == "cloudformation"
- py-partiql-parser
==0.5.6; extra == "cloudformation"
- aws-xray-sdk
!=0.96,>=0.93; extra == "cloudformation"
- setuptools
; extra == "cloudformation"
- joserfc
>=0.9.0; extra == "cognitoidp"
- docker
>=3.0.0; extra == "dynamodb"
- py-partiql-parser
==0.5.6; extra == "dynamodb"
- docker
>=3.0.0; extra == "dynamodbstreams"
- py-partiql-parser
==0.5.6; extra == "dynamodbstreams"
- jsonpath-ng
; extra == "events"
- pyparsing
>=3.0.7; extra == "glue"
- jsondiff
>=1.1.2; extra == "iotdata"
- antlr4-python3-runtime
; extra == "proxy"
- joserfc
>=0.9.0; extra == "proxy"
- jsonpath-ng
; extra == "proxy"
- docker
>=2.5.1; extra == "proxy"
- graphql-core
; extra == "proxy"
- PyYAML
>=5.1; extra == "proxy"
- cfn-lint
>=0.40.0; extra == "proxy"
- openapi-spec-validator
>=0.5.0; extra == "proxy"
- pyparsing
>=3.0.7; extra == "proxy"
- jsondiff
>=1.1.2; extra == "proxy"
- py-partiql-parser
==0.5.6; extra == "proxy"
- aws-xray-sdk
!=0.96,>=0.93; extra == "proxy"
- setuptools
; extra == "proxy"
- multipart
; extra == "proxy"
- jsonschema
; extra == "quicksight"
- joserfc
>=0.9.0; extra == "resourcegroupstaggingapi"
- docker
>=3.0.0; extra == "resourcegroupstaggingapi"
- graphql-core
; extra == "resourcegroupstaggingapi"
- PyYAML
>=5.1; extra == "resourcegroupstaggingapi"
- cfn-lint
>=0.40.0; extra == "resourcegroupstaggingapi"
- openapi-spec-validator
>=0.5.0; extra == "resourcegroupstaggingapi"
- pyparsing
>=3.0.7; extra == "resourcegroupstaggingapi"
- jsondiff
>=1.1.2; extra == "resourcegroupstaggingapi"
- py-partiql-parser
==0.5.6; extra == "resourcegroupstaggingapi"
- PyYAML
>=5.1; extra == "s3"
- py-partiql-parser
==0.5.6; extra == "s3"
- PyYAML
>=5.1; extra == "s3crc32c"
- py-partiql-parser
==0.5.6; extra == "s3crc32c"
- crc32c
; extra == "s3crc32c"
- antlr4-python3-runtime
; extra == "server"
- joserfc
>=0.9.0; extra == "server"
- jsonpath-ng
; extra == "server"
- docker
>=3.0.0; extra == "server"
- graphql-core
; extra == "server"
- PyYAML
>=5.1; extra == "server"
- cfn-lint
>=0.40.0; extra == "server"
- openapi-spec-validator
>=0.5.0; extra == "server"
- pyparsing
>=3.0.7; extra == "server"
- jsondiff
>=1.1.2; extra == "server"
- py-partiql-parser
==0.5.6; extra == "server"
- aws-xray-sdk
!=0.96,>=0.93; extra == "server"
- setuptools
; extra == "server"
- flask
!=2.2.0,!=2.2.1; extra == "server"
- flask-cors
; extra == "server"
- PyYAML
>=5.1; extra == "ssm"
- antlr4-python3-runtime
; extra == "stepfunctions"
- jsonpath-ng
; extra == "stepfunctions"
- aws-xray-sdk
!=0.96,>=0.93; extra == "xray"
- setuptools
; extra == "xray"
Moto - Mock AWS Services
Install
$ pip install 'moto[ec2,s3,all]'
In a nutshell
Moto is a library that allows your tests to easily mock out AWS Services.
Imagine you have the following python code that you want to test:
import boto3
class MyModel:
def __init__(self, name, value):
self.name = name
self.value = value
def save(self):
s3 = boto3.client("s3", region_name="us-east-1")
s3.put_object(Bucket="mybucket", Key=self.name, Body=self.value)
Take a minute to think how you would have tested that in the past.
Now see how you could test it with Moto:
import boto3
from moto import mock_aws
from mymodule import MyModel
@mock_aws
def test_my_model_save():
conn = boto3.resource("s3", region_name="us-east-1")
# We need to create the bucket since this is all in Moto's 'virtual' AWS account
conn.create_bucket(Bucket="mybucket")
model_instance = MyModel("steve", "is awesome")
model_instance.save()
body = conn.Object("mybucket", "steve").get()["Body"].read().decode("utf-8")
assert body == "is awesome"
With the decorator wrapping the test, all the calls to s3 are automatically mocked out. The mock keeps track of the state of the buckets and keys.
For a full list of which services and features are covered, please see our implementation coverage.
Documentation
The full documentation can be found here:
http://docs.getmoto.org/en/latest/
Financial Contributions
Support this project and its continued development, by sponsoring us!
Click the Sponsor
-button at the top of the page for more information.
Our finances are managed by OpenCollective, which means you have full visibility into all our contributions and expenses: https://opencollective.com/moto
Security contact information
To report a security vulnerability, please use the Tidelift security contact. Tidelift will coordinate the fix and disclosure.