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

@ -0,0 +1 @@
# This file is intentionally left blank.

View file

@ -4,7 +4,7 @@ import boto3
from botocore.exceptions import ClientError
from six.moves.email_mime_multipart import MIMEMultipart
from six.moves.email_mime_text import MIMEText
from nose.tools import assert_raises
import pytest
import sure # noqa
@ -298,7 +298,7 @@ def test_create_configuration_set():
},
)
with assert_raises(ClientError) as ex:
with pytest.raises(ClientError) as ex:
conn.create_configuration_set_event_destination(
ConfigurationSetName="failtest",
EventDestination={
@ -313,7 +313,7 @@ def test_create_configuration_set():
ex.exception.response["Error"]["Code"].should.equal("ConfigurationSetDoesNotExist")
with assert_raises(ClientError) as ex:
with pytest.raises(ClientError) as ex:
conn.create_configuration_set_event_destination(
ConfigurationSetName="test",
EventDestination={
@ -336,7 +336,7 @@ def test_create_receipt_rule_set():
result["ResponseMetadata"]["HTTPStatusCode"].should.equal(200)
with assert_raises(ClientError) as ex:
with pytest.raises(ClientError) as ex:
conn.create_receipt_rule_set(RuleSetName="testRuleSet")
ex.exception.response["Error"]["Code"].should.equal("RuleSetNameAlreadyExists")
@ -378,7 +378,7 @@ def test_create_receipt_rule():
result["ResponseMetadata"]["HTTPStatusCode"].should.equal(200)
with assert_raises(ClientError) as ex:
with pytest.raises(ClientError) as ex:
conn.create_receipt_rule(
RuleSetName=rule_set_name,
Rule={
@ -409,7 +409,7 @@ def test_create_receipt_rule():
ex.exception.response["Error"]["Code"].should.equal("RuleAlreadyExists")
with assert_raises(ClientError) as ex:
with pytest.raises(ClientError) as ex:
conn.create_receipt_rule(
RuleSetName="InvalidRuleSetaName",
Rule={
@ -455,7 +455,7 @@ def test_create_ses_template():
"</h1><p>Your favorite animal is {{favoriteanimal}}.</p>",
}
)
with assert_raises(ClientError) as ex:
with pytest.raises(ClientError) as ex:
conn.create_template(
Template={
"TemplateName": "MyTemplate",
@ -475,7 +475,7 @@ def test_create_ses_template():
result["Template"]["SubjectPart"].should.equal("Greetings, {{name}}!")
# get a template which is not present
with assert_raises(ClientError) as ex:
with pytest.raises(ClientError) as ex:
conn.get_template(TemplateName="MyFakeTemplate")
ex.exception.response["Error"]["Code"].should.equal("TemplateDoesNotExist")

View file

@ -7,7 +7,6 @@ from six.moves.email_mime_multipart import MIMEMultipart
from six.moves.email_mime_text import MIMEText
import sure # noqa
from nose import tools
from moto import mock_ses, mock_sns, mock_sqs
from moto.ses.models import SESFeedback
from moto.core import ACCOUNT_ID