2019-09-03 12:54:46 +00:00
|
|
|
import boto3
|
2019-09-03 14:10:32 +00:00
|
|
|
import sure # noqa
|
|
|
|
from botocore.exceptions import ClientError
|
|
|
|
|
2019-09-03 12:54:46 +00:00
|
|
|
from moto import mock_eb
|
|
|
|
|
|
|
|
|
|
|
|
@mock_eb
|
2019-09-03 14:10:32 +00:00
|
|
|
def test_create_application():
|
2019-09-03 12:54:46 +00:00
|
|
|
# Create Elastic Beanstalk Application
|
2019-09-03 14:10:32 +00:00
|
|
|
conn = boto3.client('elasticbeanstalk', region_name='us-east-1')
|
|
|
|
app = conn.create_application(
|
|
|
|
ApplicationName="myapp",
|
|
|
|
)
|
|
|
|
app['Application']['ApplicationName'].should.equal("myapp")
|
|
|
|
|
|
|
|
|
|
|
|
@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)
|
2019-09-03 12:54:46 +00:00
|
|
|
|
2019-09-03 14:10:32 +00:00
|
|
|
|
|
|
|
@mock_eb
|
|
|
|
def test_describe_applications():
|
|
|
|
# Create Elastic Beanstalk Application
|
|
|
|
conn = boto3.client('elasticbeanstalk', region_name='us-east-1')
|
|
|
|
conn.create_application(
|
2019-09-03 12:54:46 +00:00
|
|
|
ApplicationName="myapp",
|
|
|
|
)
|
|
|
|
|
2019-09-03 14:10:32 +00:00
|
|
|
apps = conn.describe_applications()
|
|
|
|
len(apps['Applications']).should.equal(1)
|
|
|
|
apps['Applications'][0]['ApplicationName'].should.equal('myapp')
|