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

Change routeTableSet to routeTable for createRouteTable, since it only returns one on creation, yet our mocks were not showing that same functionality.

This commit is contained in:
Robert Clark 2013-08-08 14:33:01 -04:00
parent 681dfe39af
commit a1a66231ed
3 changed files with 19 additions and 21 deletions

View file

@ -48,13 +48,12 @@ module Fog
def save
requires :vpc_id
data = service.create_route_table(vpc_id).body['routeTableSet'].first
data = service.create_route_table(vpc_id).body['routeTable']
new_attributes = data.reject {|key,value| key == 'requestId'}
merge_attributes(new_attributes)
true
end
private
def associationSet=(new_association_set)
@ -66,7 +65,6 @@ module Fog
end
end
end
end
end

View file

@ -11,7 +11,7 @@ module Fog
@route = {}
@association = {}
@route_table = { 'routeSet' => [], 'tagSet' => {}, 'associationSet' => [] }
@response = { 'routeTableSet' => [] }
@response = { 'routeTable' => [] }
@tag = {}
end
@ -59,7 +59,7 @@ module Fog
when 'routeTableId', 'vpcId'
@route_table[name] = value
when 'routeTable'
@response['routeTableSet'] << @route_table
@response['routeTable'] << @route_table
@route_table = { 'routeSet' => {}, 'tagSet' => {}, 'associationSet' => {} }
when 'requestId'
@response[name] = value

View file

@ -14,7 +14,7 @@ module Fog
# * response<~Excon::Response>:
# * body<~Hash>:
# * 'requestId'<~String> - Id of the request
# * 'routeTableSet'<~Array> - Information about the newly created route table
# * 'routeTable'<~Array> - Information about the newly created route table
# * 'routeTableId'<~String>
# * 'vpcId'<~String>
# * 'routeSet'<~Array>
@ -30,7 +30,6 @@ module Fog
'VpcId' => vpc_id,
:parser => Fog::Parsers::Compute::AWS::CreateRouteTable.new
})
end
end
@ -40,22 +39,23 @@ module Fog
vpc = self.data[:vpcs].find { |vpc| vpc["vpcId"].eql? vpc_id }
unless vpc.nil?
response.status = 200
self.data[:route_tables].push({
route_table = {
'routeTableId' => "rtb-#{Fog::Mock.random_hex(8)}",
'vpcId' => vpc["vpcId"],
'routeSet' => {
'routeSet' => [
'item' => {
"destinationCidrBlock" => vpc["cidrBlock"],
"gatewayId" => "local",
"state" => "pending"
}
},
'associationSet' => {},
],
'associationSet' => [],
'tagSet' => {}
})
}
self.data[:route_tables].push(route_table)
response.body = {
'requestId'=> Fog::AWS::Mock.request_id,
'routeTableSet' => self.data[:route_tables]
'routeTable' => route_table
}
response
else