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:
Matěj Cepl 2020-10-06 07:54:49 +02:00
commit 77dc60ea97
146 changed files with 1172 additions and 1277 deletions

View file

@ -6,7 +6,7 @@ import boto
import boto3
import sure # noqa
from nose.tools import assert_raises
import pytest
from boto.exception import BotoServerError
from botocore.exceptions import ClientError
from moto import mock_iam, mock_iam_deprecated
@ -29,7 +29,7 @@ MOCK_POLICY = """
def test_create_group():
conn = boto.connect_iam()
conn.create_group("my-group")
with assert_raises(BotoServerError):
with pytest.raises(BotoServerError):
conn.create_group("my-group")
@ -38,7 +38,7 @@ def test_get_group():
conn = boto.connect_iam()
conn.create_group("my-group")
conn.get_group("my-group")
with assert_raises(BotoServerError):
with pytest.raises(BotoServerError):
conn.get_group("not-group")
@ -77,10 +77,10 @@ def test_get_all_groups():
@mock_iam_deprecated()
def test_add_user_to_group():
conn = boto.connect_iam()
with assert_raises(BotoServerError):
with pytest.raises(BotoServerError):
conn.add_user_to_group("my-group", "my-user")
conn.create_group("my-group")
with assert_raises(BotoServerError):
with pytest.raises(BotoServerError):
conn.add_user_to_group("my-group", "my-user")
conn.create_user("my-user")
conn.add_user_to_group("my-group", "my-user")
@ -89,11 +89,11 @@ def test_add_user_to_group():
@mock_iam_deprecated()
def test_remove_user_from_group():
conn = boto.connect_iam()
with assert_raises(BotoServerError):
with pytest.raises(BotoServerError):
conn.remove_user_from_group("my-group", "my-user")
conn.create_group("my-group")
conn.create_user("my-user")
with assert_raises(BotoServerError):
with pytest.raises(BotoServerError):
conn.remove_user_from_group("my-group", "my-user")
conn.add_user_to_group("my-group", "my-user")
conn.remove_user_from_group("my-group", "my-user")
@ -150,7 +150,7 @@ def test_attach_group_policies():
def test_get_group_policy():
conn = boto.connect_iam()
conn.create_group("my-group")
with assert_raises(BotoServerError):
with pytest.raises(BotoServerError):
conn.get_group_policy("my-group", "my-policy")
conn.put_group_policy("my-group", "my-policy", MOCK_POLICY)