1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

Add support to #create_tags mock for internet gateways

This commit is contained in:
David Faber 2013-10-29 17:55:43 -07:00
parent 4ee99f4ac6
commit 01d156c16b
5 changed files with 9 additions and 7 deletions

View file

@ -223,7 +223,6 @@ module Fog
:subnets => [],
:vpcs => [],
:dhcp_options => [],
:internet_gateways => [],
:route_tables => [],
:account_attributes => [
{

View file

@ -33,16 +33,17 @@ module Fog
class Mock
def create_internet_gateway()
self.data[:internet_gateways].push({
'internetGatewayId' => Fog::AWS::Mock.request_id,
gateway_id = Fog::AWS::Mock.internet_gateway_id
self.data[:internet_gateways][gateway_id] = {
'internetGatewayId' => gateway_id,
'attachmentSet' => {},
'tagSet' => {}
})
}
Excon::Response.new(
:status => 200,
:body => {
'requestId' => Fog::AWS::Mock.request_id,
'internetGatewaySet' => self.data[:internet_gateways]
'internetGatewaySet' => [self.data[:internet_gateways][gateway_id]]
}
)
end

View file

@ -53,6 +53,8 @@ module Fog
'snapshot'
when /^vol\-[a-z0-9]{8}$/i
'volume'
when /^igw\-[a-z0-9]{8}$/i
'internet_gateway'
end
if type && ((type == 'image' && visible_images[resource_id]) || self.data[:"#{type}s"][resource_id])
{ 'resourceId' => resource_id, 'resourceType' => type }

View file

@ -30,7 +30,7 @@ module Fog
Excon::Response.new.tap do |response|
if internet_gateway_id
response.status = 200
self.data[:internet_gateways].reject! { |v| v['internetGatewayId'] == internet_gateway_id }
self.data[:internet_gateways].delete(internet_gateway_id)
response.body = {
'requestId' => Fog::AWS::Mock.request_id,

View file

@ -40,7 +40,7 @@ module Fog
class Mock
def describe_internet_gateways(filters = {})
internet_gateways = self.data[:internet_gateways]
internet_gateways = self.data[:internet_gateways].values
if filters['internet-gateway-id']
internet_gateways = internet_gateways.reject {|internet_gateway| internet_gateway['internetGatewayId'] != filters['internet-gateway-id']}