1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/tests/ibm/requests/compute/address_tests.rb

45 lines
1.3 KiB
Ruby
Raw Normal View History

2011-12-02 13:27:44 -05:00
Shindo.tests('Fog::Compute[:ibm] | address requests', ['ibm']) do
@address_format = {
2012-02-13 10:51:03 -05:00
"state" => Integer,
"offeringId"=> String,
"location" => String,
"ip" => String,
2011-12-02 13:27:44 -05:00
"id" => String,
"mode" => Integer,
"hostname" => String,
"type" => Integer,
"instanceId" => Fog::Nullable::String,
"vlan" => Fog::Nullable::String,
2011-12-02 13:27:44 -05:00
}
# create_address doesn't return mode, hostname or type attributes
@create_address_format = @address_format.reject { |k,v| ["mode", "hostname", "type"].include? k }
# list_address returns everything
@list_address_format = { 'addresses' => [ @address_format ] }
@address_id = nil
2012-02-28 23:51:37 -05:00
@location_id = "41"
2011-12-02 13:27:44 -05:00
@offering_id = "20001223"
2012-02-13 10:51:03 -05:00
2011-12-02 13:27:44 -05:00
tests('success') do
2012-02-13 10:51:03 -05:00
2011-12-02 13:27:44 -05:00
tests("#create_address('#{@location_id}')").formats(@create_address_format) do
data = Fog::Compute[:ibm].create_address(@location_id, @offering_id).body
2011-12-02 13:27:44 -05:00
@address_id = data['id']
data
end
2012-02-13 10:51:03 -05:00
2011-12-02 13:27:44 -05:00
tests("#list_addresses").formats(@list_address_format) do
Fog::Compute[:ibm].list_addresses.body
end
2012-02-13 10:51:03 -05:00
2011-12-02 13:27:44 -05:00
tests("#delete_address('#{@address_id}')") do
Fog::Compute[:ibm].addresses.get(@address_id).wait_for { ready? }
2011-12-02 13:27:44 -05:00
returns(true) { Fog::Compute[:ibm].delete_address(@address_id).body['success'] }
end
end
2012-02-13 10:51:03 -05:00
end