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:
parent
cf8cf65f5a
commit
08b5104a4a
1 changed files with 11 additions and 2 deletions
|
@ -29,12 +29,21 @@ module Fog
|
|||
end
|
||||
|
||||
end
|
||||
|
||||
class Mock
|
||||
|
||||
def list_addresses
|
||||
response = Excon::Response.new
|
||||
# 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
|
||||
|
||||
|
|
Loading…
Reference in a new issue