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
|
|
|
|
}
|
|
|
|
|
|
|
|
# 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
|
2012-02-13 10:03:00 -05:00
|
|
|
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
|
|
|
|
returns(true) { Fog::Compute[:ibm].delete_address(@address_id).body['success'] }
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
2012-02-13 10:51:03 -05:00
|
|
|
end
|