SSM Parameter Store Error Message When Requesting Invalid Version (#3977)

* Implement correct error when requesting specific version of a parameter which exists but does not have this version

* removing trailing whitespace causing lint failure

* Adding unit tests and fixing linting for new error handling

* Fixing small bug in response message

* Revert change in get_parameters as versioning is not currently implemented in this method. Will fix as a separate PR
This commit is contained in:
Austin Hendrix 2021-06-02 10:27:23 -05:00 committed by GitHub
commit b670962c5e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 2 deletions

View file

@ -465,8 +465,15 @@ def test_get_parameter_with_version_and_labels():
with pytest.raises(ClientError) as ex:
client.get_parameter(Name="test-2:2", WithDecryption=False)
ex.value.response["Error"]["Code"].should.equal("ParameterVersionNotFound")
ex.value.response["Error"]["Message"].should.equal(
"Systems Manager could not find version 2 of test-2. Verify the version and try again."
)
with pytest.raises(ClientError) as ex:
client.get_parameter(Name="test-3:2", WithDecryption=False)
ex.value.response["Error"]["Code"].should.equal("ParameterNotFound")
ex.value.response["Error"]["Message"].should.equal("Parameter test-2:2 not found.")
ex.value.response["Error"]["Message"].should.equal("Parameter test-3:2 not found.")
@mock_ssm