Finish porting from nose to pytest.
This commit is contained in:
parent
77dc60ea97
commit
ea489bce6c
72 changed files with 1289 additions and 1280 deletions
|
|
@ -1,6 +1,6 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
# Ensure 'assert_raises' context manager support for Python 2.6
|
||||
# Ensure 'pytest.raises' context manager support for Python 2.6
|
||||
import pytest
|
||||
|
||||
import boto3
|
||||
|
|
@ -31,9 +31,9 @@ def test_subnets():
|
|||
|
||||
with pytest.raises(EC2ResponseError) as cm:
|
||||
conn.delete_subnet(subnet.id)
|
||||
cm.exception.code.should.equal("InvalidSubnetID.NotFound")
|
||||
cm.exception.status.should.equal(400)
|
||||
cm.exception.request_id.should_not.be.none
|
||||
cm.value.code.should.equal("InvalidSubnetID.NotFound")
|
||||
cm.value.status.should.equal(400)
|
||||
cm.value.request_id.should_not.be.none
|
||||
|
||||
|
||||
@mock_ec2_deprecated
|
||||
|
|
@ -42,9 +42,9 @@ def test_subnet_create_vpc_validation():
|
|||
|
||||
with pytest.raises(EC2ResponseError) as cm:
|
||||
conn.create_subnet("vpc-abcd1234", "10.0.0.0/18")
|
||||
cm.exception.code.should.equal("InvalidVpcID.NotFound")
|
||||
cm.exception.status.should.equal(400)
|
||||
cm.exception.request_id.should_not.be.none
|
||||
cm.value.code.should.equal("InvalidVpcID.NotFound")
|
||||
cm.value.status.should.equal(400)
|
||||
cm.value.request_id.should_not.be.none
|
||||
|
||||
|
||||
@mock_ec2_deprecated
|
||||
|
|
@ -229,9 +229,9 @@ def test_subnet_get_by_id():
|
|||
|
||||
with pytest.raises(EC2ResponseError) as cm:
|
||||
conn.get_all_subnets(subnet_ids=["subnet-does_not_exist"])
|
||||
cm.exception.code.should.equal("InvalidSubnetID.NotFound")
|
||||
cm.exception.status.should.equal(400)
|
||||
cm.exception.request_id.should_not.be.none
|
||||
cm.value.code.should.equal("InvalidSubnetID.NotFound")
|
||||
cm.value.status.should.equal(400)
|
||||
cm.value.request_id.should_not.be.none
|
||||
|
||||
|
||||
@mock_ec2_deprecated
|
||||
|
|
@ -391,7 +391,7 @@ def test_create_subnet_with_invalid_availability_zone():
|
|||
CidrBlock="10.0.0.0/24",
|
||||
AvailabilityZone=subnet_availability_zone,
|
||||
)
|
||||
assert str(ex.exception).startswith(
|
||||
assert str(ex.value).startswith(
|
||||
"An error occurred (InvalidParameterValue) when calling the CreateSubnet "
|
||||
"operation: Value ({}) for parameter availabilityZone is invalid. Subnets can currently only be created in the following availability zones: ".format(
|
||||
subnet_availability_zone
|
||||
|
|
@ -410,7 +410,7 @@ def test_create_subnet_with_invalid_cidr_range():
|
|||
subnet_cidr_block = "10.1.0.0/20"
|
||||
with pytest.raises(ClientError) as ex:
|
||||
subnet = ec2.create_subnet(VpcId=vpc.id, CidrBlock=subnet_cidr_block)
|
||||
str(ex.exception).should.equal(
|
||||
str(ex.value).should.equal(
|
||||
"An error occurred (InvalidSubnet.Range) when calling the CreateSubnet "
|
||||
"operation: The CIDR '{}' is invalid.".format(subnet_cidr_block)
|
||||
)
|
||||
|
|
@ -445,7 +445,7 @@ def test_create_subnet_with_invalid_cidr_block_parameter():
|
|||
subnet_cidr_block = "1000.1.0.0/20"
|
||||
with pytest.raises(ClientError) as ex:
|
||||
subnet = ec2.create_subnet(VpcId=vpc.id, CidrBlock=subnet_cidr_block)
|
||||
str(ex.exception).should.equal(
|
||||
str(ex.value).should.equal(
|
||||
"An error occurred (InvalidParameterValue) when calling the CreateSubnet "
|
||||
"operation: Value ({}) for parameter cidrBlock is invalid. This is not a valid CIDR block.".format(
|
||||
subnet_cidr_block
|
||||
|
|
@ -505,7 +505,7 @@ def test_create_subnets_with_overlapping_cidr_blocks():
|
|||
with pytest.raises(ClientError) as ex:
|
||||
subnet1 = ec2.create_subnet(VpcId=vpc.id, CidrBlock=subnet_cidr_block)
|
||||
subnet2 = ec2.create_subnet(VpcId=vpc.id, CidrBlock=subnet_cidr_block)
|
||||
str(ex.exception).should.equal(
|
||||
str(ex.value).should.equal(
|
||||
"An error occurred (InvalidSubnet.Conflict) when calling the CreateSubnet "
|
||||
"operation: The CIDR '{}' conflicts with another subnet".format(
|
||||
subnet_cidr_block
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue