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
|
|
@ -4,7 +4,7 @@ from datetime import datetime
|
|||
import boto3
|
||||
import sure # noqa
|
||||
from botocore.exceptions import ClientError
|
||||
from nose.tools import assert_raises
|
||||
import pytest
|
||||
|
||||
from moto import mock_codepipeline, mock_iam
|
||||
|
||||
|
|
@ -77,7 +77,7 @@ def test_create_pipeline_errors():
|
|||
client_iam = boto3.client("iam", region_name="us-east-1")
|
||||
create_basic_codepipeline(client, "test-pipeline")
|
||||
|
||||
with assert_raises(ClientError) as e:
|
||||
with pytest.raises(ClientError) as e:
|
||||
create_basic_codepipeline(client, "test-pipeline")
|
||||
ex = e.exception
|
||||
ex.operation_name.should.equal("CreatePipeline")
|
||||
|
|
@ -87,7 +87,7 @@ def test_create_pipeline_errors():
|
|||
"A pipeline with the name 'test-pipeline' already exists in account '123456789012'"
|
||||
)
|
||||
|
||||
with assert_raises(ClientError) as e:
|
||||
with pytest.raises(ClientError) as e:
|
||||
client.create_pipeline(
|
||||
pipeline={
|
||||
"name": "invalid-pipeline",
|
||||
|
|
@ -139,7 +139,7 @@ def test_create_pipeline_errors():
|
|||
),
|
||||
)["Role"]["Arn"]
|
||||
|
||||
with assert_raises(ClientError) as e:
|
||||
with pytest.raises(ClientError) as e:
|
||||
client.create_pipeline(
|
||||
pipeline={
|
||||
"name": "invalid-pipeline",
|
||||
|
|
@ -175,7 +175,7 @@ def test_create_pipeline_errors():
|
|||
"CodePipeline is not authorized to perform AssumeRole on role arn:aws:iam::123456789012:role/wrong-role"
|
||||
)
|
||||
|
||||
with assert_raises(ClientError) as e:
|
||||
with pytest.raises(ClientError) as e:
|
||||
client.create_pipeline(
|
||||
pipeline={
|
||||
"name": "invalid-pipeline",
|
||||
|
|
@ -282,7 +282,7 @@ def test_get_pipeline():
|
|||
def test_get_pipeline_errors():
|
||||
client = boto3.client("codepipeline", region_name="us-east-1")
|
||||
|
||||
with assert_raises(ClientError) as e:
|
||||
with pytest.raises(ClientError) as e:
|
||||
client.get_pipeline(name="not-existing")
|
||||
ex = e.exception
|
||||
ex.operation_name.should.equal("GetPipeline")
|
||||
|
|
@ -410,7 +410,7 @@ def test_update_pipeline():
|
|||
def test_update_pipeline_errors():
|
||||
client = boto3.client("codepipeline", region_name="us-east-1")
|
||||
|
||||
with assert_raises(ClientError) as e:
|
||||
with pytest.raises(ClientError) as e:
|
||||
client.update_pipeline(
|
||||
pipeline={
|
||||
"name": "not-existing",
|
||||
|
|
@ -517,7 +517,7 @@ def test_list_tags_for_resource():
|
|||
def test_list_tags_for_resource_errors():
|
||||
client = boto3.client("codepipeline", region_name="us-east-1")
|
||||
|
||||
with assert_raises(ClientError) as e:
|
||||
with pytest.raises(ClientError) as e:
|
||||
client.list_tags_for_resource(
|
||||
resourceArn="arn:aws:codepipeline:us-east-1:123456789012:not-existing"
|
||||
)
|
||||
|
|
@ -555,7 +555,7 @@ def test_tag_resource_errors():
|
|||
name = "test-pipeline"
|
||||
create_basic_codepipeline(client, name)
|
||||
|
||||
with assert_raises(ClientError) as e:
|
||||
with pytest.raises(ClientError) as e:
|
||||
client.tag_resource(
|
||||
resourceArn="arn:aws:codepipeline:us-east-1:123456789012:not-existing",
|
||||
tags=[{"key": "key-2", "value": "value-2"}],
|
||||
|
|
@ -568,7 +568,7 @@ def test_tag_resource_errors():
|
|||
"The account with id '123456789012' does not include a pipeline with the name 'not-existing'"
|
||||
)
|
||||
|
||||
with assert_raises(ClientError) as e:
|
||||
with pytest.raises(ClientError) as e:
|
||||
client.tag_resource(
|
||||
resourceArn="arn:aws:codepipeline:us-east-1:123456789012:{}".format(name),
|
||||
tags=[{"key": "aws:key", "value": "value"}],
|
||||
|
|
@ -583,7 +583,7 @@ def test_tag_resource_errors():
|
|||
"msg=[Caller is an end user and not allowed to mutate system tags]"
|
||||
)
|
||||
|
||||
with assert_raises(ClientError) as e:
|
||||
with pytest.raises(ClientError) as e:
|
||||
client.tag_resource(
|
||||
resourceArn="arn:aws:codepipeline:us-east-1:123456789012:{}".format(name),
|
||||
tags=[
|
||||
|
|
@ -634,7 +634,7 @@ def test_untag_resource():
|
|||
def test_untag_resource_errors():
|
||||
client = boto3.client("codepipeline", region_name="us-east-1")
|
||||
|
||||
with assert_raises(ClientError) as e:
|
||||
with pytest.raises(ClientError) as e:
|
||||
client.untag_resource(
|
||||
resourceArn="arn:aws:codepipeline:us-east-1:123456789012:not-existing",
|
||||
tagKeys=["key"],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue