parameters return from root path (#1701)
This commit is contained in:
parent
51db19067c
commit
dcdaca8984
@ -100,7 +100,7 @@ class SimpleSystemManagerBackend(BaseBackend):
|
||||
# difference here.
|
||||
path = path.rstrip('/') + '/'
|
||||
for param in self._parameters:
|
||||
if not param.startswith(path):
|
||||
if path != '/' and not param.startswith(path):
|
||||
continue
|
||||
if '/' in param[len(path) + 1:] and not recursive:
|
||||
continue
|
||||
|
@ -95,6 +95,27 @@ def test_get_parameters_by_path():
|
||||
Type='SecureString',
|
||||
KeyId='alias/aws/ssm')
|
||||
|
||||
client.put_parameter(
|
||||
Name='foo',
|
||||
Description='A test parameter',
|
||||
Value='bar',
|
||||
Type='String')
|
||||
|
||||
client.put_parameter(
|
||||
Name='baz',
|
||||
Description='A test parameter',
|
||||
Value='qux',
|
||||
Type='String')
|
||||
|
||||
response = client.get_parameters_by_path(Path='/', Recursive=False)
|
||||
len(response['Parameters']).should.equal(2)
|
||||
{p['Value'] for p in response['Parameters']}.should.equal(
|
||||
set(['bar', 'qux'])
|
||||
)
|
||||
|
||||
response = client.get_parameters_by_path(Path='/', Recursive=True)
|
||||
len(response['Parameters']).should.equal(9)
|
||||
|
||||
response = client.get_parameters_by_path(Path='/foo')
|
||||
len(response['Parameters']).should.equal(2)
|
||||
{p['Value'] for p in response['Parameters']}.should.equal(
|
||||
@ -417,6 +438,7 @@ def test_describe_parameters_filter_keyid():
|
||||
response['Parameters'][0]['Type'].should.equal('SecureString')
|
||||
''.should.equal(response.get('NextToken', ''))
|
||||
|
||||
|
||||
@mock_ssm
|
||||
def test_describe_parameters_attributes():
|
||||
client = boto3.client('ssm', region_name='us-east-1')
|
||||
@ -445,6 +467,7 @@ def test_describe_parameters_attributes():
|
||||
response['Parameters'][1].get('Description').should.be.none
|
||||
response['Parameters'][1]['Version'].should.equal(1)
|
||||
|
||||
|
||||
@mock_ssm
|
||||
def test_get_parameter_invalid():
|
||||
client = client = boto3.client('ssm', region_name='us-east-1')
|
||||
|
Loading…
Reference in New Issue
Block a user