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

[ibm] Added request tests for addresses

This commit is contained in:
Carl Hicks 2011-12-10 13:45:32 -08:00 committed by Decklin Foster
parent cf8cf65f5a
commit 08b5104a4a

View file

@ -29,12 +29,21 @@ module Fog
end
end
class Mock
def list_addresses
# Loop through addresses and update states and values if they aren't set
self.data[:addresses].values.each do |address|
address['state'] = 2 if address['state'] == 0
address['ip'] = Fog::IBM::Mock.ip_address if address['ip'].empty?
address['mode'] = 0 unless address.key? 'mode'
address['hostname'] = Fog::IBM::Mock.hostname unless address.key? 'hostname'
address['type'] = 1 unless address.key? 'type'
end
response = Excon::Response.new
response.status = 200
response.body = {'addresses' => self.data[:addresses].values}
response.body = { 'addresses' => self.data[:addresses].values }
response
end