Finish porting from nose to pytest.
This commit is contained in:
parent
77dc60ea97
commit
ea489bce6c
72 changed files with 1289 additions and 1280 deletions
|
|
@ -123,7 +123,7 @@ def test_with_all_filter():
|
|||
secrets = conn.list_secrets(Filters=[{"Key": "all", "Values": ["foo"]}])
|
||||
|
||||
secret_names = list(map(lambda s: s["Name"], secrets["SecretList"]))
|
||||
assert secret_names == ["foo", "bar", "baz", "qux", "multi"]
|
||||
assert sorted(secret_names) == ['bar', 'baz', 'foo', 'multi', 'qux']
|
||||
|
||||
|
||||
@mock_secretsmanager
|
||||
|
|
@ -133,8 +133,8 @@ def test_with_no_filter_key():
|
|||
with pytest.raises(ClientError) as ire:
|
||||
conn.list_secrets(Filters=[{"Values": ["foo"]}])
|
||||
|
||||
ire.exception.response["Error"]["Code"].should.equal("InvalidParameterException")
|
||||
ire.exception.response["Error"]["Message"].should.equal("Invalid filter key")
|
||||
ire.value.response["Error"]["Code"].should.equal("InvalidParameterException")
|
||||
ire.value.response["Error"]["Message"].should.equal("Invalid filter key")
|
||||
|
||||
|
||||
@mock_secretsmanager
|
||||
|
|
@ -146,8 +146,8 @@ def test_with_no_filter_values():
|
|||
with pytest.raises(ClientError) as ire:
|
||||
conn.list_secrets(Filters=[{"Key": "description"}])
|
||||
|
||||
ire.exception.response["Error"]["Code"].should.equal("InvalidParameterException")
|
||||
ire.exception.response["Error"]["Message"].should.equal(
|
||||
ire.value.response["Error"]["Code"].should.equal("InvalidParameterException")
|
||||
ire.value.response["Error"]["Message"].should.equal(
|
||||
"Invalid filter values for key: description"
|
||||
)
|
||||
|
||||
|
|
@ -159,8 +159,8 @@ def test_with_invalid_filter_key():
|
|||
with pytest.raises(ClientError) as ire:
|
||||
conn.list_secrets(Filters=[{"Key": "invalid", "Values": ["foo"]}])
|
||||
|
||||
ire.exception.response["Error"]["Code"].should.equal("ValidationException")
|
||||
ire.exception.response["Error"]["Message"].should.equal(
|
||||
ire.value.response["Error"]["Code"].should.equal("ValidationException")
|
||||
ire.value.response["Error"]["Message"].should.equal(
|
||||
"1 validation error detected: Value 'invalid' at 'filters.1.member.key' failed to satisfy constraint: Member "
|
||||
"must satisfy enum value set: [all, name, tag-key, description, tag-value]"
|
||||
)
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ def test_get_secret_that_does_not_exist():
|
|||
|
||||
assert \
|
||||
"Secrets Manager can't find the specified secret." == \
|
||||
cm.exception.response["Error"]["Message"]
|
||||
cm.value.response["Error"]["Message"]
|
||||
|
||||
|
||||
@mock_secretsmanager
|
||||
|
|
@ -73,7 +73,7 @@ def test_get_secret_that_does_not_match():
|
|||
|
||||
assert \
|
||||
"Secrets Manager can't find the specified secret." == \
|
||||
cm.exception.response["Error"]["Message"]
|
||||
cm.value.response["Error"]["Message"]
|
||||
|
||||
|
||||
@mock_secretsmanager
|
||||
|
|
@ -99,7 +99,7 @@ def test_get_secret_that_has_no_value():
|
|||
|
||||
assert \
|
||||
"Secrets Manager can't find the specified secret value for staging label: AWSCURRENT" == \
|
||||
cm.exception.response["Error"]
|
||||
cm.value.response["Error"]["Message"]
|
||||
|
||||
|
||||
@mock_secretsmanager
|
||||
|
|
@ -110,16 +110,14 @@ def test_get_secret_version_that_does_not_exist():
|
|||
secret_arn = result["ARN"]
|
||||
missing_version_id = "00000000-0000-0000-0000-000000000000"
|
||||
|
||||
with assert_raises(ClientError) as cm:
|
||||
with pytest.raises(ClientError) as cm:
|
||||
conn.get_secret_value(SecretId=secret_arn, VersionId=missing_version_id)
|
||||
|
||||
assert_equal(
|
||||
assert \
|
||||
(
|
||||
"An error occurred (ResourceNotFoundException) when calling the GetSecretValue operation: Secrets "
|
||||
"Manager can't find the specified secret value for VersionId: 00000000-0000-0000-0000-000000000000"
|
||||
),
|
||||
cm.exception.response["Error"]["Message"],
|
||||
)
|
||||
) == cm.value.response["Error"]["Message"]
|
||||
|
||||
|
||||
@mock_secretsmanager
|
||||
|
|
@ -702,8 +700,8 @@ def test_put_secret_binary_requires_either_string_or_binary():
|
|||
with pytest.raises(ClientError) as ire:
|
||||
conn.put_secret_value(SecretId=DEFAULT_SECRET_NAME)
|
||||
|
||||
ire.exception.response["Error"]["Code"].should.equal("InvalidRequestException")
|
||||
ire.exception.response["Error"]["Message"].should.equal(
|
||||
ire.value.response["Error"]["Code"].should.equal("InvalidRequestException")
|
||||
ire.value.response["Error"]["Message"].should.equal(
|
||||
"You must provide either SecretString or SecretBinary."
|
||||
)
|
||||
|
||||
|
|
@ -883,7 +881,7 @@ def test_update_secret_which_does_not_exit():
|
|||
|
||||
assert \
|
||||
"Secrets Manager can't find the specified secret." == \
|
||||
cm.exception.response["Error"]["Message"]
|
||||
cm.value.response["Error"]["Message"]
|
||||
|
||||
|
||||
@mock_secretsmanager
|
||||
|
|
@ -900,7 +898,7 @@ def test_update_secret_marked_as_deleted():
|
|||
|
||||
assert (
|
||||
"because it was marked for deletion."
|
||||
in cm.exception.response["Error"]["Message"]
|
||||
in cm.value.response["Error"]["Message"]
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -89,10 +89,9 @@ def test_get_secret_that_has_no_value():
|
|||
)
|
||||
|
||||
json_data = json.loads(get_secret.data.decode("utf-8"))
|
||||
assert (
|
||||
json_data["message"]
|
||||
== "Secrets Manager can't find the specified secret value for staging label: AWSCURRENT"
|
||||
)
|
||||
assert \
|
||||
json_data["message"] == \
|
||||
"Secrets Manager can't find the specified secret value for staging label: AWSCURRENT"
|
||||
assert json_data["__type"] == "ResourceNotFoundException"
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue