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:
parent
681dfe39af
commit
a1a66231ed
3 changed files with 19 additions and 21 deletions
|
@ -48,25 +48,23 @@ 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
|
||||
private
|
||||
|
||||
def associationSet=(new_association_set)
|
||||
merge_attributes(new_association_set.first || {})
|
||||
end
|
||||
|
||||
def routeSet=(new_route_set)
|
||||
merge_attributes(new_route_set || {})
|
||||
end
|
||||
def associationSet=(new_association_set)
|
||||
merge_attributes(new_association_set.first || {})
|
||||
end
|
||||
|
||||
def routeSet=(new_route_set)
|
||||
merge_attributes(new_route_set || {})
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue