Get standalone server mode working for all tests.
This commit is contained in:
parent
cb28eeefbb
commit
81836b6981
78 changed files with 957 additions and 783 deletions
|
|
@ -5,7 +5,7 @@ from nose.tools import assert_raises
|
|||
|
||||
import boto
|
||||
import boto3
|
||||
from boto.exception import EC2ResponseError, JSONResponseError
|
||||
from boto.exception import EC2ResponseError
|
||||
import six
|
||||
|
||||
import sure # noqa
|
||||
|
|
@ -20,9 +20,9 @@ def test_eip_allocate_classic():
|
|||
"""Allocate/release Classic EIP"""
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
|
||||
with assert_raises(JSONResponseError) as ex:
|
||||
with assert_raises(EC2ResponseError) as ex:
|
||||
standard = conn.allocate_address(dry_run=True)
|
||||
ex.exception.reason.should.equal('DryRunOperation')
|
||||
ex.exception.error_code.should.equal('DryRunOperation')
|
||||
ex.exception.status.should.equal(400)
|
||||
ex.exception.message.should.equal('An error occurred (DryRunOperation) when calling the AllocateAddress operation: Request would have succeeded, but DryRun flag is set')
|
||||
|
||||
|
|
@ -32,9 +32,9 @@ def test_eip_allocate_classic():
|
|||
standard.instance_id.should.be.none
|
||||
standard.domain.should.be.equal("standard")
|
||||
|
||||
with assert_raises(JSONResponseError) as ex:
|
||||
with assert_raises(EC2ResponseError) as ex:
|
||||
standard.release(dry_run=True)
|
||||
ex.exception.reason.should.equal('DryRunOperation')
|
||||
ex.exception.error_code.should.equal('DryRunOperation')
|
||||
ex.exception.status.should.equal(400)
|
||||
ex.exception.message.should.equal('An error occurred (DryRunOperation) when calling the ReleaseAddress operation: Request would have succeeded, but DryRun flag is set')
|
||||
|
||||
|
|
@ -47,9 +47,9 @@ def test_eip_allocate_vpc():
|
|||
"""Allocate/release VPC EIP"""
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
|
||||
with assert_raises(JSONResponseError) as ex:
|
||||
with assert_raises(EC2ResponseError) as ex:
|
||||
vpc = conn.allocate_address(domain="vpc", dry_run=True)
|
||||
ex.exception.reason.should.equal('DryRunOperation')
|
||||
ex.exception.error_code.should.equal('DryRunOperation')
|
||||
ex.exception.status.should.equal(400)
|
||||
ex.exception.message.should.equal('An error occurred (DryRunOperation) when calling the AllocateAddress operation: Request would have succeeded, but DryRun flag is set')
|
||||
|
||||
|
|
@ -89,9 +89,9 @@ def test_eip_associate_classic():
|
|||
cm.exception.status.should.equal(400)
|
||||
cm.exception.request_id.should_not.be.none
|
||||
|
||||
with assert_raises(JSONResponseError) as ex:
|
||||
with assert_raises(EC2ResponseError) as ex:
|
||||
conn.associate_address(instance_id=instance.id, public_ip=eip.public_ip, dry_run=True)
|
||||
ex.exception.reason.should.equal('DryRunOperation')
|
||||
ex.exception.error_code.should.equal('DryRunOperation')
|
||||
ex.exception.status.should.equal(400)
|
||||
ex.exception.message.should.equal('An error occurred (DryRunOperation) when calling the AssociateAddress operation: Request would have succeeded, but DryRun flag is set')
|
||||
|
||||
|
|
@ -99,9 +99,9 @@ def test_eip_associate_classic():
|
|||
eip = conn.get_all_addresses(addresses=[eip.public_ip])[0] # no .update() on address ):
|
||||
eip.instance_id.should.be.equal(instance.id)
|
||||
|
||||
with assert_raises(JSONResponseError) as ex:
|
||||
with assert_raises(EC2ResponseError) as ex:
|
||||
conn.disassociate_address(public_ip=eip.public_ip, dry_run=True)
|
||||
ex.exception.reason.should.equal('DryRunOperation')
|
||||
ex.exception.error_code.should.equal('DryRunOperation')
|
||||
ex.exception.status.should.equal(400)
|
||||
ex.exception.message.should.equal('An error occurred (DryRunOperation) when calling the DisAssociateAddress operation: Request would have succeeded, but DryRun flag is set')
|
||||
|
||||
|
|
@ -139,9 +139,9 @@ def test_eip_associate_vpc():
|
|||
eip.instance_id.should.be.equal(u'')
|
||||
eip.association_id.should.be.none
|
||||
|
||||
with assert_raises(JSONResponseError) as ex:
|
||||
with assert_raises(EC2ResponseError) as ex:
|
||||
eip.release(dry_run=True)
|
||||
ex.exception.reason.should.equal('DryRunOperation')
|
||||
ex.exception.error_code.should.equal('DryRunOperation')
|
||||
ex.exception.status.should.equal(400)
|
||||
ex.exception.message.should.equal('An error occurred (DryRunOperation) when calling the ReleaseAddress operation: Request would have succeeded, but DryRun flag is set')
|
||||
|
||||
|
|
@ -153,9 +153,8 @@ def test_eip_associate_vpc():
|
|||
@mock_ec2
|
||||
def test_eip_boto3_vpc_association():
|
||||
"""Associate EIP to VPC instance in a new subnet with boto3"""
|
||||
session = boto3.session.Session(region_name='us-west-1')
|
||||
service = session.resource('ec2')
|
||||
client = session.client('ec2')
|
||||
service = boto3.resource('ec2', region_name='us-west-1')
|
||||
client = boto3.client('ec2', region_name='us-west-1')
|
||||
vpc_res = client.create_vpc(CidrBlock='10.0.0.0/24')
|
||||
subnet_res = client.create_subnet(
|
||||
VpcId=vpc_res['Vpc']['VpcId'], CidrBlock='10.0.0.0/24')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue