Added non existant parameter test + needed error responses
This commit is contained in:
parent
cf7e07b728
commit
783c287e51
@ -49,7 +49,11 @@ class SimpleSystemManagerResponse(BaseResponse):
|
||||
result = self.ssm_backend.get_parameter(name, with_decryption)
|
||||
|
||||
if result is None:
|
||||
return '', dict(status=400)
|
||||
error = {
|
||||
'__type': 'ParameterNotFound',
|
||||
'message': 'Parameter {0} not found.'.format(name)
|
||||
}
|
||||
return json.dumps(error), dict(status=400)
|
||||
|
||||
response = {
|
||||
'Parameter': {
|
||||
|
@ -1,6 +1,7 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import boto3
|
||||
import botocore.exceptions
|
||||
import sure # noqa
|
||||
|
||||
from moto import mock_ssm
|
||||
@ -85,6 +86,20 @@ def test_get_parameter():
|
||||
response['Parameter']['Type'].should.equal('String')
|
||||
|
||||
|
||||
@mock_ssm
|
||||
def test_get_nonexistant_parameter():
|
||||
client = boto3.client('ssm', region_name='us-east-1')
|
||||
|
||||
try:
|
||||
client.get_parameter(
|
||||
Name='test_noexist',
|
||||
WithDecryption=False)
|
||||
raise RuntimeError('Should of failed')
|
||||
except botocore.exceptions.ClientError as err:
|
||||
err.operation_name.should.equal('GetParameter')
|
||||
err.response['Error']['Message'].should.equal('Parameter test_noexist not found.')
|
||||
|
||||
|
||||
@mock_ssm
|
||||
def test_describe_parameters():
|
||||
client = boto3.client('ssm', region_name='us-east-1')
|
||||
|
Loading…
Reference in New Issue
Block a user