Merge pull request #1945 from markchalloner/vpc-peering-delete-fix
Set deleted status on vpc peer deletion.
This commit is contained in:
		
						commit
						f155028d27
					
				| @ -2230,6 +2230,10 @@ class VPCPeeringConnectionStatus(object): | |||||||
|         self.code = code |         self.code = code | ||||||
|         self.message = message |         self.message = message | ||||||
| 
 | 
 | ||||||
|  |     def deleted(self): | ||||||
|  |         self.code = 'deleted' | ||||||
|  |         self.message = 'Deleted by {deleter ID}' | ||||||
|  | 
 | ||||||
|     def initiating(self): |     def initiating(self): | ||||||
|         self.code = 'initiating-request' |         self.code = 'initiating-request' | ||||||
|         self.message = 'Initiating Request to {accepter ID}' |         self.message = 'Initiating Request to {accepter ID}' | ||||||
| @ -2292,9 +2296,8 @@ class VPCPeeringConnectionBackend(object): | |||||||
|         return self.vpc_pcxs.get(vpc_pcx_id) |         return self.vpc_pcxs.get(vpc_pcx_id) | ||||||
| 
 | 
 | ||||||
|     def delete_vpc_peering_connection(self, vpc_pcx_id): |     def delete_vpc_peering_connection(self, vpc_pcx_id): | ||||||
|         deleted = self.vpc_pcxs.pop(vpc_pcx_id, None) |         deleted = self.get_vpc_peering_connection(vpc_pcx_id) | ||||||
|         if not deleted: |         deleted._status.deleted() | ||||||
|             raise InvalidVPCPeeringConnectionIdError(vpc_pcx_id) |  | ||||||
|         return deleted |         return deleted | ||||||
| 
 | 
 | ||||||
|     def accept_vpc_peering_connection(self, vpc_pcx_id): |     def accept_vpc_peering_connection(self, vpc_pcx_id): | ||||||
|  | |||||||
| @ -89,7 +89,8 @@ def test_vpc_peering_connections_delete(): | |||||||
|     verdict.should.equal(True) |     verdict.should.equal(True) | ||||||
| 
 | 
 | ||||||
|     all_vpc_pcxs = conn.get_all_vpc_peering_connections() |     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: |     with assert_raises(EC2ResponseError) as cm: | ||||||
|         conn.delete_vpc_peering_connection("pcx-1234abcd") |         conn.delete_vpc_peering_connection("pcx-1234abcd") | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user