Testing new version of decorator.
This commit is contained in:
parent
d3df810065
commit
fde721bed7
123 changed files with 2740 additions and 1114 deletions
|
|
@ -9,11 +9,11 @@ from boto.exception import EC2ResponseError, JSONResponseError
|
|||
|
||||
import sure # noqa
|
||||
|
||||
from moto import mock_ec2
|
||||
from moto import mock_emr_deprecated
|
||||
from tests.helpers import requires_boto_gte
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_emr_deprecated
|
||||
def test_ami_create_and_delete():
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
reservation = conn.run_instances('ami-1234abcd')
|
||||
|
|
@ -69,7 +69,7 @@ def test_ami_create_and_delete():
|
|||
|
||||
|
||||
@requires_boto_gte("2.14.0")
|
||||
@mock_ec2
|
||||
@mock_emr_deprecated
|
||||
def test_ami_copy():
|
||||
conn = boto.ec2.connect_to_region("us-west-1")
|
||||
reservation = conn.run_instances('ami-1234abcd')
|
||||
|
|
@ -119,7 +119,7 @@ def test_ami_copy():
|
|||
cm.exception.request_id.should_not.be.none
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_emr_deprecated
|
||||
def test_ami_tagging():
|
||||
conn = boto.connect_vpc('the_key', 'the_secret')
|
||||
reservation = conn.run_instances('ami-1234abcd')
|
||||
|
|
@ -145,7 +145,7 @@ def test_ami_tagging():
|
|||
image.tags["a key"].should.equal("some value")
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_emr_deprecated
|
||||
def test_ami_create_from_missing_instance():
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
args = ["i-abcdefg", "test-ami", "this is a test ami"]
|
||||
|
|
@ -157,7 +157,7 @@ def test_ami_create_from_missing_instance():
|
|||
cm.exception.request_id.should_not.be.none
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_emr_deprecated
|
||||
def test_ami_pulls_attributes_from_instance():
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
reservation = conn.run_instances('ami-1234abcd')
|
||||
|
|
@ -169,7 +169,7 @@ def test_ami_pulls_attributes_from_instance():
|
|||
image.kernel_id.should.equal('test-kernel')
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_emr_deprecated
|
||||
def test_ami_filters():
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
|
||||
|
|
@ -220,7 +220,7 @@ def test_ami_filters():
|
|||
set([ami.id for ami in amis_by_nonpublic]).should.equal(set([imageA.id]))
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_emr_deprecated
|
||||
def test_ami_filtering_via_tag():
|
||||
conn = boto.connect_vpc('the_key', 'the_secret')
|
||||
|
||||
|
|
@ -243,7 +243,7 @@ def test_ami_filtering_via_tag():
|
|||
set([ami.id for ami in amis_by_tagB]).should.equal(set([imageB.id]))
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_emr_deprecated
|
||||
def test_getting_missing_ami():
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
|
||||
|
|
@ -254,7 +254,7 @@ def test_getting_missing_ami():
|
|||
cm.exception.request_id.should_not.be.none
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_emr_deprecated
|
||||
def test_getting_malformed_ami():
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
|
||||
|
|
@ -265,7 +265,7 @@ def test_getting_malformed_ami():
|
|||
cm.exception.request_id.should_not.be.none
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_emr_deprecated
|
||||
def test_ami_attribute_group_permissions():
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
reservation = conn.run_instances('ami-1234abcd')
|
||||
|
|
@ -318,7 +318,7 @@ def test_ami_attribute_group_permissions():
|
|||
conn.modify_image_attribute.when.called_with(**REMOVE_GROUP_ARGS).should_not.throw(EC2ResponseError)
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_emr_deprecated
|
||||
def test_ami_attribute_user_permissions():
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
reservation = conn.run_instances('ami-1234abcd')
|
||||
|
|
@ -383,7 +383,7 @@ def test_ami_attribute_user_permissions():
|
|||
conn.modify_image_attribute.when.called_with(**REMOVE_USERS_ARGS).should_not.throw(EC2ResponseError)
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_emr_deprecated
|
||||
def test_ami_attribute_user_and_group_permissions():
|
||||
"""
|
||||
Boto supports adding/removing both users and groups at the same time.
|
||||
|
|
@ -435,7 +435,7 @@ def test_ami_attribute_user_and_group_permissions():
|
|||
image.is_public.should.equal(False)
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_emr_deprecated
|
||||
def test_ami_attribute_error_cases():
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
reservation = conn.run_instances('ami-1234abcd')
|
||||
|
|
|
|||
|
|
@ -4,10 +4,10 @@ import boto.ec2
|
|||
import boto3
|
||||
import sure # noqa
|
||||
|
||||
from moto import mock_ec2
|
||||
from moto import mock_ec2, mock_ec2_deprecated
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_describe_regions():
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
regions = conn.get_all_regions()
|
||||
|
|
@ -16,7 +16,7 @@ def test_describe_regions():
|
|||
region.endpoint.should.contain(region.name)
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_availability_zones():
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
regions = conn.get_all_regions()
|
||||
|
|
|
|||
|
|
@ -5,10 +5,10 @@ from nose.tools import assert_raises
|
|||
from nose.tools import assert_false
|
||||
from boto.exception import EC2ResponseError
|
||||
|
||||
from moto import mock_ec2
|
||||
from moto import mock_ec2_deprecated
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_create_customer_gateways():
|
||||
conn = boto.connect_vpc('the_key', 'the_secret')
|
||||
|
||||
|
|
@ -19,7 +19,7 @@ def test_create_customer_gateways():
|
|||
customer_gateway.bgp_asn.should.equal(65534)
|
||||
customer_gateway.ip_address.should.equal('205.251.242.54')
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_describe_customer_gateways():
|
||||
conn = boto.connect_vpc('the_key', 'the_secret')
|
||||
customer_gateway = conn.create_customer_gateway('ipsec.1', '205.251.242.54', 65534)
|
||||
|
|
@ -27,7 +27,7 @@ def test_describe_customer_gateways():
|
|||
cgws.should.have.length_of(1)
|
||||
cgws[0].id.should.match(customer_gateway.id)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_delete_customer_gateways():
|
||||
conn = boto.connect_vpc('the_key', 'the_secret')
|
||||
|
||||
|
|
@ -39,7 +39,7 @@ def test_delete_customer_gateways():
|
|||
cgws = conn.get_all_customer_gateways()
|
||||
cgws.should.have.length_of(0)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_delete_customer_gateways_bad_id():
|
||||
conn = boto.connect_vpc('the_key', 'the_secret')
|
||||
with assert_raises(EC2ResponseError) as cm:
|
||||
|
|
|
|||
|
|
@ -9,13 +9,13 @@ from boto.exception import EC2ResponseError
|
|||
|
||||
import sure # noqa
|
||||
|
||||
from moto import mock_ec2
|
||||
from moto import mock_ec2, mock_ec2_deprecated
|
||||
|
||||
SAMPLE_DOMAIN_NAME = u'example.com'
|
||||
SAMPLE_NAME_SERVERS = [u'10.0.0.6', u'10.0.0.7']
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_dhcp_options_associate():
|
||||
""" associate dhcp option """
|
||||
conn = boto.connect_vpc('the_key', 'the_secret')
|
||||
|
|
@ -26,7 +26,7 @@ def test_dhcp_options_associate():
|
|||
rval.should.be.equal(True)
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_dhcp_options_associate_invalid_dhcp_id():
|
||||
""" associate dhcp option bad dhcp options id """
|
||||
conn = boto.connect_vpc('the_key', 'the_secret')
|
||||
|
|
@ -39,7 +39,7 @@ def test_dhcp_options_associate_invalid_dhcp_id():
|
|||
cm.exception.request_id.should_not.be.none
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_dhcp_options_associate_invalid_vpc_id():
|
||||
""" associate dhcp option invalid vpc id """
|
||||
conn = boto.connect_vpc('the_key', 'the_secret')
|
||||
|
|
@ -52,7 +52,7 @@ def test_dhcp_options_associate_invalid_vpc_id():
|
|||
cm.exception.request_id.should_not.be.none
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_dhcp_options_delete_with_vpc():
|
||||
"""Test deletion of dhcp options with vpc"""
|
||||
conn = boto.connect_vpc('the_key', 'the_secret')
|
||||
|
|
@ -78,7 +78,7 @@ def test_dhcp_options_delete_with_vpc():
|
|||
cm.exception.request_id.should_not.be.none
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_create_dhcp_options():
|
||||
"""Create most basic dhcp option"""
|
||||
conn = boto.connect_vpc('the_key', 'the_secret')
|
||||
|
|
@ -89,7 +89,7 @@ def test_create_dhcp_options():
|
|||
dhcp_option.options[u'domain-name-servers'][1].should.be.equal(SAMPLE_NAME_SERVERS[1])
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_create_dhcp_options_invalid_options():
|
||||
"""Create invalid dhcp options"""
|
||||
conn = boto.connect_vpc('the_key', 'the_secret')
|
||||
|
|
@ -108,7 +108,7 @@ def test_create_dhcp_options_invalid_options():
|
|||
cm.exception.request_id.should_not.be.none
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_describe_dhcp_options():
|
||||
"""Test dhcp options lookup by id"""
|
||||
conn = boto.connect_vpc('the_key', 'the_secret')
|
||||
|
|
@ -121,7 +121,7 @@ def test_describe_dhcp_options():
|
|||
dhcp_options.should.be.length_of(1)
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_describe_dhcp_options_invalid_id():
|
||||
"""get error on invalid dhcp_option_id lookup"""
|
||||
conn = boto.connect_vpc('the_key', 'the_secret')
|
||||
|
|
@ -133,7 +133,7 @@ def test_describe_dhcp_options_invalid_id():
|
|||
cm.exception.request_id.should_not.be.none
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_delete_dhcp_options():
|
||||
"""delete dhcp option"""
|
||||
conn = boto.connect_vpc('the_key', 'the_secret')
|
||||
|
|
@ -151,7 +151,7 @@ def test_delete_dhcp_options():
|
|||
cm.exception.request_id.should_not.be.none
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_delete_dhcp_options_invalid_id():
|
||||
conn = boto.connect_vpc('the_key', 'the_secret')
|
||||
|
||||
|
|
@ -164,7 +164,7 @@ def test_delete_dhcp_options_invalid_id():
|
|||
cm.exception.request_id.should_not.be.none
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_delete_dhcp_options_malformed_id():
|
||||
conn = boto.connect_vpc('the_key', 'the_secret')
|
||||
|
||||
|
|
@ -177,7 +177,7 @@ def test_delete_dhcp_options_malformed_id():
|
|||
cm.exception.request_id.should_not.be.none
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_dhcp_tagging():
|
||||
conn = boto.connect_vpc('the_key', 'the_secret')
|
||||
dhcp_option = conn.create_dhcp_options()
|
||||
|
|
@ -194,7 +194,7 @@ def test_dhcp_tagging():
|
|||
dhcp_option.tags["a key"].should.equal("some value")
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_dhcp_options_get_by_tag():
|
||||
conn = boto.connect_vpc('the_key', 'the_secret')
|
||||
|
||||
|
|
@ -230,7 +230,7 @@ def test_dhcp_options_get_by_tag():
|
|||
dhcp_options_sets.should.have.length_of(2)
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_dhcp_options_get_by_id():
|
||||
conn = boto.connect_vpc('the_key', 'the_secret')
|
||||
|
||||
|
|
@ -308,7 +308,7 @@ def test_dhcp_options_get_by_key_filter():
|
|||
dhcp_options_sets.should.have.length_of(3)
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_dhcp_options_get_by_invalid_filter():
|
||||
conn = boto.connect_vpc('the_key', 'the_secret')
|
||||
|
||||
|
|
|
|||
|
|
@ -8,10 +8,10 @@ import boto
|
|||
from boto.exception import EC2ResponseError, JSONResponseError
|
||||
import sure # noqa
|
||||
|
||||
from moto import mock_ec2
|
||||
from moto import mock_ec2_deprecated
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_create_and_delete_volume():
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
volume = conn.create_volume(80, "us-east-1a")
|
||||
|
|
@ -43,7 +43,7 @@ def test_create_and_delete_volume():
|
|||
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_create_encrypted_volume_dryrun():
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
with assert_raises(JSONResponseError) as ex:
|
||||
|
|
@ -53,7 +53,7 @@ def test_create_encrypted_volume_dryrun():
|
|||
ex.exception.message.should.equal('An error occurred (DryRunOperation) when calling the CreateVolume operation: Request would have succeeded, but DryRun flag is set')
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_create_encrypted_volume():
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
conn.create_volume(80, "us-east-1a", encrypted=True)
|
||||
|
|
@ -68,7 +68,7 @@ def test_create_encrypted_volume():
|
|||
all_volumes[0].encrypted.should.be(True)
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_filter_volume_by_id():
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
volume1 = conn.create_volume(80, "us-east-1a")
|
||||
|
|
@ -82,7 +82,7 @@ def test_filter_volume_by_id():
|
|||
vol2.should.have.length_of(2)
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_volume_filters():
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
|
||||
|
|
@ -155,7 +155,7 @@ def test_volume_filters():
|
|||
)
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_volume_attach_and_detach():
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
reservation = conn.run_instances('ami-1234abcd')
|
||||
|
|
@ -209,7 +209,7 @@ def test_volume_attach_and_detach():
|
|||
cm3.exception.request_id.should_not.be.none
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_create_snapshot():
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
volume = conn.create_volume(80, "us-east-1a")
|
||||
|
|
@ -245,7 +245,7 @@ def test_create_snapshot():
|
|||
cm.exception.request_id.should_not.be.none
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_create_encrypted_snapshot():
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
volume = conn.create_volume(80, "us-east-1a", encrypted=True)
|
||||
|
|
@ -260,7 +260,7 @@ def test_create_encrypted_snapshot():
|
|||
snapshots[0].encrypted.should.be(True)
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_filter_snapshot_by_id():
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
volume1 = conn.create_volume(36, "us-east-1a")
|
||||
|
|
@ -281,7 +281,7 @@ def test_filter_snapshot_by_id():
|
|||
s.region.name.should.equal(conn.region.name)
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_snapshot_filters():
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
volume1 = conn.create_volume(20, "us-east-1a", encrypted=False)
|
||||
|
|
@ -322,7 +322,7 @@ def test_snapshot_filters():
|
|||
set([snap.id for snap in snapshots_by_encrypted]).should.equal(set([snapshot3.id]))
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_snapshot_attribute():
|
||||
import copy
|
||||
|
||||
|
|
@ -418,7 +418,7 @@ def test_snapshot_attribute():
|
|||
user_ids=['user']).should.throw(NotImplementedError)
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_create_volume_from_snapshot():
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
volume = conn.create_volume(80, "us-east-1a")
|
||||
|
|
@ -439,7 +439,7 @@ def test_create_volume_from_snapshot():
|
|||
new_volume.snapshot_id.should.equal(snapshot.id)
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_create_volume_from_encrypted_snapshot():
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
volume = conn.create_volume(80, "us-east-1a", encrypted=True)
|
||||
|
|
@ -454,7 +454,7 @@ def test_create_volume_from_encrypted_snapshot():
|
|||
new_volume.encrypted.should.be(True)
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_modify_attribute_blockDeviceMapping():
|
||||
"""
|
||||
Reproduces the missing feature explained at [0], where we want to mock a
|
||||
|
|
@ -481,7 +481,7 @@ def test_modify_attribute_blockDeviceMapping():
|
|||
instance.block_device_mapping['/dev/sda1'].delete_on_termination.should.be(True)
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_volume_tag_escaping():
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
vol = conn.create_volume(10, 'us-east-1a')
|
||||
|
|
|
|||
|
|
@ -10,12 +10,12 @@ import six
|
|||
|
||||
import sure # noqa
|
||||
|
||||
from moto import mock_ec2
|
||||
from moto import mock_ec2, mock_ec2_deprecated
|
||||
|
||||
import logging
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_eip_allocate_classic():
|
||||
"""Allocate/release Classic EIP"""
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
|
|
@ -42,7 +42,7 @@ def test_eip_allocate_classic():
|
|||
standard.should_not.be.within(conn.get_all_addresses())
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_eip_allocate_vpc():
|
||||
"""Allocate/release VPC EIP"""
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
|
|
@ -60,7 +60,7 @@ def test_eip_allocate_vpc():
|
|||
vpc.release()
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_eip_allocate_invalid_domain():
|
||||
"""Allocate EIP invalid domain"""
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
|
|
@ -72,7 +72,7 @@ def test_eip_allocate_invalid_domain():
|
|||
cm.exception.request_id.should_not.be.none
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_eip_associate_classic():
|
||||
"""Associate/Disassociate EIP to classic instance"""
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
|
|
@ -114,7 +114,7 @@ def test_eip_associate_classic():
|
|||
|
||||
instance.terminate()
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_eip_associate_vpc():
|
||||
"""Associate/Disassociate EIP to VPC instance"""
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
|
|
@ -176,7 +176,7 @@ def test_eip_boto3_vpc_association():
|
|||
instance.public_dns_name.should_not.be.none
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_eip_associate_network_interface():
|
||||
"""Associate/Disassociate EIP to NIC"""
|
||||
conn = boto.connect_vpc('the_key', 'the_secret')
|
||||
|
|
@ -204,7 +204,7 @@ def test_eip_associate_network_interface():
|
|||
eip.release()
|
||||
eip = None
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_eip_reassociate():
|
||||
"""reassociate EIP"""
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
|
|
@ -233,7 +233,7 @@ def test_eip_reassociate():
|
|||
instance1.terminate()
|
||||
instance2.terminate()
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_eip_reassociate_nic():
|
||||
"""reassociate EIP"""
|
||||
conn = boto.connect_vpc('the_key', 'the_secret')
|
||||
|
|
@ -261,7 +261,7 @@ def test_eip_reassociate_nic():
|
|||
eip.release()
|
||||
eip = None
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_eip_associate_invalid_args():
|
||||
"""Associate EIP, invalid args """
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
|
|
@ -280,7 +280,7 @@ def test_eip_associate_invalid_args():
|
|||
instance.terminate()
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_eip_disassociate_bogus_association():
|
||||
"""Disassociate bogus EIP"""
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
|
|
@ -291,7 +291,7 @@ def test_eip_disassociate_bogus_association():
|
|||
cm.exception.status.should.equal(400)
|
||||
cm.exception.request_id.should_not.be.none
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_eip_release_bogus_eip():
|
||||
"""Release bogus EIP"""
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
|
|
@ -303,7 +303,7 @@ def test_eip_release_bogus_eip():
|
|||
cm.exception.request_id.should_not.be.none
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_eip_disassociate_arg_error():
|
||||
"""Invalid arguments disassociate address"""
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
|
|
@ -315,7 +315,7 @@ def test_eip_disassociate_arg_error():
|
|||
cm.exception.request_id.should_not.be.none
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_eip_release_arg_error():
|
||||
"""Invalid arguments release address"""
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
|
|
@ -327,7 +327,7 @@ def test_eip_release_arg_error():
|
|||
cm.exception.request_id.should_not.be.none
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_eip_describe():
|
||||
"""Listing of allocated Elastic IP Addresses."""
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
|
|
@ -363,7 +363,7 @@ def test_eip_describe():
|
|||
len(conn.get_all_addresses()).should.be.equal(0)
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_eip_describe_none():
|
||||
"""Error when search for bogus IP"""
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
|
|
|
|||
|
|
@ -10,13 +10,13 @@ import boto.ec2
|
|||
from boto.exception import EC2ResponseError, JSONResponseError
|
||||
import sure # noqa
|
||||
|
||||
from moto import mock_ec2, mock_cloudformation
|
||||
from moto import mock_ec2, mock_cloudformation_deprecated, mock_ec2_deprecated
|
||||
from tests.helpers import requires_boto_gte
|
||||
from tests.test_cloudformation.fixtures import vpc_eni
|
||||
import json
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_elastic_network_interfaces():
|
||||
conn = boto.connect_vpc('the_key', 'the_secret')
|
||||
vpc = conn.create_vpc("10.0.0.0/16")
|
||||
|
|
@ -54,7 +54,7 @@ def test_elastic_network_interfaces():
|
|||
cm.exception.request_id.should_not.be.none
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_elastic_network_interfaces_subnet_validation():
|
||||
conn = boto.connect_vpc('the_key', 'the_secret')
|
||||
|
||||
|
|
@ -65,7 +65,7 @@ def test_elastic_network_interfaces_subnet_validation():
|
|||
cm.exception.request_id.should_not.be.none
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_elastic_network_interfaces_with_private_ip():
|
||||
conn = boto.connect_vpc('the_key', 'the_secret')
|
||||
vpc = conn.create_vpc("10.0.0.0/16")
|
||||
|
|
@ -83,7 +83,7 @@ def test_elastic_network_interfaces_with_private_ip():
|
|||
eni.private_ip_addresses[0].private_ip_address.should.equal(private_ip)
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_elastic_network_interfaces_with_groups():
|
||||
conn = boto.connect_vpc('the_key', 'the_secret')
|
||||
vpc = conn.create_vpc("10.0.0.0/16")
|
||||
|
|
@ -101,7 +101,7 @@ def test_elastic_network_interfaces_with_groups():
|
|||
|
||||
|
||||
@requires_boto_gte("2.12.0")
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_elastic_network_interfaces_modify_attribute():
|
||||
conn = boto.connect_vpc('the_key', 'the_secret')
|
||||
vpc = conn.create_vpc("10.0.0.0/16")
|
||||
|
|
@ -133,7 +133,7 @@ def test_elastic_network_interfaces_modify_attribute():
|
|||
eni.groups[0].id.should.equal(security_group2.id)
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_elastic_network_interfaces_filtering():
|
||||
conn = boto.connect_vpc('the_key', 'the_secret')
|
||||
vpc = conn.create_vpc("10.0.0.0/16")
|
||||
|
|
@ -281,8 +281,8 @@ def test_elastic_network_interfaces_get_by_subnet_id():
|
|||
enis.should.have.length_of(0)
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_cloudformation
|
||||
@mock_ec2_deprecated
|
||||
@mock_cloudformation_deprecated
|
||||
def test_elastic_network_interfaces_cloudformation():
|
||||
template = vpc_eni.template
|
||||
template_json = json.dumps(template)
|
||||
|
|
|
|||
|
|
@ -7,10 +7,10 @@ import boto
|
|||
from boto.exception import EC2ResponseError
|
||||
import sure # noqa
|
||||
|
||||
from moto import mock_ec2
|
||||
from moto import mock_ec2_deprecated
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_console_output():
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
reservation = conn.run_instances('ami-1234abcd')
|
||||
|
|
@ -20,7 +20,7 @@ def test_console_output():
|
|||
output.output.should_not.equal(None)
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_console_output_without_instance():
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ from boto.exception import EC2ResponseError, JSONResponseError
|
|||
from freezegun import freeze_time
|
||||
import sure # noqa
|
||||
|
||||
from moto import mock_ec2
|
||||
from moto import mock_ec2_deprecated
|
||||
from tests.helpers import requires_boto_gte
|
||||
|
||||
|
||||
|
|
@ -23,7 +23,7 @@ def add_servers(ami_id, count):
|
|||
conn.run_instances(ami_id)
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_add_servers():
|
||||
add_servers('ami-1234abcd', 2)
|
||||
|
||||
|
|
@ -37,7 +37,7 @@ def test_add_servers():
|
|||
|
||||
|
||||
@freeze_time("2014-01-01 05:00:00")
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_instance_launch_and_terminate():
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
|
||||
|
|
@ -87,14 +87,14 @@ def test_instance_launch_and_terminate():
|
|||
instance.state.should.equal('terminated')
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_terminate_empty_instances():
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
conn.terminate_instances.when.called_with([]).should.throw(EC2ResponseError)
|
||||
|
||||
|
||||
@freeze_time("2014-01-01 05:00:00")
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_instance_attach_volume():
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
reservation = conn.run_instances('ami-1234abcd')
|
||||
|
|
@ -123,7 +123,7 @@ def test_instance_attach_volume():
|
|||
v.status.should.equal('in-use')
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_get_instances_by_id():
|
||||
conn = boto.connect_ec2()
|
||||
reservation = conn.run_instances('ami-1234abcd', min_count=2)
|
||||
|
|
@ -150,7 +150,7 @@ def test_get_instances_by_id():
|
|||
cm.exception.request_id.should_not.be.none
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_get_instances_filtering_by_state():
|
||||
conn = boto.connect_ec2()
|
||||
reservation = conn.run_instances('ami-1234abcd', min_count=3)
|
||||
|
|
@ -178,7 +178,7 @@ def test_get_instances_filtering_by_state():
|
|||
|
||||
conn.get_all_instances.when.called_with(filters={'not-implemented-filter': 'foobar'}).should.throw(NotImplementedError)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_get_instances_filtering_by_instance_id():
|
||||
conn = boto.connect_ec2()
|
||||
reservation = conn.run_instances('ami-1234abcd', min_count=3)
|
||||
|
|
@ -197,7 +197,7 @@ def test_get_instances_filtering_by_instance_id():
|
|||
reservations.should.have.length_of(0)
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_get_instances_filtering_by_instance_type():
|
||||
conn = boto.connect_ec2()
|
||||
reservation1 = conn.run_instances('ami-1234abcd', instance_type='m1.small')
|
||||
|
|
@ -238,7 +238,7 @@ def test_get_instances_filtering_by_instance_type():
|
|||
#bogus instance-type should return none
|
||||
reservations.should.have.length_of(0)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_get_instances_filtering_by_reason_code():
|
||||
conn = boto.connect_ec2()
|
||||
reservation = conn.run_instances('ami-1234abcd', min_count=3)
|
||||
|
|
@ -257,7 +257,7 @@ def test_get_instances_filtering_by_reason_code():
|
|||
reservations[0].instances[0].id.should.equal(instance3.id)
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_get_instances_filtering_by_source_dest_check():
|
||||
conn = boto.connect_ec2()
|
||||
reservation = conn.run_instances('ami-1234abcd', min_count=2)
|
||||
|
|
@ -274,7 +274,7 @@ def test_get_instances_filtering_by_source_dest_check():
|
|||
source_dest_check_true[0].instances[0].id.should.equal(instance2.id)
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_get_instances_filtering_by_vpc_id():
|
||||
conn = boto.connect_vpc('the_key', 'the_secret')
|
||||
vpc1 = conn.create_vpc("10.0.0.0/16")
|
||||
|
|
@ -298,7 +298,7 @@ def test_get_instances_filtering_by_vpc_id():
|
|||
reservations2[0].instances[0].id.should.equal(instance2.id)
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_get_instances_filtering_by_architecture():
|
||||
conn = boto.connect_ec2()
|
||||
reservation = conn.run_instances('ami-1234abcd', min_count=1)
|
||||
|
|
@ -309,7 +309,7 @@ def test_get_instances_filtering_by_architecture():
|
|||
reservations[0].instances.should.have.length_of(1)
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_get_instances_filtering_by_tag():
|
||||
conn = boto.connect_ec2()
|
||||
reservation = conn.run_instances('ami-1234abcd', min_count=3)
|
||||
|
|
@ -351,7 +351,7 @@ def test_get_instances_filtering_by_tag():
|
|||
reservations[0].instances[1].id.should.equal(instance3.id)
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_get_instances_filtering_by_tag_value():
|
||||
conn = boto.connect_ec2()
|
||||
reservation = conn.run_instances('ami-1234abcd', min_count=3)
|
||||
|
|
@ -388,7 +388,7 @@ def test_get_instances_filtering_by_tag_value():
|
|||
reservations[0].instances[0].id.should.equal(instance1.id)
|
||||
reservations[0].instances[1].id.should.equal(instance3.id)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_get_instances_filtering_by_tag_name():
|
||||
conn = boto.connect_ec2()
|
||||
reservation = conn.run_instances('ami-1234abcd', min_count=3)
|
||||
|
|
@ -418,7 +418,7 @@ def test_get_instances_filtering_by_tag_name():
|
|||
reservations[0].instances[1].id.should.equal(instance2.id)
|
||||
reservations[0].instances[2].id.should.equal(instance3.id)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_instance_start_and_stop():
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
reservation = conn.run_instances('ami-1234abcd', min_count=2)
|
||||
|
|
@ -448,7 +448,7 @@ def test_instance_start_and_stop():
|
|||
started_instances[0].state.should.equal('pending')
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_instance_reboot():
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
reservation = conn.run_instances('ami-1234abcd')
|
||||
|
|
@ -464,7 +464,7 @@ def test_instance_reboot():
|
|||
instance.state.should.equal('pending')
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_instance_attribute_instance_type():
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
reservation = conn.run_instances('ami-1234abcd')
|
||||
|
|
@ -482,7 +482,7 @@ def test_instance_attribute_instance_type():
|
|||
instance_attribute.should.be.a(InstanceAttribute)
|
||||
instance_attribute.get('instanceType').should.equal("m1.small")
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_modify_instance_attribute_security_groups():
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
reservation = conn.run_instances('ami-1234abcd')
|
||||
|
|
@ -506,7 +506,7 @@ def test_modify_instance_attribute_security_groups():
|
|||
any(g.id == sg_id2 for g in group_list).should.be.ok
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_instance_attribute_user_data():
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
reservation = conn.run_instances('ami-1234abcd')
|
||||
|
|
@ -525,7 +525,7 @@ def test_instance_attribute_user_data():
|
|||
instance_attribute.get("userData").should.equal("this is my user data")
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_instance_attribute_source_dest_check():
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
reservation = conn.run_instances('ami-1234abcd')
|
||||
|
|
@ -566,7 +566,7 @@ def test_instance_attribute_source_dest_check():
|
|||
instance_attribute.get("sourceDestCheck").should.equal(True)
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_user_data_with_run_instance():
|
||||
user_data = b"some user data"
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
|
|
@ -580,7 +580,7 @@ def test_user_data_with_run_instance():
|
|||
decoded_user_data.should.equal(b"some user data")
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_run_instance_with_security_group_name():
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
|
||||
|
|
@ -600,7 +600,7 @@ def test_run_instance_with_security_group_name():
|
|||
instance.groups[0].name.should.equal("group1")
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_run_instance_with_security_group_id():
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
group = conn.create_security_group('group1', "some description")
|
||||
|
|
@ -612,7 +612,7 @@ def test_run_instance_with_security_group_id():
|
|||
instance.groups[0].name.should.equal("group1")
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_run_instance_with_instance_type():
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
reservation = conn.run_instances('ami-1234abcd', instance_type="t1.micro")
|
||||
|
|
@ -621,7 +621,7 @@ def test_run_instance_with_instance_type():
|
|||
instance.instance_type.should.equal("t1.micro")
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_run_instance_with_default_placement():
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
reservation = conn.run_instances('ami-1234abcd')
|
||||
|
|
@ -630,7 +630,7 @@ def test_run_instance_with_default_placement():
|
|||
instance.placement.should.equal("us-east-1a")
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_run_instance_with_placement():
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
reservation = conn.run_instances('ami-1234abcd', placement="us-east-1b")
|
||||
|
|
@ -639,7 +639,7 @@ def test_run_instance_with_placement():
|
|||
instance.placement.should.equal("us-east-1b")
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_run_instance_with_subnet():
|
||||
conn = boto.connect_vpc('the_key', 'the_secret')
|
||||
vpc = conn.create_vpc("10.0.0.0/16")
|
||||
|
|
@ -653,7 +653,7 @@ def test_run_instance_with_subnet():
|
|||
all_enis.should.have.length_of(1)
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_run_instance_with_nic_autocreated():
|
||||
conn = boto.connect_vpc('the_key', 'the_secret')
|
||||
vpc = conn.create_vpc("10.0.0.0/16")
|
||||
|
|
@ -686,7 +686,7 @@ def test_run_instance_with_nic_autocreated():
|
|||
eni.private_ip_addresses[0].private_ip_address.should.equal(private_ip)
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_run_instance_with_nic_preexisting():
|
||||
conn = boto.connect_vpc('the_key', 'the_secret')
|
||||
vpc = conn.create_vpc("10.0.0.0/16")
|
||||
|
|
@ -724,7 +724,7 @@ def test_run_instance_with_nic_preexisting():
|
|||
|
||||
|
||||
@requires_boto_gte("2.32.0")
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_instance_with_nic_attach_detach():
|
||||
conn = boto.connect_vpc('the_key', 'the_secret')
|
||||
vpc = conn.create_vpc("10.0.0.0/16")
|
||||
|
|
@ -790,7 +790,7 @@ def test_instance_with_nic_attach_detach():
|
|||
cm.exception.request_id.should_not.be.none
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_ec2_classic_has_public_ip_address():
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
reservation = conn.run_instances('ami-1234abcd', key_name="keypair_name")
|
||||
|
|
@ -802,7 +802,7 @@ def test_ec2_classic_has_public_ip_address():
|
|||
instance.private_dns_name.should.contain(instance.private_ip_address)
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_run_instance_with_keypair():
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
reservation = conn.run_instances('ami-1234abcd', key_name="keypair_name")
|
||||
|
|
@ -811,14 +811,14 @@ def test_run_instance_with_keypair():
|
|||
instance.key_name.should.equal("keypair_name")
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_describe_instance_status_no_instances():
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
all_status = conn.get_all_instance_status()
|
||||
len(all_status).should.equal(0)
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_describe_instance_status_with_instances():
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
conn.run_instances('ami-1234abcd', key_name="keypair_name")
|
||||
|
|
@ -829,7 +829,7 @@ def test_describe_instance_status_with_instances():
|
|||
all_status[0].system_status.status.should.equal('ok')
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_describe_instance_status_with_instance_filter():
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
|
||||
|
|
@ -852,7 +852,7 @@ def test_describe_instance_status_with_instance_filter():
|
|||
cm.exception.request_id.should_not.be.none
|
||||
|
||||
@requires_boto_gte("2.32.0")
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_describe_instance_status_with_non_running_instances():
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
reservation = conn.run_instances('ami-1234abcd', min_count=3)
|
||||
|
|
@ -877,7 +877,7 @@ def test_describe_instance_status_with_non_running_instances():
|
|||
status3 = next((s for s in all_status if s.id == instance3.id), None)
|
||||
status3.state_name.should.equal('running')
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_get_instance_by_security_group():
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
|
||||
|
|
|
|||
|
|
@ -10,14 +10,14 @@ from boto.exception import EC2ResponseError, JSONResponseError
|
|||
|
||||
import sure # noqa
|
||||
|
||||
from moto import mock_ec2
|
||||
from moto import mock_ec2_deprecated
|
||||
|
||||
|
||||
VPC_CIDR="10.0.0.0/16"
|
||||
BAD_VPC="vpc-deadbeef"
|
||||
BAD_IGW="igw-deadbeef"
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_igw_create():
|
||||
""" internet gateway create """
|
||||
conn = boto.connect_vpc('the_key', 'the_secret')
|
||||
|
|
@ -37,7 +37,7 @@ def test_igw_create():
|
|||
igw = conn.get_all_internet_gateways()[0]
|
||||
igw.attachments.should.have.length_of(0)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_igw_attach():
|
||||
""" internet gateway attach """
|
||||
conn = boto.connect_vpc('the_key', 'the_secret')
|
||||
|
|
@ -55,7 +55,7 @@ def test_igw_attach():
|
|||
igw = conn.get_all_internet_gateways()[0]
|
||||
igw.attachments[0].vpc_id.should.be.equal(vpc.id)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_igw_attach_bad_vpc():
|
||||
""" internet gateway fail to attach w/ bad vpc """
|
||||
conn = boto.connect_vpc('the_key', 'the_secret')
|
||||
|
|
@ -67,7 +67,7 @@ def test_igw_attach_bad_vpc():
|
|||
cm.exception.status.should.equal(400)
|
||||
cm.exception.request_id.should_not.be.none
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_igw_attach_twice():
|
||||
""" internet gateway fail to attach twice """
|
||||
conn = boto.connect_vpc('the_key', 'the_secret')
|
||||
|
|
@ -82,7 +82,7 @@ def test_igw_attach_twice():
|
|||
cm.exception.status.should.equal(400)
|
||||
cm.exception.request_id.should_not.be.none
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_igw_detach():
|
||||
""" internet gateway detach"""
|
||||
conn = boto.connect_vpc('the_key', 'the_secret')
|
||||
|
|
@ -100,7 +100,7 @@ def test_igw_detach():
|
|||
igw = conn.get_all_internet_gateways()[0]
|
||||
igw.attachments.should.have.length_of(0)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_igw_detach_wrong_vpc():
|
||||
""" internet gateway fail to detach w/ wrong vpc """
|
||||
conn = boto.connect_vpc('the_key', 'the_secret')
|
||||
|
|
@ -115,7 +115,7 @@ def test_igw_detach_wrong_vpc():
|
|||
cm.exception.status.should.equal(400)
|
||||
cm.exception.request_id.should_not.be.none
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_igw_detach_invalid_vpc():
|
||||
""" internet gateway fail to detach w/ invalid vpc """
|
||||
conn = boto.connect_vpc('the_key', 'the_secret')
|
||||
|
|
@ -129,7 +129,7 @@ def test_igw_detach_invalid_vpc():
|
|||
cm.exception.status.should.equal(400)
|
||||
cm.exception.request_id.should_not.be.none
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_igw_detach_unattached():
|
||||
""" internet gateway fail to detach unattached """
|
||||
conn = boto.connect_vpc('the_key', 'the_secret')
|
||||
|
|
@ -142,7 +142,7 @@ def test_igw_detach_unattached():
|
|||
cm.exception.status.should.equal(400)
|
||||
cm.exception.request_id.should_not.be.none
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_igw_delete():
|
||||
""" internet gateway delete"""
|
||||
conn = boto.connect_vpc('the_key', 'the_secret')
|
||||
|
|
@ -160,7 +160,7 @@ def test_igw_delete():
|
|||
conn.delete_internet_gateway(igw.id)
|
||||
conn.get_all_internet_gateways().should.have.length_of(0)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_igw_delete_attached():
|
||||
""" internet gateway fail to delete attached """
|
||||
conn = boto.connect_vpc('the_key', 'the_secret')
|
||||
|
|
@ -174,7 +174,7 @@ def test_igw_delete_attached():
|
|||
cm.exception.status.should.equal(400)
|
||||
cm.exception.request_id.should_not.be.none
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_igw_desribe():
|
||||
""" internet gateway fetch by id """
|
||||
conn = boto.connect_vpc('the_key', 'the_secret')
|
||||
|
|
@ -182,7 +182,7 @@ def test_igw_desribe():
|
|||
igw_by_search = conn.get_all_internet_gateways([igw.id])[0]
|
||||
igw.id.should.equal(igw_by_search.id)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_igw_desribe_bad_id():
|
||||
""" internet gateway fail to fetch by bad id """
|
||||
conn = boto.connect_vpc('the_key', 'the_secret')
|
||||
|
|
@ -193,7 +193,7 @@ def test_igw_desribe_bad_id():
|
|||
cm.exception.request_id.should_not.be.none
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_igw_filter_by_vpc_id():
|
||||
""" internet gateway filter by vpc id """
|
||||
conn = boto.connect_vpc('the_key', 'the_secret')
|
||||
|
|
@ -208,7 +208,7 @@ def test_igw_filter_by_vpc_id():
|
|||
result[0].id.should.equal(igw1.id)
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_igw_filter_by_tags():
|
||||
""" internet gateway filter by vpc id """
|
||||
conn = boto.connect_vpc('the_key', 'the_secret')
|
||||
|
|
@ -222,7 +222,7 @@ def test_igw_filter_by_tags():
|
|||
result[0].id.should.equal(igw1.id)
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_igw_filter_by_internet_gateway_id():
|
||||
""" internet gateway filter by internet gateway id """
|
||||
conn = boto.connect_vpc('the_key', 'the_secret')
|
||||
|
|
@ -235,7 +235,7 @@ def test_igw_filter_by_internet_gateway_id():
|
|||
result[0].id.should.equal(igw1.id)
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_igw_filter_by_attachment_state():
|
||||
""" internet gateway filter by attachment state """
|
||||
conn = boto.connect_vpc('the_key', 'the_secret')
|
||||
|
|
|
|||
|
|
@ -8,16 +8,16 @@ import six
|
|||
import sure # noqa
|
||||
|
||||
from boto.exception import EC2ResponseError, JSONResponseError
|
||||
from moto import mock_ec2
|
||||
from moto import mock_ec2_deprecated
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_key_pairs_empty():
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
assert len(conn.get_all_key_pairs()) == 0
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_key_pairs_invalid_id():
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
|
||||
|
|
@ -28,7 +28,7 @@ def test_key_pairs_invalid_id():
|
|||
cm.exception.request_id.should_not.be.none
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_key_pairs_create():
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
|
||||
|
|
@ -45,7 +45,7 @@ def test_key_pairs_create():
|
|||
assert kps[0].name == 'foo'
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_key_pairs_create_two():
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
kp = conn.create_key_pair('foo')
|
||||
|
|
@ -60,7 +60,7 @@ def test_key_pairs_create_two():
|
|||
kps[0].name.should.equal('foo')
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_key_pairs_create_exist():
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
kp = conn.create_key_pair('foo')
|
||||
|
|
@ -74,7 +74,7 @@ def test_key_pairs_create_exist():
|
|||
cm.exception.request_id.should_not.be.none
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_key_pairs_delete_no_exist():
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
assert len(conn.get_all_key_pairs()) == 0
|
||||
|
|
@ -82,7 +82,7 @@ def test_key_pairs_delete_no_exist():
|
|||
r.should.be.ok
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_key_pairs_delete_exist():
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
conn.create_key_pair('foo')
|
||||
|
|
@ -98,7 +98,7 @@ def test_key_pairs_delete_exist():
|
|||
assert len(conn.get_all_key_pairs()) == 0
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_key_pairs_import():
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
|
||||
|
|
@ -115,7 +115,7 @@ def test_key_pairs_import():
|
|||
assert kps[0].name == 'foo'
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_key_pairs_import_exist():
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
kp = conn.import_key_pair('foo', b'content')
|
||||
|
|
|
|||
|
|
@ -2,10 +2,10 @@ from __future__ import unicode_literals
|
|||
import boto
|
||||
import sure # noqa
|
||||
|
||||
from moto import mock_ec2
|
||||
from moto import mock_ec2_deprecated
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_default_network_acl_created_with_vpc():
|
||||
conn = boto.connect_vpc('the_key', 'the secret')
|
||||
vpc = conn.create_vpc("10.0.0.0/16")
|
||||
|
|
@ -13,7 +13,7 @@ def test_default_network_acl_created_with_vpc():
|
|||
all_network_acls.should.have.length_of(2)
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_network_acls():
|
||||
conn = boto.connect_vpc('the_key', 'the secret')
|
||||
vpc = conn.create_vpc("10.0.0.0/16")
|
||||
|
|
@ -22,7 +22,7 @@ def test_network_acls():
|
|||
all_network_acls.should.have.length_of(3)
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_new_subnet_associates_with_default_network_acl():
|
||||
conn = boto.connect_vpc('the_key', 'the secret')
|
||||
vpc = conn.get_all_vpcs()[0]
|
||||
|
|
@ -36,7 +36,7 @@ def test_new_subnet_associates_with_default_network_acl():
|
|||
[a.subnet_id for a in acl.associations].should.contain(subnet.id)
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_network_acl_entries():
|
||||
conn = boto.connect_vpc('the_key', 'the secret')
|
||||
vpc = conn.create_vpc("10.0.0.0/16")
|
||||
|
|
@ -62,7 +62,7 @@ def test_network_acl_entries():
|
|||
entries[0].rule_action.should.equal('ALLOW')
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_associate_new_network_acl_with_subnet():
|
||||
conn = boto.connect_vpc('the_key', 'the secret')
|
||||
vpc = conn.create_vpc("10.0.0.0/16")
|
||||
|
|
@ -81,7 +81,7 @@ def test_associate_new_network_acl_with_subnet():
|
|||
test_network_acl.associations[0].subnet_id.should.equal(subnet.id)
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_delete_network_acl():
|
||||
conn = boto.connect_vpc('the_key', 'the secret')
|
||||
vpc = conn.create_vpc("10.0.0.0/16")
|
||||
|
|
@ -101,7 +101,7 @@ def test_delete_network_acl():
|
|||
any(acl.id == network_acl.id for acl in updated_network_acls).shouldnt.be.ok
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_network_acl_tagging():
|
||||
conn = boto.connect_vpc('the_key', 'the secret')
|
||||
vpc = conn.create_vpc("10.0.0.0/16")
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import boto.ec2
|
|||
import boto.ec2.autoscale
|
||||
import boto.ec2.elb
|
||||
import sure
|
||||
from moto import mock_ec2, mock_autoscaling, mock_elb
|
||||
from moto import mock_ec2_deprecated, mock_autoscaling_deprecated, mock_elb_deprecated
|
||||
|
||||
|
||||
def add_servers_to_region(ami_id, count, region):
|
||||
|
|
@ -12,7 +12,7 @@ def add_servers_to_region(ami_id, count, region):
|
|||
conn.run_instances(ami_id)
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_add_servers_to_a_single_region():
|
||||
region = 'ap-northeast-1'
|
||||
add_servers_to_region('ami-1234abcd', 1, region)
|
||||
|
|
@ -27,7 +27,7 @@ def test_add_servers_to_a_single_region():
|
|||
reservations[1].instances[0].image_id.should.equal('ami-5678efgh')
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_add_servers_to_multiple_regions():
|
||||
region1 = 'us-east-1'
|
||||
region2 = 'ap-northeast-1'
|
||||
|
|
@ -46,8 +46,8 @@ def test_add_servers_to_multiple_regions():
|
|||
ap_reservations[0].instances[0].image_id.should.equal('ami-5678efgh')
|
||||
|
||||
|
||||
@mock_autoscaling
|
||||
@mock_elb
|
||||
@mock_autoscaling_deprecated
|
||||
@mock_elb_deprecated
|
||||
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')])
|
||||
|
|
|
|||
|
|
@ -8,11 +8,11 @@ import boto3
|
|||
from boto.exception import EC2ResponseError
|
||||
import sure # noqa
|
||||
|
||||
from moto import mock_ec2
|
||||
from moto import mock_ec2, mock_ec2_deprecated
|
||||
from tests.helpers import requires_boto_gte
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_route_tables_defaults():
|
||||
conn = boto.connect_vpc('the_key', 'the_secret')
|
||||
vpc = conn.create_vpc("10.0.0.0/16")
|
||||
|
|
@ -37,7 +37,7 @@ def test_route_tables_defaults():
|
|||
all_route_tables.should.have.length_of(0)
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_route_tables_additional():
|
||||
conn = boto.connect_vpc('the_key', 'the_secret')
|
||||
vpc = conn.create_vpc("10.0.0.0/16")
|
||||
|
|
@ -77,7 +77,7 @@ def test_route_tables_additional():
|
|||
cm.exception.request_id.should_not.be.none
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_route_tables_filters_standard():
|
||||
conn = boto.connect_vpc('the_key', 'the_secret')
|
||||
|
||||
|
|
@ -115,7 +115,7 @@ def test_route_tables_filters_standard():
|
|||
conn.get_all_route_tables.when.called_with(filters={'not-implemented-filter': 'foobar'}).should.throw(NotImplementedError)
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_route_tables_filters_associations():
|
||||
conn = boto.connect_vpc('the_key', 'the_secret')
|
||||
|
||||
|
|
@ -152,7 +152,7 @@ def test_route_tables_filters_associations():
|
|||
association1_route_tables[0].associations.should.have.length_of(2)
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_route_table_associations():
|
||||
conn = boto.connect_vpc('the_key', 'the_secret')
|
||||
vpc = conn.create_vpc("10.0.0.0/16")
|
||||
|
|
@ -219,7 +219,7 @@ def test_route_table_associations():
|
|||
|
||||
|
||||
@requires_boto_gte("2.16.0")
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_route_table_replace_route_table_association():
|
||||
"""
|
||||
Note: Boto has deprecated replace_route_table_assocation (which returns status)
|
||||
|
|
@ -289,7 +289,7 @@ def test_route_table_replace_route_table_association():
|
|||
cm.exception.request_id.should_not.be.none
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_route_table_get_by_tag():
|
||||
conn = boto.connect_vpc('the_key', 'the_secret')
|
||||
|
||||
|
|
@ -326,7 +326,7 @@ def test_route_table_get_by_tag_boto3():
|
|||
route_tables[0].tags[0].should.equal({'Key': 'Name', 'Value': 'TestRouteTable'})
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_routes_additional():
|
||||
conn = boto.connect_vpc('the_key', 'the_secret')
|
||||
vpc = conn.create_vpc("10.0.0.0/16")
|
||||
|
|
@ -364,7 +364,7 @@ def test_routes_additional():
|
|||
cm.exception.request_id.should_not.be.none
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_routes_replace():
|
||||
conn = boto.connect_vpc('the_key', 'the_secret')
|
||||
vpc = conn.create_vpc("10.0.0.0/16")
|
||||
|
|
@ -412,7 +412,7 @@ def test_routes_replace():
|
|||
|
||||
|
||||
@requires_boto_gte("2.19.0")
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_routes_not_supported():
|
||||
conn = boto.connect_vpc('the_key', 'the_secret')
|
||||
vpc = conn.create_vpc("10.0.0.0/16")
|
||||
|
|
@ -431,7 +431,7 @@ def test_routes_not_supported():
|
|||
|
||||
|
||||
@requires_boto_gte("2.34.0")
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_routes_vpc_peering_connection():
|
||||
conn = boto.connect_vpc('the_key', 'the_secret')
|
||||
vpc = conn.create_vpc("10.0.0.0/16")
|
||||
|
|
@ -458,7 +458,7 @@ def test_routes_vpc_peering_connection():
|
|||
|
||||
|
||||
@requires_boto_gte("2.34.0")
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_routes_vpn_gateway():
|
||||
|
||||
conn = boto.connect_vpc('the_key', 'the_secret')
|
||||
|
|
@ -480,7 +480,7 @@ def test_routes_vpn_gateway():
|
|||
new_route.vpc_peering_connection_id.should.be.none
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_network_acl_tagging():
|
||||
|
||||
conn = boto.connect_vpc('the_key', 'the secret')
|
||||
|
|
|
|||
|
|
@ -12,10 +12,10 @@ from botocore.exceptions import ClientError
|
|||
from boto.exception import EC2ResponseError, JSONResponseError
|
||||
import sure # noqa
|
||||
|
||||
from moto import mock_ec2
|
||||
from moto import mock_ec2, mock_ec2_deprecated
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_create_and_describe_security_group():
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
|
||||
|
|
@ -43,7 +43,7 @@ def test_create_and_describe_security_group():
|
|||
set(group_names).should.equal(set(["default", "test security group"]))
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_create_security_group_without_description_raises_error():
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
|
||||
|
|
@ -54,7 +54,7 @@ def test_create_security_group_without_description_raises_error():
|
|||
cm.exception.request_id.should_not.be.none
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_default_security_group():
|
||||
conn = boto.ec2.connect_to_region('us-east-1')
|
||||
groups = conn.get_all_security_groups()
|
||||
|
|
@ -62,7 +62,7 @@ def test_default_security_group():
|
|||
groups[0].name.should.equal("default")
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_create_and_describe_vpc_security_group():
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
vpc_id = 'vpc-5300000c'
|
||||
|
|
@ -88,7 +88,7 @@ def test_create_and_describe_vpc_security_group():
|
|||
all_groups[0].name.should.equal('test security group')
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_create_two_security_groups_with_same_name_in_different_vpc():
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
vpc_id = 'vpc-5300000c'
|
||||
|
|
@ -105,7 +105,7 @@ def test_create_two_security_groups_with_same_name_in_different_vpc():
|
|||
set(group_names).should.equal(set(["default", "test security group"]))
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_deleting_security_groups():
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
security_group1 = conn.create_security_group('test1', 'test1')
|
||||
|
|
@ -135,7 +135,7 @@ def test_deleting_security_groups():
|
|||
conn.get_all_security_groups().should.have.length_of(2)
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_delete_security_group_in_vpc():
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
vpc_id = "vpc-12345"
|
||||
|
|
@ -145,7 +145,7 @@ def test_delete_security_group_in_vpc():
|
|||
conn.delete_security_group(group_id=security_group1.id)
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_authorize_ip_range_and_revoke():
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
security_group = conn.create_security_group('test', 'test')
|
||||
|
|
@ -216,7 +216,7 @@ def test_authorize_ip_range_and_revoke():
|
|||
egress_security_group.rules_egress.should.have.length_of(1)
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_authorize_other_group_and_revoke():
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
security_group = conn.create_security_group('test', 'test')
|
||||
|
|
@ -269,7 +269,7 @@ def test_authorize_other_group_egress_and_revoke():
|
|||
sg01.ip_permissions_egress.should.have.length_of(1)
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_authorize_group_in_vpc():
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
vpc_id = "vpc-12345"
|
||||
|
|
@ -295,7 +295,7 @@ def test_authorize_group_in_vpc():
|
|||
security_group.rules.should.have.length_of(0)
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_get_all_security_groups():
|
||||
conn = boto.connect_ec2()
|
||||
sg1 = conn.create_security_group(name='test1', description='test1', vpc_id='vpc-mjm05d27')
|
||||
|
|
@ -321,7 +321,7 @@ def test_get_all_security_groups():
|
|||
resp.should.have.length_of(4)
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_authorize_bad_cidr_throws_invalid_parameter_value():
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
security_group = conn.create_security_group('test', 'test')
|
||||
|
|
@ -332,7 +332,7 @@ def test_authorize_bad_cidr_throws_invalid_parameter_value():
|
|||
cm.exception.request_id.should_not.be.none
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_security_group_tagging():
|
||||
conn = boto.connect_vpc()
|
||||
vpc = conn.create_vpc("10.0.0.0/16")
|
||||
|
|
@ -356,7 +356,7 @@ def test_security_group_tagging():
|
|||
group.tags["Test"].should.equal("Tag")
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_security_group_tag_filtering():
|
||||
conn = boto.connect_ec2()
|
||||
sg = conn.create_security_group("test-sg", "Test SG")
|
||||
|
|
@ -366,7 +366,7 @@ def test_security_group_tag_filtering():
|
|||
groups.should.have.length_of(1)
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_authorize_all_protocols_with_no_port_specification():
|
||||
conn = boto.connect_ec2()
|
||||
sg = conn.create_security_group('test', 'test')
|
||||
|
|
@ -379,7 +379,7 @@ def test_authorize_all_protocols_with_no_port_specification():
|
|||
sg.rules[0].to_port.should.equal(None)
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_sec_group_rule_limit():
|
||||
ec2_conn = boto.connect_ec2()
|
||||
sg = ec2_conn.create_security_group('test', 'test')
|
||||
|
|
@ -441,7 +441,7 @@ def test_sec_group_rule_limit():
|
|||
cm.exception.error_code.should.equal('RulesPerSecurityGroupLimitExceeded')
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_sec_group_rule_limit_vpc():
|
||||
ec2_conn = boto.connect_ec2()
|
||||
vpc_conn = boto.connect_vpc()
|
||||
|
|
@ -611,7 +611,7 @@ def test_authorize_and_revoke_in_bulk():
|
|||
for ip_permission in expected_ip_permissions:
|
||||
sg01.ip_permissions_egress.shouldnt.contain(ip_permission)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_get_all_security_groups_filter_with_same_vpc_id():
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
vpc_id = 'vpc-5300000c'
|
||||
|
|
|
|||
|
|
@ -7,12 +7,13 @@ import boto3
|
|||
import sure # noqa
|
||||
from boto.exception import JSONResponseError
|
||||
|
||||
from moto import mock_ec2
|
||||
from moto import mock_ec2, mock_ec2_deprecated
|
||||
from moto.backends import get_model
|
||||
from moto.core.utils import iso_8601_datetime_with_milliseconds
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_request_spot_instances():
|
||||
conn = boto3.client('ec2', 'us-east-1')
|
||||
vpc = conn.create_vpc(CidrBlock="10.0.0.0/8")['Vpc']
|
||||
|
|
@ -73,7 +74,7 @@ def test_request_spot_instances():
|
|||
request.launch_specification.subnet_id.should.equal(subnet_id)
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_request_spot_instances_default_arguments():
|
||||
"""
|
||||
Test that moto set the correct default arguments
|
||||
|
|
@ -106,7 +107,7 @@ def test_request_spot_instances_default_arguments():
|
|||
request.launch_specification.subnet_id.should.equal(None)
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_cancel_spot_instance_request():
|
||||
conn = boto.connect_ec2()
|
||||
|
||||
|
|
@ -130,7 +131,7 @@ def test_cancel_spot_instance_request():
|
|||
requests.should.have.length_of(0)
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_request_spot_instances_fulfilled():
|
||||
"""
|
||||
Test that moto correctly fullfills a spot instance request
|
||||
|
|
@ -156,7 +157,7 @@ def test_request_spot_instances_fulfilled():
|
|||
request.state.should.equal("active")
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_tag_spot_instance_request():
|
||||
"""
|
||||
Test that moto correctly tags a spot instance request
|
||||
|
|
@ -177,7 +178,7 @@ def test_tag_spot_instance_request():
|
|||
tag_dict.should.equal({'tag1': 'value1', 'tag2': 'value2'})
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_get_all_spot_instance_requests_filtering():
|
||||
"""
|
||||
Test that moto correctly filters spot instance requests
|
||||
|
|
@ -211,7 +212,7 @@ def test_get_all_spot_instance_requests_filtering():
|
|||
requests.should.have.length_of(1)
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_request_spot_instances_setting_instance_id():
|
||||
conn = boto.ec2.connect_to_region("us-east-1")
|
||||
request = conn.request_spot_instances(
|
||||
|
|
|
|||
|
|
@ -11,10 +11,10 @@ from botocore.exceptions import ParamValidationError
|
|||
import json
|
||||
import sure # noqa
|
||||
|
||||
from moto import mock_cloudformation, mock_ec2
|
||||
from moto import mock_cloudformation_deprecated, mock_ec2, mock_ec2_deprecated
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_subnets():
|
||||
ec2 = boto.connect_ec2('the_key', 'the_secret')
|
||||
conn = boto.connect_vpc('the_key', 'the_secret')
|
||||
|
|
@ -36,7 +36,7 @@ def test_subnets():
|
|||
cm.exception.request_id.should_not.be.none
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_subnet_create_vpc_validation():
|
||||
conn = boto.connect_vpc('the_key', 'the_secret')
|
||||
|
||||
|
|
@ -47,7 +47,7 @@ def test_subnet_create_vpc_validation():
|
|||
cm.exception.request_id.should_not.be.none
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_subnet_tagging():
|
||||
conn = boto.connect_vpc('the_key', 'the_secret')
|
||||
vpc = conn.create_vpc("10.0.0.0/16")
|
||||
|
|
@ -65,7 +65,7 @@ def test_subnet_tagging():
|
|||
subnet.tags["a key"].should.equal("some value")
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_subnet_should_have_proper_availability_zone_set():
|
||||
conn = boto.vpc.connect_to_region('us-west-1')
|
||||
vpcA = conn.create_vpc("10.0.0.0/16")
|
||||
|
|
@ -87,7 +87,7 @@ def test_default_subnet():
|
|||
subnet.map_public_ip_on_launch.shouldnt.be.ok
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_non_default_subnet():
|
||||
vpc_cli = boto.vpc.connect_to_region('us-west-1')
|
||||
|
||||
|
|
@ -150,7 +150,7 @@ def test_modify_subnet_attribute_validation():
|
|||
client.modify_subnet_attribute(SubnetId=subnet.id, MapPublicIpOnLaunch={'Value': 'invalid'})
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_get_subnets_filtering():
|
||||
ec2 = boto.ec2.connect_to_region('us-west-1')
|
||||
conn = boto.vpc.connect_to_region('us-west-1')
|
||||
|
|
@ -205,8 +205,8 @@ def test_get_subnets_filtering():
|
|||
conn.get_all_subnets.when.called_with(filters={'not-implemented-filter': 'foobar'}).should.throw(NotImplementedError)
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_cloudformation
|
||||
@mock_ec2_deprecated
|
||||
@mock_cloudformation_deprecated
|
||||
def test_subnet_tags_through_cloudformation():
|
||||
vpc_conn = boto.vpc.connect_to_region('us-west-1')
|
||||
vpc = vpc_conn.create_vpc("10.0.0.0/16")
|
||||
|
|
|
|||
|
|
@ -8,11 +8,11 @@ from boto.exception import EC2ResponseError, JSONResponseError
|
|||
from boto.ec2.instance import Reservation
|
||||
import sure # noqa
|
||||
|
||||
from moto import mock_ec2
|
||||
from moto import mock_ec2_deprecated
|
||||
from nose.tools import assert_raises
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_add_tag():
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
reservation = conn.run_instances('ami-1234abcd')
|
||||
|
|
@ -32,7 +32,7 @@ def test_add_tag():
|
|||
existing_instance.tags["a key"].should.equal("some value")
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_remove_tag():
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
reservation = conn.run_instances('ami-1234abcd')
|
||||
|
|
@ -59,7 +59,7 @@ def test_remove_tag():
|
|||
instance.remove_tag("a key", "some value")
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_get_all_tags():
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
reservation = conn.run_instances('ami-1234abcd')
|
||||
|
|
@ -73,7 +73,7 @@ def test_get_all_tags():
|
|||
tag.value.should.equal("some value")
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_get_all_tags_with_special_characters():
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
reservation = conn.run_instances('ami-1234abcd')
|
||||
|
|
@ -87,7 +87,7 @@ def test_get_all_tags_with_special_characters():
|
|||
tag.value.should.equal("some<> value")
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_create_tags():
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
reservation = conn.run_instances('ami-1234abcd')
|
||||
|
|
@ -108,7 +108,7 @@ def test_create_tags():
|
|||
set([tag_dict[key] for key in tag_dict]).should.equal(set([tag.value for tag in tags]))
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_tag_limit_exceeded():
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
reservation = conn.run_instances('ami-1234abcd')
|
||||
|
|
@ -137,7 +137,7 @@ def test_tag_limit_exceeded():
|
|||
tag.value.should.equal("a value")
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_invalid_parameter_tag_null():
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
reservation = conn.run_instances('ami-1234abcd')
|
||||
|
|
@ -150,7 +150,7 @@ def test_invalid_parameter_tag_null():
|
|||
cm.exception.request_id.should_not.be.none
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_invalid_id():
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
with assert_raises(EC2ResponseError) as cm:
|
||||
|
|
@ -166,7 +166,7 @@ def test_invalid_id():
|
|||
cm.exception.request_id.should_not.be.none
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_get_all_tags_resource_id_filter():
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
reservation = conn.run_instances('ami-1234abcd')
|
||||
|
|
@ -193,7 +193,7 @@ def test_get_all_tags_resource_id_filter():
|
|||
tag.value.should.equal("some value")
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_get_all_tags_resource_type_filter():
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
reservation = conn.run_instances('ami-1234abcd')
|
||||
|
|
@ -220,7 +220,7 @@ def test_get_all_tags_resource_type_filter():
|
|||
tag.value.should.equal("some value")
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_get_all_tags_key_filter():
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
reservation = conn.run_instances('ami-1234abcd')
|
||||
|
|
@ -239,7 +239,7 @@ def test_get_all_tags_key_filter():
|
|||
tag.value.should.equal("some value")
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_get_all_tags_value_filter():
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
reservation = conn.run_instances('ami-1234abcd')
|
||||
|
|
@ -283,7 +283,7 @@ def test_get_all_tags_value_filter():
|
|||
tags.should.have.length_of(1)
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_retrieved_instances_must_contain_their_tags():
|
||||
tag_key = 'Tag name'
|
||||
tag_value = 'Tag value'
|
||||
|
|
@ -314,7 +314,7 @@ def test_retrieved_instances_must_contain_their_tags():
|
|||
retrieved_tags[tag_key].should.equal(tag_value)
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_retrieved_volumes_must_contain_their_tags():
|
||||
tag_key = 'Tag name'
|
||||
tag_value = 'Tag value'
|
||||
|
|
@ -337,7 +337,7 @@ def test_retrieved_volumes_must_contain_their_tags():
|
|||
retrieved_tags[tag_key].should.equal(tag_value)
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_retrieved_snapshots_must_contain_their_tags():
|
||||
tag_key = 'Tag name'
|
||||
tag_value = 'Tag value'
|
||||
|
|
@ -359,7 +359,7 @@ def test_retrieved_snapshots_must_contain_their_tags():
|
|||
retrieved_tags[tag_key].should.equal(tag_value)
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_filter_instances_by_wildcard_tags():
|
||||
conn = boto.connect_ec2(aws_access_key_id='the_key', aws_secret_access_key='the_secret')
|
||||
reservation = conn.run_instances('ami-1234abcd')
|
||||
|
|
|
|||
|
|
@ -2,10 +2,10 @@ from __future__ import unicode_literals
|
|||
import boto
|
||||
import sure # noqa
|
||||
|
||||
from moto import mock_ec2
|
||||
from moto import mock_ec2_deprecated
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_virtual_private_gateways():
|
||||
conn = boto.connect_vpc('the_key', 'the_secret')
|
||||
|
||||
|
|
@ -16,7 +16,7 @@ def test_virtual_private_gateways():
|
|||
vpn_gateway.state.should.equal('available')
|
||||
vpn_gateway.availability_zone.should.equal('us-east-1a')
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_describe_vpn_gateway():
|
||||
conn = boto.connect_vpc('the_key', 'the_secret')
|
||||
vpn_gateway = conn.create_vpn_gateway('ipsec.1', 'us-east-1a')
|
||||
|
|
@ -32,7 +32,7 @@ def test_describe_vpn_gateway():
|
|||
vpn_gateway.availability_zone.should.equal('us-east-1a')
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_vpn_gateway_vpc_attachment():
|
||||
conn = boto.connect_vpc('the_key', 'the_secret')
|
||||
vpc = conn.create_vpc("10.0.0.0/16")
|
||||
|
|
@ -50,7 +50,7 @@ def test_vpn_gateway_vpc_attachment():
|
|||
attachments[0].state.should.equal('attached')
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_delete_vpn_gateway():
|
||||
conn = boto.connect_vpc('the_key', 'the_secret')
|
||||
vpn_gateway = conn.create_vpn_gateway('ipsec.1', 'us-east-1a')
|
||||
|
|
@ -60,7 +60,7 @@ def test_delete_vpn_gateway():
|
|||
vgws.should.have.length_of(0)
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_vpn_gateway_tagging():
|
||||
conn = boto.connect_vpc('the_key', 'the_secret')
|
||||
vpn_gateway = conn.create_vpn_gateway('ipsec.1', 'us-east-1a')
|
||||
|
|
@ -76,7 +76,7 @@ def test_vpn_gateway_tagging():
|
|||
vpn_gateway.tags["a key"].should.equal("some value")
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_detach_vpn_gateway():
|
||||
|
||||
conn = boto.connect_vpc('the_key', 'the_secret')
|
||||
|
|
|
|||
|
|
@ -7,12 +7,12 @@ import boto
|
|||
from boto.exception import EC2ResponseError
|
||||
import sure # noqa
|
||||
|
||||
from moto import mock_ec2
|
||||
from moto import mock_ec2_deprecated
|
||||
from tests.helpers import requires_boto_gte
|
||||
|
||||
|
||||
@requires_boto_gte("2.32.0")
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_vpc_peering_connections():
|
||||
conn = boto.connect_vpc('the_key', 'the_secret')
|
||||
vpc = conn.create_vpc("10.0.0.0/16")
|
||||
|
|
@ -25,7 +25,7 @@ def test_vpc_peering_connections():
|
|||
|
||||
|
||||
@requires_boto_gte("2.32.0")
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_vpc_peering_connections_get_all():
|
||||
conn = boto.connect_vpc('the_key', 'the_secret')
|
||||
vpc_pcx = test_vpc_peering_connections()
|
||||
|
|
@ -37,7 +37,7 @@ def test_vpc_peering_connections_get_all():
|
|||
|
||||
|
||||
@requires_boto_gte("2.32.0")
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_vpc_peering_connections_accept():
|
||||
conn = boto.connect_vpc('the_key', 'the_secret')
|
||||
vpc_pcx = test_vpc_peering_connections()
|
||||
|
|
@ -57,7 +57,7 @@ def test_vpc_peering_connections_accept():
|
|||
|
||||
|
||||
@requires_boto_gte("2.32.0")
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_vpc_peering_connections_reject():
|
||||
conn = boto.connect_vpc('the_key', 'the_secret')
|
||||
vpc_pcx = test_vpc_peering_connections()
|
||||
|
|
@ -77,7 +77,7 @@ def test_vpc_peering_connections_reject():
|
|||
|
||||
|
||||
@requires_boto_gte("2.32.1")
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_vpc_peering_connections_delete():
|
||||
conn = boto.connect_vpc('the_key', 'the_secret')
|
||||
vpc_pcx = test_vpc_peering_connections()
|
||||
|
|
|
|||
|
|
@ -8,13 +8,13 @@ import boto
|
|||
from boto.exception import EC2ResponseError
|
||||
import sure # noqa
|
||||
|
||||
from moto import mock_ec2
|
||||
from moto import mock_ec2, mock_ec2_deprecated
|
||||
|
||||
SAMPLE_DOMAIN_NAME = u'example.com'
|
||||
SAMPLE_NAME_SERVERS = [u'10.0.0.6', u'10.0.0.7']
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_vpcs():
|
||||
conn = boto.connect_vpc('the_key', 'the_secret')
|
||||
vpc = conn.create_vpc("10.0.0.0/16")
|
||||
|
|
@ -35,7 +35,7 @@ def test_vpcs():
|
|||
cm.exception.request_id.should_not.be.none
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_vpc_defaults():
|
||||
conn = boto.connect_vpc('the_key', 'the_secret')
|
||||
vpc = conn.create_vpc("10.0.0.0/16")
|
||||
|
|
@ -50,7 +50,7 @@ def test_vpc_defaults():
|
|||
conn.get_all_route_tables().should.have.length_of(1)
|
||||
conn.get_all_security_groups(filters={'vpc-id': [vpc.id]}).should.have.length_of(0)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_vpc_isdefault_filter():
|
||||
conn = boto.connect_vpc('the_key', 'the_secret')
|
||||
vpc = conn.create_vpc("10.0.0.0/16")
|
||||
|
|
@ -59,7 +59,7 @@ def test_vpc_isdefault_filter():
|
|||
conn.get_all_vpcs(filters={'isDefault': 'true'}).should.have.length_of(1)
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_multiple_vpcs_default_filter():
|
||||
conn = boto.connect_vpc('the_key', 'the_secret')
|
||||
conn.create_vpc("10.8.0.0/16")
|
||||
|
|
@ -71,7 +71,7 @@ def test_multiple_vpcs_default_filter():
|
|||
vpc[0].cidr_block.should.equal('172.31.0.0/16')
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_vpc_state_available_filter():
|
||||
conn = boto.connect_vpc('the_key', 'the_secret')
|
||||
vpc = conn.create_vpc("10.0.0.0/16")
|
||||
|
|
@ -80,7 +80,7 @@ def test_vpc_state_available_filter():
|
|||
vpc.delete()
|
||||
conn.get_all_vpcs(filters={'state': 'available'}).should.have.length_of(2)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_vpc_tagging():
|
||||
conn = boto.connect_vpc()
|
||||
vpc = conn.create_vpc("10.0.0.0/16")
|
||||
|
|
@ -96,7 +96,7 @@ def test_vpc_tagging():
|
|||
vpc.tags["a key"].should.equal("some value")
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_vpc_get_by_id():
|
||||
conn = boto.connect_vpc()
|
||||
vpc1 = conn.create_vpc("10.0.0.0/16")
|
||||
|
|
@ -110,7 +110,7 @@ def test_vpc_get_by_id():
|
|||
vpc2.id.should.be.within(vpc_ids)
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_vpc_get_by_cidr_block():
|
||||
conn = boto.connect_vpc()
|
||||
vpc1 = conn.create_vpc("10.0.0.0/16")
|
||||
|
|
@ -124,7 +124,7 @@ def test_vpc_get_by_cidr_block():
|
|||
vpc2.id.should.be.within(vpc_ids)
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_vpc_get_by_dhcp_options_id():
|
||||
conn = boto.connect_vpc()
|
||||
dhcp_options = conn.create_dhcp_options(SAMPLE_DOMAIN_NAME, SAMPLE_NAME_SERVERS)
|
||||
|
|
@ -142,7 +142,7 @@ def test_vpc_get_by_dhcp_options_id():
|
|||
vpc2.id.should.be.within(vpc_ids)
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_vpc_get_by_tag():
|
||||
conn = boto.connect_vpc()
|
||||
vpc1 = conn.create_vpc("10.0.0.0/16")
|
||||
|
|
@ -160,7 +160,7 @@ def test_vpc_get_by_tag():
|
|||
vpc2.id.should.be.within(vpc_ids)
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_vpc_get_by_tag_key_superset():
|
||||
conn = boto.connect_vpc()
|
||||
vpc1 = conn.create_vpc("10.0.0.0/16")
|
||||
|
|
@ -180,7 +180,7 @@ def test_vpc_get_by_tag_key_superset():
|
|||
vpc2.id.should.be.within(vpc_ids)
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_vpc_get_by_tag_key_subset():
|
||||
conn = boto.connect_vpc()
|
||||
vpc1 = conn.create_vpc("10.0.0.0/16")
|
||||
|
|
@ -200,7 +200,7 @@ def test_vpc_get_by_tag_key_subset():
|
|||
vpc2.id.should.be.within(vpc_ids)
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_vpc_get_by_tag_value_superset():
|
||||
conn = boto.connect_vpc()
|
||||
vpc1 = conn.create_vpc("10.0.0.0/16")
|
||||
|
|
@ -220,7 +220,7 @@ def test_vpc_get_by_tag_value_superset():
|
|||
vpc2.id.should.be.within(vpc_ids)
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_vpc_get_by_tag_value_subset():
|
||||
conn = boto.connect_vpc()
|
||||
vpc1 = conn.create_vpc("10.0.0.0/16")
|
||||
|
|
@ -339,7 +339,7 @@ def test_vpc_modify_enable_dns_hostnames():
|
|||
attr = response.get('EnableDnsHostnames')
|
||||
attr.get('Value').should.be.ok
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_vpc_associate_dhcp_options():
|
||||
conn = boto.connect_vpc()
|
||||
dhcp_options = conn.create_dhcp_options(SAMPLE_DOMAIN_NAME, SAMPLE_NAME_SERVERS)
|
||||
|
|
|
|||
|
|
@ -4,10 +4,10 @@ from nose.tools import assert_raises
|
|||
import sure # noqa
|
||||
from boto.exception import EC2ResponseError
|
||||
|
||||
from moto import mock_ec2
|
||||
from moto import mock_ec2_deprecated
|
||||
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_create_vpn_connections():
|
||||
conn = boto.connect_vpc('the_key', 'the_secret')
|
||||
vpn_connection = conn.create_vpn_connection('ipsec.1', 'vgw-0123abcd', 'cgw-0123abcd')
|
||||
|
|
@ -15,7 +15,7 @@ def test_create_vpn_connections():
|
|||
vpn_connection.id.should.match(r'vpn-\w+')
|
||||
vpn_connection.type.should.equal('ipsec.1')
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_delete_vpn_connections():
|
||||
conn = boto.connect_vpc('the_key', 'the_secret')
|
||||
vpn_connection = conn.create_vpn_connection('ipsec.1', 'vgw-0123abcd', 'cgw-0123abcd')
|
||||
|
|
@ -25,13 +25,13 @@ def test_delete_vpn_connections():
|
|||
list_of_vpn_connections = conn.get_all_vpn_connections()
|
||||
list_of_vpn_connections.should.have.length_of(0)
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_delete_vpn_connections_bad_id():
|
||||
conn = boto.connect_vpc('the_key', 'the_secret')
|
||||
with assert_raises(EC2ResponseError):
|
||||
conn.delete_vpn_connection('vpn-0123abcd')
|
||||
|
||||
@mock_ec2
|
||||
@mock_ec2_deprecated
|
||||
def test_describe_vpn_connections():
|
||||
conn = boto.connect_vpc('the_key', 'the_secret')
|
||||
list_of_vpn_connections = conn.get_all_vpn_connections()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue