mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Add passing tests.
This commit is contained in:
parent
cfc1be2182
commit
8f5e968c07
6 changed files with 64 additions and 16 deletions
|
@ -8,23 +8,24 @@ Shindo.tests('Fog::Compute[:bluebox] | block requests', ['bluebox']) do
|
||||||
'ips' => [{'address' => String}],
|
'ips' => [{'address' => String}],
|
||||||
'lb_applications' => [],
|
'lb_applications' => [],
|
||||||
'memory' => Integer,
|
'memory' => Integer,
|
||||||
'product' => Bluebox::Compute::Formats::PRODUCT,
|
'product' => {'cost' => String, 'description' => String, 'id' => String},
|
||||||
'status' => String,
|
'status' => String,
|
||||||
'storage' => Integer,
|
'storage' => Integer,
|
||||||
'template' => String
|
'location_id' => String
|
||||||
}
|
}
|
||||||
|
|
||||||
tests('success') do
|
tests('success') do
|
||||||
|
|
||||||
@product_id = '94fd37a7-2606-47f7-84d5-9000deda52ae' # 1 GB
|
@flavor_id = compute_providers[:bluebox][:server_attributes][:flavor_id]
|
||||||
@template_id = compute_providers[:bluebox][:server_attributes][:image_id]
|
@image_id = compute_providers[:bluebox][:server_attributes][:image_id]
|
||||||
@password = 'chunkybacon'
|
@location_id = compute_providers[:bluebox][:server_attributes][:location_id]
|
||||||
|
@password = compute_providers[:bluebox][:server_attributes][:password]
|
||||||
|
|
||||||
@block_id = nil
|
@block_id = nil
|
||||||
|
|
||||||
tests("create_block('#{@product_id}', '#{@template_id}', {'password' => '#{@password}'})").formats(@block_format.merge('add_to_lb_application_results' => {'text' => String})) do
|
tests("create_block('#{@flavor_id}', '#{@image_id}', '#{@location_id}', {'password' => '#{@password}'})").formats(@block_format.merge('add_to_lb_application_results' => {'text' => String})) do
|
||||||
pending if Fog.mocking?
|
pending if Fog.mocking?
|
||||||
data = Fog::Compute[:bluebox].create_block(@product_id, @template_id, {'password' => @password}).body
|
data = Fog::Compute[:bluebox].create_block(@flavor_id, @image_id, @location_id, {'password' => @password}).body
|
||||||
@block_id = data['id']
|
@block_id = data['id']
|
||||||
data
|
data
|
||||||
end
|
end
|
||||||
|
@ -43,7 +44,7 @@ Shindo.tests('Fog::Compute[:bluebox] | block requests', ['bluebox']) do
|
||||||
Fog::Compute[:bluebox].get_blocks.body
|
Fog::Compute[:bluebox].get_blocks.body
|
||||||
end
|
end
|
||||||
|
|
||||||
tests("reboot_block('#{@block_id}')").formats({'status' => String, 'text' => String}) do
|
tests("reboot_block('#{@block_id}')").formats([{'status' => String}, {'text' => String}]) do
|
||||||
pending if Fog.mocking?
|
pending if Fog.mocking?
|
||||||
Fog::Compute[:bluebox].reboot_block(@block_id).body
|
Fog::Compute[:bluebox].reboot_block(@block_id).body
|
||||||
end
|
end
|
||||||
|
|
|
@ -8,6 +8,11 @@ class Bluebox
|
||||||
'cost' => String,
|
'cost' => String,
|
||||||
'description' => String,
|
'description' => String,
|
||||||
'id' => String
|
'id' => String
|
||||||
|
},
|
||||||
|
|
||||||
|
LOCATION = {
|
||||||
|
'id' => String,
|
||||||
|
'description' => String
|
||||||
}
|
}
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
32
tests/bluebox/requests/compute/location_tests.rb
Normal file
32
tests/bluebox/requests/compute/location_tests.rb
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
Shindo.tests('Fog::Compute[:bluebox] | location requests', ['bluebox']) do
|
||||||
|
|
||||||
|
@location_format = {
|
||||||
|
'id' => String,
|
||||||
|
'description' => String
|
||||||
|
}
|
||||||
|
|
||||||
|
tests('success') do
|
||||||
|
|
||||||
|
@location_id = compute_providers[:bluebox][:server_attributes][:location_id]
|
||||||
|
|
||||||
|
tests("get_location('#{@product_id}')").formats(@location_format) do
|
||||||
|
pending if Fog.mocking?
|
||||||
|
Fog::Compute[:bluebox].get_location(@location_id).body
|
||||||
|
end
|
||||||
|
|
||||||
|
tests("get_locations").formats([@location_format]) do
|
||||||
|
pending if Fog.mocking?
|
||||||
|
Fog::Compute[:bluebox].get_locations.body
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
tests('failure') do
|
||||||
|
|
||||||
|
tests("get_location('00000000-0000-0000-0000-000000000000')").raises(Fog::Compute::Bluebox::NotFound) do
|
||||||
|
pending if Fog.mocking?
|
||||||
|
Fog::Compute[:bluebox].get_location('00000000-0000-0000-0000-000000000000')
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
|
@ -1,15 +1,21 @@
|
||||||
Shindo.tests('Fog::Compute[:bluebox] | product requests', ['bluebox']) do
|
Shindo.tests('Fog::Compute[:bluebox] | product requests', ['bluebox']) do
|
||||||
|
|
||||||
|
@product_format = {
|
||||||
|
'id' => String,
|
||||||
|
'description' => String,
|
||||||
|
'cost' => String
|
||||||
|
}
|
||||||
|
|
||||||
tests('success') do
|
tests('success') do
|
||||||
|
|
||||||
@product_id = '94fd37a7-2606-47f7-84d5-9000deda52ae' # 1 GB
|
@flavor_id = compute_providers[:bluebox][:server_attributes][:flavor_id]
|
||||||
|
|
||||||
tests("get_product('#{@product_id}')").formats(Bluebox::Compute::Formats::PRODUCT) do
|
tests("get_product('#{@flavor_id}')").formats(@product_format) do
|
||||||
pending if Fog.mocking?
|
pending if Fog.mocking?
|
||||||
Fog::Compute[:bluebox].get_product(@product_id).body
|
Fog::Compute[:bluebox].get_product(@flavor_id).body
|
||||||
end
|
end
|
||||||
|
|
||||||
tests("get_products").formats([Bluebox::Compute::Formats::PRODUCT]) do
|
tests("get_products").formats([@product_format]) do
|
||||||
pending if Fog.mocking?
|
pending if Fog.mocking?
|
||||||
Fog::Compute[:bluebox].get_products.body
|
Fog::Compute[:bluebox].get_products.body
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,12 +4,14 @@ Shindo.tests('Fog::Compute[:bluebox] | template requests', ['bluebox']) do
|
||||||
'created' => String,
|
'created' => String,
|
||||||
'description' => String,
|
'description' => String,
|
||||||
'id' => String,
|
'id' => String,
|
||||||
'public' => Fog::Boolean
|
'public' => Fog::Boolean,
|
||||||
|
'locations' => [ String ],
|
||||||
|
'status' => String
|
||||||
}
|
}
|
||||||
|
|
||||||
tests('success') do
|
tests('success') do
|
||||||
|
|
||||||
@template_id = '03807e08-a13d-44e4-b011-ebec7ef2c928' # Ubuntu LTS 10.04 64bit
|
@template_id = compute_providers[:bluebox][:server_attributes][:image_id]
|
||||||
|
|
||||||
tests("get_template('#{@template_id}')").formats(@template_format) do
|
tests("get_template('#{@template_id}')").formats(@template_format) do
|
||||||
pending if Fog.mocking?
|
pending if Fog.mocking?
|
||||||
|
|
|
@ -6,7 +6,9 @@ def compute_providers
|
||||||
},
|
},
|
||||||
:bluebox => {
|
:bluebox => {
|
||||||
:server_attributes => {
|
:server_attributes => {
|
||||||
:image_id => '03807e08-a13d-44e4-b011-ebec7ef2c928', # Ubuntu 10.04 64bit
|
:flavor_id => '94fd37a7-2606-47f7-84d5-9000deda52ae', # Block 1GB Virtual Server
|
||||||
|
:image_id => 'a8f05200-7638-47d1-8282-2474ef57c4c3', # Scientific Linux 6
|
||||||
|
:location_id => '37c2bd9a-3e81-46c9-b6e2-db44a25cc675', # Seattle, WA
|
||||||
:password => 'chunkybacon'
|
:password => 'chunkybacon'
|
||||||
},
|
},
|
||||||
:mocked => false
|
:mocked => false
|
||||||
|
|
Loading…
Reference in a new issue