commit
4ca76ae1b0
@ -422,11 +422,11 @@ class OpsWorksBackend(BaseBackend):
|
||||
stackid = kwargs['stack_id']
|
||||
if stackid not in self.stacks:
|
||||
raise ResourceNotFoundException(stackid)
|
||||
if name in [l.name for l in self.layers.values()]:
|
||||
if name in [l.name for l in self.stacks[stackid].layers]:
|
||||
raise ValidationException(
|
||||
'There is already a layer named "{0}" '
|
||||
'for this stack'.format(name))
|
||||
if shortname in [l.shortname for l in self.layers.values()]:
|
||||
if shortname in [l.shortname for l in self.stacks[stackid].layers]:
|
||||
raise ValidationException(
|
||||
'There is already a layer with shortname "{0}" '
|
||||
'for this stack'.format(shortname))
|
||||
|
@ -27,6 +27,22 @@ def test_create_layer_response():
|
||||
|
||||
response.should.contain("LayerId")
|
||||
|
||||
second_stack_id = client.create_stack(
|
||||
Name="test_stack_2",
|
||||
Region="us-east-1",
|
||||
ServiceRoleArn="service_arn",
|
||||
DefaultInstanceProfileArn="profile_arn"
|
||||
)['StackId']
|
||||
|
||||
response = client.create_layer(
|
||||
StackId=second_stack_id,
|
||||
Type="custom",
|
||||
Name="TestLayer",
|
||||
Shortname="TestLayerShortName"
|
||||
)
|
||||
|
||||
response.should.contain("LayerId")
|
||||
|
||||
# ClientError
|
||||
client.create_layer.when.called_with(
|
||||
StackId=stack_id,
|
||||
|
Loading…
Reference in New Issue
Block a user