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
tests/test_cloudwatch/__init__.py
Normal file
1
tests/test_cloudwatch/__init__.py
Normal file
|
|
@ -0,0 +1 @@
|
|||
# This file is intentionally left blank.
|
||||
|
|
@ -4,7 +4,7 @@ import boto3
|
|||
from botocore.exceptions import ClientError
|
||||
from datetime import datetime, timedelta
|
||||
from freezegun import freeze_time
|
||||
from nose.tools import assert_raises
|
||||
import pytest
|
||||
from uuid import uuid4
|
||||
import pytz
|
||||
import sure # noqa
|
||||
|
|
@ -111,7 +111,7 @@ def test_delete_invalid_alarm():
|
|||
)
|
||||
|
||||
# trying to delete an alarm which is not created along with valid alarm.
|
||||
with assert_raises(ClientError) as e:
|
||||
with pytest.raises(ClientError) as e:
|
||||
cloudwatch.delete_alarms(AlarmNames=["InvalidAlarmName", "testalarm1"])
|
||||
e.exception.response["Error"]["Code"].should.equal("ResourceNotFound")
|
||||
|
||||
|
|
@ -120,7 +120,7 @@ def test_delete_invalid_alarm():
|
|||
len(resp["MetricAlarms"]).should.equal(1)
|
||||
|
||||
# test to check if the error raises if only one invalid alarm is tried to delete.
|
||||
with assert_raises(ClientError) as e:
|
||||
with pytest.raises(ClientError) as e:
|
||||
cloudwatch.delete_alarms(AlarmNames=["InvalidAlarmName"])
|
||||
e.exception.response["Error"]["Code"].should.equal("ResourceNotFound")
|
||||
|
||||
|
|
@ -423,7 +423,7 @@ def test_list_metrics_paginated():
|
|||
# Verify that only a single page of metrics is returned
|
||||
cloudwatch.list_metrics()["Metrics"].should.be.empty
|
||||
# Verify we can't pass a random NextToken
|
||||
with assert_raises(ClientError) as e:
|
||||
with pytest.raises(ClientError) as e:
|
||||
cloudwatch.list_metrics(NextToken=str(uuid4()))
|
||||
e.exception.response["Error"]["Message"].should.equal(
|
||||
"Request parameter NextToken is invalid"
|
||||
|
|
@ -452,7 +452,7 @@ def test_list_metrics_paginated():
|
|||
len(third_page["Metrics"]).should.equal(100)
|
||||
third_page.shouldnt.contain("NextToken")
|
||||
# Verify that we can't reuse an existing token
|
||||
with assert_raises(ClientError) as e:
|
||||
with pytest.raises(ClientError) as e:
|
||||
cloudwatch.list_metrics(NextToken=first_page["NextToken"])
|
||||
e.exception.response["Error"]["Message"].should.equal(
|
||||
"Request parameter NextToken is invalid"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue