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,25 +48,23 @@ module Fog
def save def save
requires :vpc_id 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'} new_attributes = data.reject {|key,value| key == 'requestId'}
merge_attributes(new_attributes) merge_attributes(new_attributes)
true true
end end
private
private
def associationSet=(new_association_set) def associationSet=(new_association_set)
merge_attributes(new_association_set.first || {}) merge_attributes(new_association_set.first || {})
end end
def routeSet=(new_route_set) def routeSet=(new_route_set)
merge_attributes(new_route_set || {}) merge_attributes(new_route_set || {})
end end
end end
end end
end end
end end

View file

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

View file

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