Permalink
Browse files

[openstack|network] mocking code fixes for the router requests

  • Loading branch information...
1 parent 54453be commit d7cb0f65d608fe6e7474dc3daeb33714656be45e @rubiojr committed Feb 28, 2013
@@ -46,8 +46,9 @@ def create_router(name, options = {})
'id' => '8604a0de-7f6b-409a-a47c-a1cc7bc77b2e'
}
}
- self.data[:routers] = []
- self.data[:routers] << data['router']
+ self.data['routers'] ||= []
+ self.data['routers'] << data['router']
+ response.body = data
response
end
end
@@ -15,7 +15,7 @@ def get_router(router_id)
class Mock
def get_router(router_id)
response = Excon::Response.new
- if data = (self.data[:routers].find { |r| r['id'] == router_id })
+ if data = (self.data['routers'].find { |r| r['id'] == router_id })
response.status = 200
response.body = {
'router' => {
@@ -16,7 +16,7 @@ def list_routers(filters = {})
class Mock
def list_routers(filters = {})
Excon::Response.new(
- :body => { 'routers' => (self.data[:routers] || []) },
+ :body => { 'routers' => self.data['routers'] },
:status => 200
)
end

0 comments on commit d7cb0f6

Please sign in to comment.