1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

update tests to shindo 0.1

This commit is contained in:
geemus 2010-05-21 14:43:29 -07:00
parent 5a72002448
commit 785ce38423
36 changed files with 307 additions and 462 deletions

View file

@ -1,19 +1,14 @@
Shindo.tests('Slicehost#create_slice', 'slicehost') do
tests('success') do
before do
@data = Slicehost[:slices].create_slice(1, 3, 'fogcreateslice').body
@id = @data['id']
tests("#create_slice(1, 19, 'fogcreateslice')").formats(Slicehost::Formats::SLICE.merge('root-password' => String)) do
data = Slicehost[:slices].create_slice(1, 19, 'fogcreateslice').body
@id = data['id']
data
end
after do
Fog.wait_for { Slicehost[:slices].get_slice(@id).body['status'] == 'active' }
Slicehost[:slices].delete_slice(@id)
end
test('has proper output format') do
has_format(@data, Slicehost::Formats::SLICE.merge('root-password' => String))
end
Fog.wait_for { Slicehost[:slices].get_slice(@id).body['status'] == 'active' }
Slicehost[:slices].delete_slice(@id)
end
end

View file

@ -1,12 +1,9 @@
Shindo.tests('Slicehost#delete_slice', 'slicehost') do
tests('success') do
before do
@data = Slicehost[:slices].create_slice(1, 3, 'fogdeleteslice').body
@id = @data['id']
end
@id = Slicehost[:slices].create_slice(1, 19, 'fogdeleteslice').body['id']
test('has proper output format') do
tests("#delete_slice(#{@id})").succeeds do
Fog.wait_for { Slicehost[:slices].get_slice(@id).body['status'] == 'active' }
Slicehost[:slices].delete_slice(@id)
end
@ -15,10 +12,8 @@ Shindo.tests('Slicehost#delete_slice', 'slicehost') do
tests('failure') do
test('raises NotFound error if slice does not exist') do
has_error(Excon::Errors::NotFound) do
Slicehost[:slices].delete_slice(0)
end
tests('delete_slice(0)').raises(Excon::Errors::NotFound) do
Slicehost[:slices].delete_slice(0)
end
end

View file

@ -1,12 +1,8 @@
Shindo.tests('Slicehost#get_backups', 'slicehost') do
tests('success') do
before do
@data = Slicehost[:slices].get_backups.body
end
test('has proper output format') do
has_format(@data, { 'backups' => [Slicehost::Formats::BACKUP] })
tests('#get_backups').formats({ 'backups' => [Slicehost::Formats::BACKUP] }) do
Slicehost[:slices].get_backups.body
end
end

View file

@ -1,22 +1,16 @@
Shindo.tests('Slicehost#get_flavor', 'slicehost') do
tests('success') do
before do
@data = Slicehost[:slices].get_flavor(1).body
end
test('has proper output format') do
has_format(@data, Slicehost::Formats::FLAVOR)
tests('#get_flavor(1)').formats(Slicehost::Formats::FLAVOR) do
Slicehost[:slices].get_flavor(1).body
end
end
tests('failure') do
test('raises Forbidden error if flavor does not exist') do
has_error(Excon::Errors::Forbidden) do
Slicehost[:slices].get_flavor(0)
end
tests('#get_flavor(0)').raises(Excon::Errors::Forbidden) do
Slicehost[:slices].get_flavor(0)
end
end

View file

@ -1,12 +1,8 @@
Shindo.tests('Slicehost#get_flavors', 'slicehost') do
tests('success') do
before do
@data = Slicehost[:slices].get_flavors.body
end
test('has proper output format') do
has_format(@data, { 'flavors' => [Slicehost::Formats::FLAVOR] })
tests('#get_flavors').formats({ 'flavors' => [Slicehost::Formats::FLAVOR] }) do
Slicehost[:slices].get_flavors.body
end
end

View file

@ -1,22 +1,16 @@
Shindo.tests('Slicehost#get_image', 'slicehost') do
tests('success') do
before do
@data = Slicehost[:slices].get_image(3).body
end
test('has proper output format') do
has_format(@data, Slicehost::Formats::IMAGE)
tests('#get_image(19)').formats(Slicehost::Formats::IMAGE) do
Slicehost[:slices].get_image(19).body
end
end
tests('failure') do
test('raises Forbidden error if flavor does not exist') do
has_error(Excon::Errors::Forbidden)
Slicehost[:slices].get_image(0)
end
tests('#get_image(0)').raises(Excon::Errors::Forbidden) do
Slicehost[:slices].get_image(0)
end
end

View file

@ -1,12 +1,8 @@
Shindo.tests('Slicehost#get_images', 'slicehost') do
tests('success') do
before do
@data = Slicehost[:slices].get_images.body
end
test('has proper output format') do
has_format(@data, { 'images' => [Slicehost::Formats::IMAGE] })
tests('#get_images').formats({ 'images' => [Slicehost::Formats::IMAGE] }) do
Slicehost[:slices].get_images.body
end
end

View file

@ -1,29 +1,21 @@
Shindo.tests('Slicehost#get_slice', 'slicehost') do
tests('success') do
before do
@data = Slicehost[:slices].create_slice(1, 3, 'foggetslice').body
@id = @data['id']
@data = Slicehost[:slices].get_slice(@id).body
@server = Slicehost[:slices].servers.create(:flavor_id => 1, :image_id => 19, :name => 'fogrebootslice')
tests("#get_slice(#{@server.id})").formats(Slicehost::Formats::SLICE) do
Slicehost[:slices].get_slice(@server.id).body
end
after do
Fog.wait_for { Slicehost[:slices].get_slice(@id).body['status'] == 'active' }
Slicehost[:slices].delete_slice(@id)
end
test('has proper output format') do
has_format(@data, Slicehost::Formats::SLICE)
end
@server.wait_for { ready? }
@server.destroy
end
tests('failure') do
test('raises Forbidden error if flavor does not exist') do
has_error(Excon::Errors::Forbidden)
Slicehost[:slices].get_slice(0)
end
tests('#get_slice(0)').raises(Excon::Errors::Forbidden) do
Slicehost[:slices].get_slice(0)
end
end

View file

@ -1,12 +1,8 @@
Shindo.tests('Slicehost#get_slices', 'slicehost') do
tests('success') do
before do
@data = Slicehost[:slices].get_slices.body
end
test('has proper output format') do
has_format(@data, { 'slices' => [Slicehost::Formats::SLICE] })
formats({'slices' => [Slicehost::Formats::SLICE]}) do
Slicehost[:slices].get_slices.body
end
end

View file

@ -1,30 +1,22 @@
Shindo.tests('Slicehost#reboot_slice', 'slicehost') do
tests('success') do
before do
@data = Slicehost[:slices].create_slice(1, 3, 'fogrebootslice').body
@id = @data['id']
Fog.wait_for { Slicehost[:slices].get_slice(@id).body['status'] == 'active' }
@data = Slicehost[:slices].reboot_slice(@id).body
@server = Slicehost[:slices].servers.create(:flavor_id => 1, :image_id => 19, :name => 'fogrebootslice')
@server.wait_for { ready? }
tests("#reboot_slice(#{@server.id})").formats(Slicehost::Formats::SLICE) do
Slicehost[:slices].reboot_slice(@server.id).body
end
after do
Fog.wait_for { Slicehost[:slices].get_slice(@id).body['status'] == 'active' }
Slicehost[:slices].delete_slice(@id)
end
test('has proper output format') do
has_format(@data, Slicehost::Formats::SLICE)
end
@server.wait_for { ready? }
@server.destroy
end
tests('failure') do
test('raises Forbidden error if flavor does not exist') do
has_error(Excon::Errors::Forbidden) do
Slicehost[:slices].reboot_slice(0)
end
tests('#reboot_slice(0)').raises(Excon::Errors::Forbidden) do
Slicehost[:slices].reboot_slice(0)
end
end