Finish porting from nose to pytest.

This commit is contained in:
Matěj Cepl 2020-10-06 08:04:09 +02:00
commit ea489bce6c
72 changed files with 1289 additions and 1280 deletions

View file

@ -35,10 +35,10 @@ def test_delete_parameter():
def test_delete_nonexistent_parameter():
client = boto3.client("ssm", region_name="us-east-1")
with assert_raises(ClientError) as ex:
with pytest.raises(ClientError) as ex:
client.delete_parameter(Name="test_noexist")
ex.exception.response["Error"]["Code"].should.equal("ParameterNotFound")
ex.exception.response["Error"]["Message"].should.equal(
ex.value.response["Error"]["Code"].should.equal("ParameterNotFound")
ex.value.response["Error"]["Message"].should.equal(
"Parameter test_noexist not found."
)
@ -438,17 +438,17 @@ def test_get_parameter_with_version_and_labels():
"arn:aws:ssm:us-east-1:1234567890:parameter/test-2"
)
with assert_raises(ClientError) as ex:
with pytest.raises(ClientError) as ex:
client.get_parameter(Name="test-2:2:3", WithDecryption=False)
ex.exception.response["Error"]["Code"].should.equal("ParameterNotFound")
ex.exception.response["Error"]["Message"].should.equal(
ex.value.response["Error"]["Code"].should.equal("ParameterNotFound")
ex.value.response["Error"]["Message"].should.equal(
"Parameter test-2:2:3 not found."
)
with assert_raises(ClientError) as ex:
with pytest.raises(ClientError) as ex:
client.get_parameter(Name="test-2:2", WithDecryption=False)
ex.exception.response["Error"]["Code"].should.equal("ParameterNotFound")
ex.exception.response["Error"]["Message"].should.equal(
ex.value.response["Error"]["Code"].should.equal("ParameterNotFound")
ex.value.response["Error"]["Message"].should.equal(
"Parameter test-2:2 not found."
)
@ -462,9 +462,9 @@ def test_get_parameters_errors():
for name, value in ssm_parameters.items():
client.put_parameter(Name=name, Value=value, Type="String")
with assert_raises(ClientError) as e:
with pytest.raises(ClientError) as e:
client.get_parameters(Names=list(ssm_parameters.keys()))
ex = e.exception
ex = e.value
ex.operation_name.should.equal("GetParameters")
ex.response["ResponseMetadata"]["HTTPStatusCode"].should.equal(400)
ex.response["Error"]["Code"].should.contain("ValidationException")