Add sub-minimal mocking of elasticbeanstalk:create_application()

This commit is contained in:
Niels Laukens 2019-09-03 16:10:32 +02:00
commit 336f50349a
No known key found for this signature in database
GPG key ID: D1397B5A6435A6D8
7 changed files with 181 additions and 5 deletions

View file

@ -1,15 +1,39 @@
import boto3
import sure # noqa
from botocore.exceptions import ClientError
from moto import mock_eb
@mock_eb
def test_application():
def test_create_application():
# Create Elastic Beanstalk Application
eb_client = boto3.client('elasticbeanstalk', region_name='us-east-1')
conn = boto3.client('elasticbeanstalk', region_name='us-east-1')
app = conn.create_application(
ApplicationName="myapp",
)
app['Application']['ApplicationName'].should.equal("myapp")
eb_client.create_application(
@mock_eb
def test_create_application_dup():
conn = boto3.client('elasticbeanstalk', region_name='us-east-1')
conn.create_application(
ApplicationName="myapp",
)
conn.create_application.when.called_with(
ApplicationName="myapp",
).should.throw(ClientError)
@mock_eb
def test_describe_applications():
# Create Elastic Beanstalk Application
conn = boto3.client('elasticbeanstalk', region_name='us-east-1')
conn.create_application(
ApplicationName="myapp",
)
eb_apps = eb_client.describe_applications()
eb_apps['Applications'][0]['ApplicationName'].should.equal("myapp")
apps = conn.describe_applications()
len(apps['Applications']).should.equal(1)
apps['Applications'][0]['ApplicationName'].should.equal('myapp')