Set deleted status on vpc peer deletion.
This commit is contained in:
parent
90a62b5640
commit
6e6f23a1b0
2 changed files with 8 additions and 4 deletions
|
|
@ -2230,6 +2230,10 @@ class VPCPeeringConnectionStatus(object):
|
|||
self.code = code
|
||||
self.message = message
|
||||
|
||||
def deleted(self):
|
||||
self.code = 'deleted'
|
||||
self.message = 'Deleted by {deleter ID}'
|
||||
|
||||
def initiating(self):
|
||||
self.code = 'initiating-request'
|
||||
self.message = 'Initiating Request to {accepter ID}'
|
||||
|
|
@ -2292,9 +2296,8 @@ class VPCPeeringConnectionBackend(object):
|
|||
return self.vpc_pcxs.get(vpc_pcx_id)
|
||||
|
||||
def delete_vpc_peering_connection(self, vpc_pcx_id):
|
||||
deleted = self.vpc_pcxs.pop(vpc_pcx_id, None)
|
||||
if not deleted:
|
||||
raise InvalidVPCPeeringConnectionIdError(vpc_pcx_id)
|
||||
deleted = self.get_vpc_peering_connection(vpc_pcx_id)
|
||||
deleted._status.deleted()
|
||||
return deleted
|
||||
|
||||
def accept_vpc_peering_connection(self, vpc_pcx_id):
|
||||
|
|
|
|||
|
|
@ -89,7 +89,8 @@ def test_vpc_peering_connections_delete():
|
|||
verdict.should.equal(True)
|
||||
|
||||
all_vpc_pcxs = conn.get_all_vpc_peering_connections()
|
||||
all_vpc_pcxs.should.have.length_of(0)
|
||||
all_vpc_pcxs.should.have.length_of(1)
|
||||
all_vpc_pcxs[0]._status.code.should.equal('deleted')
|
||||
|
||||
with assert_raises(EC2ResponseError) as cm:
|
||||
conn.delete_vpc_peering_connection("pcx-1234abcd")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue