mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
fixes for/from specs/tests
This commit is contained in:
parent
136442206f
commit
a963703309
142 changed files with 1338 additions and 1335 deletions
|
|
@ -6,21 +6,25 @@ module Bluebox
|
|||
![:bluebox_api_key, :bluebox_customer_id].include?(k)
|
||||
end
|
||||
hash[key] = case key
|
||||
when :blocks
|
||||
Fog::Bluebox.new(credentials)
|
||||
when :compute
|
||||
Fog::Bluebox::Compute.new(credentials)
|
||||
end
|
||||
end
|
||||
@@connections[service]
|
||||
end
|
||||
|
||||
module Formats
|
||||
module Compute
|
||||
|
||||
PRODUCT = {
|
||||
'cost' => Float,
|
||||
'description' => String,
|
||||
'id' => String
|
||||
}
|
||||
module Formats
|
||||
|
||||
PRODUCT = {
|
||||
'cost' => Float,
|
||||
'description' => String,
|
||||
'id' => String
|
||||
}
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
Shindo.tests('Bluebox | block requests', ['bluebox']) do
|
||||
Shindo.tests('Bluebox::Compute | block requests', ['bluebox']) do
|
||||
|
||||
@block_format = {
|
||||
'cpu' => Float,
|
||||
|
|
@ -6,11 +6,10 @@ Shindo.tests('Bluebox | block requests', ['bluebox']) do
|
|||
'id' => String,
|
||||
'ips' => [{'address' => String}],
|
||||
'memory' => Integer,
|
||||
'product' => Bluebox::Formats::PRODUCT,
|
||||
'product' => Bluebox::Compute::Formats::PRODUCT,
|
||||
'status' => String,
|
||||
'storage' => Integer,
|
||||
'template' => String,
|
||||
|
||||
'template' => String
|
||||
}
|
||||
|
||||
tests('success') do
|
||||
|
|
@ -22,45 +21,45 @@ Shindo.tests('Bluebox | block requests', ['bluebox']) do
|
|||
@block_id = nil
|
||||
|
||||
tests("create_block('#{@product_id}', '#{@template_id}', 'password' => '#{@password}')").formats(@block_format) do
|
||||
data = Bluebox[:blocks].create_block(@product_id, @template_id, 'password' => @password).body
|
||||
data = Bluebox[:compute].create_block(@product_id, @template_id, 'password' => @password).body
|
||||
@block_id = data['id']
|
||||
data
|
||||
end
|
||||
|
||||
Bluebox[:blocks].servers.get(@block_id).wait_for { ready? }
|
||||
Bluebox[:compute].servers.get(@block_id).wait_for { ready? }
|
||||
|
||||
tests("get_block('#{@block_id}')").formats(@block_format) do
|
||||
Bluebox[:blocks].get_block(@block_id).body
|
||||
Bluebox[:compute].get_block(@block_id).body
|
||||
end
|
||||
|
||||
tests("get_blocks").formats([@block_format.reject {|key,value| ['product', 'template'].include?(key)}]) do
|
||||
Bluebox[:blocks].get_blocks.body
|
||||
Bluebox[:compute].get_blocks.body
|
||||
end
|
||||
|
||||
tests("reboot_block('#{@block_id}')").formats({'status' => String, 'text' => String}) do
|
||||
Bluebox[:blocks].reboot_block(@block_id).body
|
||||
Bluebox[:compute].reboot_block(@block_id).body
|
||||
end
|
||||
|
||||
Bluebox[:blocks].servers.get(@block_id).wait_for { ready? }
|
||||
Bluebox[:compute].servers.get(@block_id).wait_for { ready? }
|
||||
|
||||
tests("destroy_block('#{@block_id})'").formats({'text' => String}) do
|
||||
Bluebox[:blocks].destroy_block(@block_id).body
|
||||
Bluebox[:compute].destroy_block(@block_id).body
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
tests('failure') do
|
||||
|
||||
tests("get_block('00000000-0000-0000-0000-000000000000')").raises(Fog::Bluebox::NotFound) do
|
||||
Bluebox[:blocks].get_block('00000000-0000-0000-0000-000000000000')
|
||||
tests("get_block('00000000-0000-0000-0000-000000000000')").raises(Fog::Bluebox::Compute::NotFound) do
|
||||
Bluebox[:compute].get_block('00000000-0000-0000-0000-000000000000')
|
||||
end
|
||||
|
||||
tests("reboot_block('00000000-0000-0000-0000-000000000000')").raises(Fog::Bluebox::NotFound) do
|
||||
Bluebox[:blocks].reboot_block('00000000-0000-0000-0000-000000000000')
|
||||
tests("reboot_block('00000000-0000-0000-0000-000000000000')").raises(Fog::Bluebox::Compute::NotFound) do
|
||||
Bluebox[:compute].reboot_block('00000000-0000-0000-0000-000000000000')
|
||||
end
|
||||
|
||||
tests("destroy_block('00000000-0000-0000-0000-000000000000')").raises(Fog::Bluebox::NotFound) do
|
||||
Bluebox[:blocks].destroy_block('00000000-0000-0000-0000-000000000000')
|
||||
tests("destroy_block('00000000-0000-0000-0000-000000000000')").raises(Fog::Bluebox::Compute::NotFound) do
|
||||
Bluebox[:compute].destroy_block('00000000-0000-0000-0000-000000000000')
|
||||
end
|
||||
|
||||
end
|
||||
25
tests/bluebox/requests/compute/product_tests.rb
Normal file
25
tests/bluebox/requests/compute/product_tests.rb
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
Shindo.tests('Bluebox::Compute | product requests', ['bluebox']) do
|
||||
|
||||
tests('success') do
|
||||
|
||||
@product_id = '94fd37a7-2606-47f7-84d5-9000deda52ae' # 1 GB
|
||||
|
||||
tests("get_product('#{@product_id}')").formats(Bluebox::Compute::Formats::PRODUCT) do
|
||||
Bluebox[:compute].get_product(@product_id).body
|
||||
end
|
||||
|
||||
tests("get_products").formats([Bluebox::Compute::Formats::PRODUCT]) do
|
||||
Bluebox[:compute].get_products.body
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
tests('failure') do
|
||||
|
||||
tests("get_product('00000000-0000-0000-0000-000000000000')").raises(Fog::Bluebox::Compute::NotFound) do
|
||||
Bluebox[:compute].get_product('00000000-0000-0000-0000-000000000000')
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
Shindo.tests('Bluebox | template requests', ['bluebox']) do
|
||||
Shindo.tests('Bluebox::Compute | template requests', ['bluebox']) do
|
||||
|
||||
@template_format = {
|
||||
'created' => String,
|
||||
|
|
@ -12,19 +12,19 @@ Shindo.tests('Bluebox | template requests', ['bluebox']) do
|
|||
@template_id = 'a00baa8f-b5d0-4815-8238-b471c4c4bf72' # Ubuntu 9.10 64bit
|
||||
|
||||
tests("get_template('#{@template_id}')").formats(@template_format) do
|
||||
Bluebox[:blocks].get_template(@template_id).body
|
||||
Bluebox[:compute].get_template(@template_id).body
|
||||
end
|
||||
|
||||
tests("get_templates").formats([@template_format]) do
|
||||
Bluebox[:blocks].get_templates.body
|
||||
Bluebox[:compute].get_templates.body
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
tests('failure') do
|
||||
|
||||
tests("get_template('00000000-0000-0000-0000-000000000000')").raises(Fog::Bluebox::NotFound) do
|
||||
Bluebox[:blocks].get_template('00000000-0000-0000-0000-000000000000')
|
||||
tests("get_template('00000000-0000-0000-0000-000000000000')").raises(Fog::Bluebox::Compute::NotFound) do
|
||||
Bluebox[:compute].get_template('00000000-0000-0000-0000-000000000000')
|
||||
end
|
||||
|
||||
end
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
Shindo.tests('Bluebox | product requests', ['bluebox']) do
|
||||
|
||||
tests('success') do
|
||||
|
||||
@product_id = '94fd37a7-2606-47f7-84d5-9000deda52ae' # 1 GB
|
||||
|
||||
tests("get_product('#{@product_id}')").formats(Bluebox::Formats::PRODUCT) do
|
||||
Bluebox[:blocks].get_product(@product_id).body
|
||||
end
|
||||
|
||||
tests("get_products").formats([Bluebox::Formats::PRODUCT]) do
|
||||
Bluebox[:blocks].get_products.body
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
tests('failure') do
|
||||
|
||||
tests("get_product('00000000-0000-0000-0000-000000000000')").raises(Fog::Bluebox::NotFound) do
|
||||
Bluebox[:blocks].get_product('00000000-0000-0000-0000-000000000000')
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue