Port test suite from nose to pytest.
This just eliminates all errors on the tests collection. Elimination of failures is left to the next commit.
This commit is contained in:
parent
47dbad291e
commit
77dc60ea97
146 changed files with 1172 additions and 1277 deletions
|
|
@ -1,8 +1,7 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
# Ensure 'assert_raises' context manager support for Python 2.6
|
||||
import tests.backport_assert_raises
|
||||
from nose.tools import assert_raises
|
||||
import pytest
|
||||
|
||||
import boto3
|
||||
import boto
|
||||
|
|
@ -33,7 +32,7 @@ def test_dhcp_options_associate_invalid_dhcp_id():
|
|||
conn = boto.connect_vpc("the_key", "the_secret")
|
||||
vpc = conn.create_vpc("10.0.0.0/16")
|
||||
|
||||
with assert_raises(EC2ResponseError) as cm:
|
||||
with pytest.raises(EC2ResponseError) as cm:
|
||||
conn.associate_dhcp_options("foo", vpc.id)
|
||||
cm.exception.code.should.equal("InvalidDhcpOptionID.NotFound")
|
||||
cm.exception.status.should.equal(400)
|
||||
|
|
@ -46,7 +45,7 @@ def test_dhcp_options_associate_invalid_vpc_id():
|
|||
conn = boto.connect_vpc("the_key", "the_secret")
|
||||
dhcp_options = conn.create_dhcp_options(SAMPLE_DOMAIN_NAME, SAMPLE_NAME_SERVERS)
|
||||
|
||||
with assert_raises(EC2ResponseError) as cm:
|
||||
with pytest.raises(EC2ResponseError) as cm:
|
||||
conn.associate_dhcp_options(dhcp_options.id, "foo")
|
||||
cm.exception.code.should.equal("InvalidVpcID.NotFound")
|
||||
cm.exception.status.should.equal(400)
|
||||
|
|
@ -64,7 +63,7 @@ def test_dhcp_options_delete_with_vpc():
|
|||
rval = conn.associate_dhcp_options(dhcp_options_id, vpc.id)
|
||||
rval.should.be.equal(True)
|
||||
|
||||
with assert_raises(EC2ResponseError) as cm:
|
||||
with pytest.raises(EC2ResponseError) as cm:
|
||||
conn.delete_dhcp_options(dhcp_options_id)
|
||||
cm.exception.code.should.equal("DependencyViolation")
|
||||
cm.exception.status.should.equal(400)
|
||||
|
|
@ -72,7 +71,7 @@ def test_dhcp_options_delete_with_vpc():
|
|||
|
||||
vpc.delete()
|
||||
|
||||
with assert_raises(EC2ResponseError) as cm:
|
||||
with pytest.raises(EC2ResponseError) as cm:
|
||||
conn.get_all_dhcp_options([dhcp_options_id])
|
||||
cm.exception.code.should.equal("InvalidDhcpOptionID.NotFound")
|
||||
cm.exception.status.should.equal(400)
|
||||
|
|
@ -100,13 +99,13 @@ def test_create_dhcp_options_invalid_options():
|
|||
conn = boto.connect_vpc("the_key", "the_secret")
|
||||
servers = ["f", "f", "f", "f", "f"]
|
||||
|
||||
with assert_raises(EC2ResponseError) as cm:
|
||||
with pytest.raises(EC2ResponseError) as cm:
|
||||
conn.create_dhcp_options(ntp_servers=servers)
|
||||
cm.exception.code.should.equal("InvalidParameterValue")
|
||||
cm.exception.status.should.equal(400)
|
||||
cm.exception.request_id.should_not.be.none
|
||||
|
||||
with assert_raises(EC2ResponseError) as cm:
|
||||
with pytest.raises(EC2ResponseError) as cm:
|
||||
conn.create_dhcp_options(netbios_node_type="0")
|
||||
cm.exception.code.should.equal("InvalidParameterValue")
|
||||
cm.exception.status.should.equal(400)
|
||||
|
|
@ -131,7 +130,7 @@ def test_describe_dhcp_options_invalid_id():
|
|||
"""get error on invalid dhcp_option_id lookup"""
|
||||
conn = boto.connect_vpc("the_key", "the_secret")
|
||||
|
||||
with assert_raises(EC2ResponseError) as cm:
|
||||
with pytest.raises(EC2ResponseError) as cm:
|
||||
conn.get_all_dhcp_options(["1"])
|
||||
cm.exception.code.should.equal("InvalidDhcpOptionID.NotFound")
|
||||
cm.exception.status.should.equal(400)
|
||||
|
|
@ -149,7 +148,7 @@ def test_delete_dhcp_options():
|
|||
|
||||
conn.delete_dhcp_options(dhcp_option.id) # .should.be.equal(True)
|
||||
|
||||
with assert_raises(EC2ResponseError) as cm:
|
||||
with pytest.raises(EC2ResponseError) as cm:
|
||||
conn.get_all_dhcp_options([dhcp_option.id])
|
||||
cm.exception.code.should.equal("InvalidDhcpOptionID.NotFound")
|
||||
cm.exception.status.should.equal(400)
|
||||
|
|
@ -162,7 +161,7 @@ def test_delete_dhcp_options_invalid_id():
|
|||
|
||||
conn.create_dhcp_options()
|
||||
|
||||
with assert_raises(EC2ResponseError) as cm:
|
||||
with pytest.raises(EC2ResponseError) as cm:
|
||||
conn.delete_dhcp_options("dopt-abcd1234")
|
||||
cm.exception.code.should.equal("InvalidDhcpOptionID.NotFound")
|
||||
cm.exception.status.should.equal(400)
|
||||
|
|
@ -175,7 +174,7 @@ def test_delete_dhcp_options_malformed_id():
|
|||
|
||||
conn.create_dhcp_options()
|
||||
|
||||
with assert_raises(EC2ResponseError) as cm:
|
||||
with pytest.raises(EC2ResponseError) as cm:
|
||||
conn.delete_dhcp_options("foo-abcd1234")
|
||||
cm.exception.code.should.equal("InvalidDhcpOptionsId.Malformed")
|
||||
cm.exception.status.should.equal(400)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue