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

@ -10,7 +10,7 @@ import sure # noqa
import responses
from botocore.exceptions import ClientError
from nose.tools import assert_raises
import pytest
from moto import mock_sns, mock_sqs, settings
from moto.core import ACCOUNT_ID
from moto.sns import sns_backend
@ -233,13 +233,13 @@ def test_publish_bad_sms():
client = boto3.client("sns", region_name="us-east-1")
# Test invalid number
with assert_raises(ClientError) as cm:
with pytest.raises(ClientError) as cm:
client.publish(PhoneNumber="NAA+15551234567", Message="my message")
cm.exception.response["Error"]["Code"].should.equal("InvalidParameter")
cm.exception.response["Error"]["Message"].should.contain("not meet the E164")
# Test to long ASCII message
with assert_raises(ClientError) as cm:
with pytest.raises(ClientError) as cm:
client.publish(PhoneNumber="+15551234567", Message="a" * 1601)
cm.exception.response["Error"]["Code"].should.equal("InvalidParameter")
cm.exception.response["Error"]["Message"].should.contain("must be less than 1600")
@ -387,7 +387,7 @@ def test_publish_message_too_long():
sns = boto3.resource("sns", region_name="us-east-1")
topic = sns.create_topic(Name="some-topic")
with assert_raises(ClientError):
with pytest.raises(ClientError):
topic.publish(Message="".join(["." for i in range(0, 262145)]))
# message short enough - does not raise an error