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

@ -44,9 +44,9 @@ def test_create_flow_logs_s3():
LogDestination="arn:aws:s3:::" + bucket.name,
DryRun=True,
)
ex.exception.response["Error"]["Code"].should.equal("DryRunOperation")
ex.exception.response["ResponseMetadata"]["HTTPStatusCode"].should.equal(400)
ex.exception.response["Error"]["Message"].should.equal(
ex.value.response["Error"]["Code"].should.equal("DryRunOperation")
ex.value.response["ResponseMetadata"]["HTTPStatusCode"].should.equal(400)
ex.value.response["Error"]["Message"].should.equal(
"An error occurred (DryRunOperation) when calling the CreateFlowLogs operation: Request would have succeeded, but DryRun flag is set"
)
@ -96,9 +96,9 @@ def test_create_flow_logs_cloud_watch():
DeliverLogsPermissionArn="arn:aws:iam::" + ACCOUNT_ID + ":role/test-role",
DryRun=True,
)
ex.exception.response["Error"]["Code"].should.equal("DryRunOperation")
ex.exception.response["ResponseMetadata"]["HTTPStatusCode"].should.equal(400)
ex.exception.response["Error"]["Message"].should.equal(
ex.value.response["Error"]["Code"].should.equal("DryRunOperation")
ex.value.response["ResponseMetadata"]["HTTPStatusCode"].should.equal(400)
ex.value.response["Error"]["Message"].should.equal(
"An error occurred (DryRunOperation) when calling the CreateFlowLogs operation: Request would have succeeded, but DryRun flag is set"
)
@ -244,17 +244,17 @@ def test_delete_flow_logs_non_existing():
with pytest.raises(ClientError) as ex:
client.delete_flow_logs(FlowLogIds=["fl-1a2b3c4d"])
ex.exception.response["Error"]["Code"].should.equal("InvalidFlowLogId.NotFound")
ex.exception.response["ResponseMetadata"]["HTTPStatusCode"].should.equal(400)
ex.exception.response["Error"]["Message"].should.equal(
ex.value.response["Error"]["Code"].should.equal("InvalidFlowLogId.NotFound")
ex.value.response["ResponseMetadata"]["HTTPStatusCode"].should.equal(400)
ex.value.response["Error"]["Message"].should.equal(
"These flow log ids in the input list are not found: [TotalCount: 1] fl-1a2b3c4d"
)
with pytest.raises(ClientError) as ex:
client.delete_flow_logs(FlowLogIds=["fl-1a2b3c4d", "fl-2b3c4d5e"])
ex.exception.response["Error"]["Code"].should.equal("InvalidFlowLogId.NotFound")
ex.exception.response["ResponseMetadata"]["HTTPStatusCode"].should.equal(400)
ex.exception.response["Error"]["Message"].should.equal(
ex.value.response["Error"]["Code"].should.equal("InvalidFlowLogId.NotFound")
ex.value.response["ResponseMetadata"]["HTTPStatusCode"].should.equal(400)
ex.value.response["Error"]["Message"].should.equal(
"These flow log ids in the input list are not found: [TotalCount: 2] fl-1a2b3c4d fl-2b3c4d5e"
)
@ -312,9 +312,9 @@ def test_create_flow_logs_invalid_parameters():
LogDestination="arn:aws:s3:::" + bucket.name,
MaxAggregationInterval=10,
)
ex.exception.response["Error"]["Code"].should.equal("InvalidParameter")
ex.exception.response["ResponseMetadata"]["HTTPStatusCode"].should.equal(400)
ex.exception.response["Error"]["Message"].should.equal(
ex.value.response["Error"]["Code"].should.equal("InvalidParameter")
ex.value.response["ResponseMetadata"]["HTTPStatusCode"].should.equal(400)
ex.value.response["Error"]["Message"].should.equal(
"Invalid Flow Log Max Aggregation Interval"
)
@ -325,9 +325,9 @@ def test_create_flow_logs_invalid_parameters():
TrafficType="ALL",
LogDestinationType="s3",
)
ex.exception.response["Error"]["Code"].should.equal("InvalidParameter")
ex.exception.response["ResponseMetadata"]["HTTPStatusCode"].should.equal(400)
ex.exception.response["Error"]["Message"].should.equal(
ex.value.response["Error"]["Code"].should.equal("InvalidParameter")
ex.value.response["ResponseMetadata"]["HTTPStatusCode"].should.equal(400)
ex.value.response["Error"]["Message"].should.equal(
"LogDestination can't be empty if LogGroupName is not provided."
)
@ -339,9 +339,9 @@ def test_create_flow_logs_invalid_parameters():
LogDestinationType="s3",
LogGroupName="test",
)
ex.exception.response["Error"]["Code"].should.equal("InvalidParameter")
ex.exception.response["ResponseMetadata"]["HTTPStatusCode"].should.equal(400)
ex.exception.response["Error"]["Message"].should.equal(
ex.value.response["Error"]["Code"].should.equal("InvalidParameter")
ex.value.response["ResponseMetadata"]["HTTPStatusCode"].should.equal(400)
ex.value.response["Error"]["Message"].should.equal(
"LogDestination type must be cloud-watch-logs if LogGroupName is provided."
)
@ -352,9 +352,9 @@ def test_create_flow_logs_invalid_parameters():
TrafficType="ALL",
LogGroupName="test",
)
ex.exception.response["Error"]["Code"].should.equal("InvalidParameter")
ex.exception.response["ResponseMetadata"]["HTTPStatusCode"].should.equal(400)
ex.exception.response["Error"]["Message"].should.equal(
ex.value.response["Error"]["Code"].should.equal("InvalidParameter")
ex.value.response["ResponseMetadata"]["HTTPStatusCode"].should.equal(400)
ex.value.response["Error"]["Message"].should.equal(
"DeliverLogsPermissionArn can't be empty if LogDestinationType is cloud-watch-logs."
)
@ -375,9 +375,9 @@ def test_create_flow_logs_invalid_parameters():
LogDestinationType="s3",
LogDestination="arn:aws:s3:::" + bucket.name,
)
ex.exception.response["Error"]["Code"].should.equal("FlowLogAlreadyExists")
ex.exception.response["ResponseMetadata"]["HTTPStatusCode"].should.equal(400)
ex.exception.response["Error"]["Message"].should.equal(
ex.value.response["Error"]["Code"].should.equal("FlowLogAlreadyExists")
ex.value.response["ResponseMetadata"]["HTTPStatusCode"].should.equal(400)
ex.value.response["Error"]["Message"].should.equal(
"Error. There is an existing Flow Log with the same configuration and log destination."
)
@ -398,9 +398,9 @@ def test_create_flow_logs_invalid_parameters():
LogGroupName="test-group",
DeliverLogsPermissionArn="arn:aws:iam::" + ACCOUNT_ID + ":role/test-role",
)
ex.exception.response["Error"]["Code"].should.equal("FlowLogAlreadyExists")
ex.exception.response["ResponseMetadata"]["HTTPStatusCode"].should.equal(400)
ex.exception.response["Error"]["Message"].should.equal(
ex.value.response["Error"]["Code"].should.equal("FlowLogAlreadyExists")
ex.value.response["ResponseMetadata"]["HTTPStatusCode"].should.equal(400)
ex.value.response["Error"]["Message"].should.equal(
"Error. There is an existing Flow Log with the same configuration and log destination."
)