Cleanup querying missing ELB error.

This commit is contained in:
Steve Pulec 2015-12-13 22:41:17 -05:00
commit 5d421dc343
5 changed files with 30 additions and 7 deletions

View file

@ -1,8 +1,10 @@
from __future__ import unicode_literals
import boto
import boto.ec2.autoscale
from boto.ec2.autoscale.launchconfig import LaunchConfiguration
from boto.ec2.autoscale.group import AutoScalingGroup
from boto.ec2.autoscale import Tag
import boto.ec2.elb
import sure # noqa
from moto import mock_autoscaling, mock_ec2, mock_elb
@ -10,8 +12,12 @@ from tests.helpers import requires_boto_gte
@mock_autoscaling
@mock_elb
def test_create_autoscaling_group():
conn = boto.connect_autoscale()
elb_conn = boto.ec2.elb.connect_to_region('us-east-1')
elb_conn.create_load_balancer('test_lb', zones=[], listeners=[(80, 8080, 'http')])
conn = boto.ec2.autoscale.connect_to_region('us-east-1')
config = LaunchConfiguration(
name='tester',
image_id='ami-abcd1234',
@ -19,7 +25,6 @@ def test_create_autoscaling_group():
)
conn.create_launch_configuration(config)
group = AutoScalingGroup(
name='tester_group',
availability_zones=['us-east-1c', 'us-east-1b'],

View file

@ -1,8 +1,9 @@
from __future__ import unicode_literals
import boto.ec2
import boto.ec2.autoscale
import boto.ec2.elb
import sure
from moto import mock_ec2, mock_autoscaling
from moto import mock_ec2, mock_autoscaling, mock_elb
def add_servers_to_region(ami_id, count, region):
@ -46,7 +47,13 @@ def test_add_servers_to_multiple_regions():
@mock_autoscaling
@mock_elb
def test_create_autoscaling_group():
elb_conn = boto.ec2.elb.connect_to_region('us-east-1')
elb_conn.create_load_balancer('us_test_lb', zones=[], listeners=[(80, 8080, 'http')])
elb_conn = boto.ec2.elb.connect_to_region('ap-northeast-1')
elb_conn.create_load_balancer('ap_test_lb', zones=[], listeners=[(80, 8080, 'http')])
us_conn = boto.ec2.autoscale.connect_to_region('us-east-1')
config = boto.ec2.autoscale.LaunchConfiguration(
name='us_tester',

View file

@ -15,6 +15,7 @@ from boto.ec2.elb.policies import (
LBCookieStickinessPolicy,
OtherPolicy,
)
from boto.exception import BotoServerError
import sure # noqa
from moto import mock_elb, mock_ec2
@ -42,6 +43,12 @@ def test_create_load_balancer():
listener2.protocol.should.equal("TCP")
@mock_elb
def test_getting_missing_elb():
conn = boto.connect_elb()
conn.get_all_load_balancers.when.called_with(load_balancer_names='aaa').should.throw(BotoServerError)
@mock_elb
def test_create_elb_in_multiple_region():
zones = ['us-east-1a', 'us-east-1b']