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:
parent
5a72002448
commit
785ce38423
36 changed files with 307 additions and 462 deletions
2
Gemfile
2
Gemfile
|
@ -9,5 +9,5 @@ gem 'net-ssh', ">= 0"
|
|||
gem 'nokogiri', ">= 0"
|
||||
gem 'ruby-hmac', ">= 0"
|
||||
gem 'rspec', '>= 0'
|
||||
gem 'shindo', '>= 0'
|
||||
gem 'shindo', '>= 0.1'
|
||||
gem 'builder', '>= 0'
|
||||
|
|
|
@ -39,7 +39,7 @@ dependencies:
|
|||
shindo:
|
||||
group:
|
||||
- :default
|
||||
version: ">= 0"
|
||||
version: ">= 0.1"
|
||||
nokogiri:
|
||||
group:
|
||||
- :default
|
||||
|
@ -54,7 +54,7 @@ specs:
|
|||
- formatador:
|
||||
version: 0.0.14
|
||||
- gestalt:
|
||||
version: 0.0.6
|
||||
version: 0.0.11
|
||||
- json:
|
||||
version: 1.4.3
|
||||
- mime-types:
|
||||
|
@ -68,8 +68,8 @@ specs:
|
|||
- ruby-hmac:
|
||||
version: 0.4.0
|
||||
- shindo:
|
||||
version: 0.0.18
|
||||
hash: 9a6ccfd107913e3f8ca98af1fe437f5d2b7b112a
|
||||
version: 0.1.0
|
||||
hash: 34dbaab023e9759dbe8b2247a6d85fc7ae6095ee
|
||||
sources:
|
||||
- Rubygems:
|
||||
uri: http://gemcutter.org
|
||||
|
|
|
@ -11,6 +11,7 @@ module Fog
|
|||
attribute :name
|
||||
attribute :created_at, 'created'
|
||||
attribute :updated_at, 'updated'
|
||||
attribute :progress
|
||||
attribute :status
|
||||
attribute :server_id, 'serverId'
|
||||
|
||||
|
@ -27,6 +28,10 @@ module Fog
|
|||
true
|
||||
end
|
||||
|
||||
def ready?
|
||||
status == 'ACTIVE'
|
||||
end
|
||||
|
||||
def save
|
||||
requires :server_id
|
||||
|
||||
|
|
|
@ -8,43 +8,46 @@ Shindo.tests('AWS::EC2 | address requests', ['aws']) do
|
|||
|
||||
@public_ip = nil
|
||||
|
||||
test('#allocate_address') do
|
||||
@data = AWS[:ec2].allocate_address.body
|
||||
@public_ip = @data['publicIp']
|
||||
has_format(
|
||||
@data,
|
||||
{
|
||||
'publicIp' => String,
|
||||
'requestId' => String
|
||||
}
|
||||
)
|
||||
tests('#allocate_address').formats({'publicIp' => String, 'requestId' => String}) do
|
||||
data = AWS[:ec2].allocate_address.body
|
||||
@public_ip = data['publicIp']
|
||||
data
|
||||
end
|
||||
|
||||
test("#describe_addresses") do
|
||||
@data = AWS[:ec2].describe_addresses.body
|
||||
has_format(@data, AWS::EC2::Formats::ADDRESSES)
|
||||
tests('#describe_addresses').formats(AWS::EC2::Formats::ADDRESSES) do
|
||||
AWS[:ec2].describe_addresses.body
|
||||
end
|
||||
|
||||
test("#describe_addresses('#{@public_ip}')") do
|
||||
@data = AWS[:ec2].describe_addresses(@public_ip).body
|
||||
has_format(@data, AWS::EC2::Formats::ADDRESSES)
|
||||
tests("#describe_addresses('#{@public_Ip}')").formats(AWS::EC2::Formats::ADDRESSES) do
|
||||
AWS[:ec2].describe_addresses(@public_ip).body
|
||||
end
|
||||
|
||||
test("#associate_address('#{@server.identity}', '#{@public_ip}')") do
|
||||
@data = AWS[:ec2].associate_address(@server.identity, @public_ip).body
|
||||
has_format(@data, AWS::EC2::Formats::BASIC)
|
||||
@server.reload.ip_address == @public_ip
|
||||
tests("#associate_addresses('#{@server.identity}', '#{@public_Ip}')") do
|
||||
|
||||
formats(AWS::EC2::Formats::BASIC) do
|
||||
AWS[:ec2].associate_address(@server.identity, @public_ip).body
|
||||
end
|
||||
|
||||
tests('server.ip_address').returns(@public_ip) do
|
||||
@server.reload.ip_address
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
test("#disassociate_address('#{@public_ip}')") do
|
||||
@data = AWS[:ec2].disassociate_address(@public_ip).body
|
||||
has_format(@data, AWS::EC2::Formats::BASIC)
|
||||
@server.reload.ip_address == @ip_address
|
||||
tests("#dissassociate_address('#{@public_ip}')") do
|
||||
|
||||
formats(AWS::EC2::Formats::BASIC) do
|
||||
AWS[:ec2].disassociate_address(@public_ip).body
|
||||
end
|
||||
|
||||
test("server.ip_address is not #{@public_ip}") do
|
||||
@server.reload.ip_address != @public_ip
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
test("#release_address('#{@public_ip}')") do
|
||||
@data = AWS[:ec2].release_address(@public_ip).body
|
||||
has_format(@data, AWS::EC2::Formats::BASIC)
|
||||
tests("#release_address('#{@public_ip}')").formats(AWS::EC2::Formats::BASIC) do
|
||||
AWS[:ec2].release_address(@public_ip).body
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -52,34 +55,24 @@ Shindo.tests('AWS::EC2 | address requests', ['aws']) do
|
|||
|
||||
@address = AWS[:ec2].addresses.create
|
||||
|
||||
test("#describe_addresses('127.0.0.1') raises BadRequest error") do
|
||||
has_error(Excon::Errors::BadRequest) do
|
||||
AWS[:ec2].describe_addresses('127.0.0.1')
|
||||
end
|
||||
tests("#describe_addresses('127.0.0.1')").raises(Excon::Errors::BadRequest) do
|
||||
AWS[:ec2].describe_addresses('127.0.0.1')
|
||||
end
|
||||
|
||||
test("#associate_addresses('i-00000000', '#{@address.identity}') raises BadRequest error") do
|
||||
has_error(Excon::Errors::BadRequest) do
|
||||
AWS[:ec2].associate_address('i-00000000', @address.identity)
|
||||
end
|
||||
tests("#associate_addresses('i-00000000', '#{@address.identity}')").raises(Excon::Errors::BadRequest) do
|
||||
AWS[:ec2].associate_address('i-00000000', @address.identity)
|
||||
end
|
||||
|
||||
test("#associate_addresses('#{@server.identity}', '127.0.0.1') raises BadRequest error") do
|
||||
has_error(Excon::Errors::BadRequest) do
|
||||
AWS[:ec2].associate_address(@server.identity, '127.0.0.1')
|
||||
end
|
||||
tests("#associate_addresses('#{@server.identity}', '127.0.0.1')").raises(Excon::Errors::BadRequest) do
|
||||
AWS[:ec2].associate_address(@server.identity, '127.0.0.1')
|
||||
end
|
||||
|
||||
test("#disassociate_addresses('127.0.0.1') raises BadRequest error") do
|
||||
has_error(Excon::Errors::BadRequest) do
|
||||
AWS[:ec2].disassociate_address('127.0.0.1')
|
||||
end
|
||||
tests("#disassociate_addresses('127.0.0.1') raises BadRequest error").raises(Excon::Errors::BadRequest) do
|
||||
AWS[:ec2].disassociate_address('127.0.0.1')
|
||||
end
|
||||
|
||||
test("#release_address('127.0.0.1') raises BadRequest error") do
|
||||
has_error(Excon::Errors::BadRequest) do
|
||||
AWS[:ec2].release_address('127.0.0.1')
|
||||
end
|
||||
tests("#release_address('127.0.0.1')").raises(Excon::Errors::BadRequest) do
|
||||
AWS[:ec2].release_address('127.0.0.1')
|
||||
end
|
||||
|
||||
@address.destroy
|
||||
|
|
|
@ -6,41 +6,34 @@ Shindo.tests('AWS::EC2 | snapshot requests', ['aws']) do
|
|||
|
||||
@snapshot_id = nil
|
||||
|
||||
test("#create_snapshot(#{@volume.identity})") do
|
||||
@data = AWS[:ec2].create_snapshot(@volume.identity).body
|
||||
@snapshot_id = @data['snapshotId']
|
||||
has_format(@data, AWS::EC2::Formats::SNAPSHOT.merge('progress' => NilClass, 'requestId' => String))
|
||||
tests("#create_snapshot(#{@volume.identity})").formats(AWS::EC2::Formats::SNAPSHOT.merge('progress' => NilClass, 'requestId' => String)) do
|
||||
data = AWS[:ec2].create_snapshot(@volume.identity).body
|
||||
@snapshot_id = data['snapshotId']
|
||||
data
|
||||
end
|
||||
|
||||
test("#describe_snapshots") do
|
||||
tests("#describe_snapshots").formats(AWS::EC2::Formats::SNAPSHOTS) do
|
||||
AWS[:ec2].snapshots.get(@snapshot_id).wait_for { ready? }
|
||||
@data = AWS[:ec2].describe_snapshots.body
|
||||
has_format(@data, AWS::EC2::Formats::SNAPSHOTS)
|
||||
AWS[:ec2].describe_snapshots.body
|
||||
end
|
||||
|
||||
test("#describe_snapshots('#{@snapshot_id}')") do
|
||||
@data = AWS[:ec2].describe_snapshots(@snapshot_id).body
|
||||
has_format(@data, AWS::EC2::Formats::SNAPSHOTS)
|
||||
tests("#describe_snapshots('#{@snapshot_id}')").formats(AWS::EC2::Formats::SNAPSHOTS) do
|
||||
AWS[:ec2].describe_snapshots(@snapshot_id).body
|
||||
end
|
||||
|
||||
test("#delete_snapshots(#{@snapshot_id})") do
|
||||
@data = AWS[:ec2].delete_snapshot(@snapshot_id).body
|
||||
has_format(@data, AWS::EC2::Formats::BASIC)
|
||||
tests("#delete_snapshots(#{@snapshot_id})").formats(AWS::EC2::Formats::BASIC) do
|
||||
AWS[:ec2].delete_snapshot(@snapshot_id).body
|
||||
end
|
||||
|
||||
end
|
||||
tests ('failure') do
|
||||
|
||||
test("#describe_snapshot('snap-00000000') raises BadRequest error") do
|
||||
has_error(Excon::Errors::BadRequest) do
|
||||
AWS[:ec2].describe_snapshots('snap-00000000')
|
||||
end
|
||||
tests("#describe_snapshot('snap-00000000')").raises(Excon::Errors::BadRequest) do
|
||||
AWS[:ec2].describe_snapshots('snap-00000000')
|
||||
end
|
||||
|
||||
test("#delete_snapshot('snap-00000000') raises BadRequest error") do
|
||||
has_error(Excon::Errors::BadRequest) do
|
||||
AWS[:ec2].delete_snapshot('snap-00000000')
|
||||
end
|
||||
tests("#delete_snapshot('snap-00000000')").raises(Excon::Errors::BadRequest) do
|
||||
AWS[:ec2].delete_snapshot('snap-00000000')
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -7,37 +7,33 @@ Shindo.tests('AWS::EC2 | volume requests', ['aws']) do
|
|||
|
||||
@volume_id = nil
|
||||
|
||||
test('#create_volume') do
|
||||
@data = AWS[:ec2].create_volume(@server.availability_zone, 1).body
|
||||
@volume_id = @data['volumeId']
|
||||
has_format(@data, AWS::EC2::Formats::VOLUME)
|
||||
tests('#create_volume').formats(AWS::EC2::Formats::VOLUME) do
|
||||
data = AWS[:ec2].create_volume(@server.availability_zone, 1).body
|
||||
@volume_id = data['volumeId']
|
||||
data
|
||||
end
|
||||
|
||||
test('#describe_volumes') do
|
||||
@data = AWS[:ec2].describe_volumes.body
|
||||
has_format(@data, AWS::EC2::Formats::VOLUMES)
|
||||
tests('#describe_volumes').formats(AWS::EC2::Formats::VOLUMES) do
|
||||
AWS[:ec2].describe_volumes.body
|
||||
end
|
||||
|
||||
test("#describe_volumes(#{@volume_id})") do
|
||||
@data = AWS[:ec2].describe_volumes.body
|
||||
has_format(@data, AWS::EC2::Formats::VOLUMES)
|
||||
tests("#describe_volumes(#{@volume_id})").formats(AWS::EC2::Formats::VOLUMES) do
|
||||
AWS[:ec2].describe_volumes.body
|
||||
end
|
||||
|
||||
test("#attach_volume(#{@server.identity}, #{@volume_id}, '/dev/sdh')") do
|
||||
@data = AWS[:ec2].attach_volume(@server.identity, @volume_id, '/dev/sdh').body
|
||||
has_format(@data, AWS::EC2::Formats::VOLUME_ATTACHMENT)
|
||||
end
|
||||
|
||||
test("#detach_volume('#{@volume_id}')") do
|
||||
AWS[:ec2].volumes.get(@volume_id).wait_for { state == 'attached' }
|
||||
@data = AWS[:ec2].detach_volume(@volume_id).body
|
||||
has_format(@data, AWS::EC2::Formats::VOLUME_ATTACHMENT)
|
||||
end
|
||||
|
||||
test("#delete_volume('#{@volume_id}')") do
|
||||
tests("#attach_volume(#{@server.identity}, #{@volume_id}, '/dev/sdh')").formats(AWS::EC2::Formats::VOLUME_ATTACHMENT) do
|
||||
AWS[:ec2].volumes.get(@volume_id).wait_for { ready? }
|
||||
@data = AWS[:ec2].delete_volume(@volume_id).body
|
||||
has_format(@data, AWS::EC2::Formats::BASIC)
|
||||
AWS[:ec2].attach_volume(@server.identity, @volume_id, '/dev/sdh').body
|
||||
end
|
||||
|
||||
tests("#detach_volume('#{@volume_id}')").formats(AWS::EC2::Formats::VOLUME_ATTACHMENT) do
|
||||
AWS[:ec2].volumes.get(@volume_id).wait_for { p state; state == 'in-use' }
|
||||
AWS[:ec2].detach_volume(@volume_id).body
|
||||
end
|
||||
|
||||
tests("#delete_volume('#{@volume_id}')").formats(AWS::EC2::Formats::BASIC) do
|
||||
AWS[:ec2].volumes.get(@volume_id).wait_for { ready? }
|
||||
AWS[:ec2].delete_volume(@volume_id).body
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -45,34 +41,24 @@ Shindo.tests('AWS::EC2 | volume requests', ['aws']) do
|
|||
|
||||
@volume = AWS[:ec2].volumes.create(:availability_zone => @server.availability_zone, :size => 1)
|
||||
|
||||
test("#describe_volume('vol-00000000') raises BadRequest error") do
|
||||
has_error(Excon::Errors::BadRequest) do
|
||||
AWS[:ec2].describe_volumes('vol-00000000')
|
||||
end
|
||||
tests("#describe_volume('vol-00000000')").raises(Excon::Errors::BadRequest) do
|
||||
AWS[:ec2].describe_volumes('vol-00000000')
|
||||
end
|
||||
|
||||
test("#attach_volume('i-00000000', '#{@volume.identity}', '/dev/sdh') raises BadRequest error") do
|
||||
has_error(Excon::Errors::BadRequest) do
|
||||
AWS[:ec2].attach_volume('i-00000000', @volume.identity, '/dev/sdh')
|
||||
end
|
||||
tests("#attach_volume('i-00000000', '#{@volume.identity}', '/dev/sdh')").raises(Excon::Errors::BadRequest) do
|
||||
AWS[:ec2].attach_volume('i-00000000', @volume.identity, '/dev/sdh')
|
||||
end
|
||||
|
||||
test("#attach_volume('#{@server.identity}', 'vol-00000000', '/dev/sdh') raises BadRequest error") do
|
||||
has_error(Excon::Errors::BadRequest) do
|
||||
AWS[:ec2].attach_volume(@server.identity, 'vol-00000000', '/dev/sdh')
|
||||
end
|
||||
tests("#attach_volume('#{@server.identity}', 'vol-00000000', '/dev/sdh')").raises(Excon::Errors::BadRequest) do
|
||||
AWS[:ec2].attach_volume(@server.identity, 'vol-00000000', '/dev/sdh')
|
||||
end
|
||||
|
||||
test("#detach_volume('vol-00000000') raises BadRequest error") do
|
||||
has_error(Excon::Errors::BadRequest) do
|
||||
AWS[:ec2].detach_volume('vol-00000000')
|
||||
end
|
||||
tests("#detach_volume('vol-00000000')").raises(Excon::Errors::BadRequest) do
|
||||
AWS[:ec2].detach_volume('vol-00000000')
|
||||
end
|
||||
|
||||
test("#delete_volume('vol-00000000') raises BadRequest error") do
|
||||
has_error(Excon::Errors::BadRequest) do
|
||||
AWS[:ec2].delete_volume('vol-00000000')
|
||||
end
|
||||
tests("#delete_volume('vol-00000000')").raises(Excon::Errors::BadRequest) do
|
||||
AWS[:ec2].delete_volume('vol-00000000')
|
||||
end
|
||||
|
||||
@volume.destroy
|
||||
|
|
|
@ -5,45 +5,60 @@ if ENV["FOG_MOCK"] == "true"
|
|||
Fog.mock!
|
||||
end
|
||||
|
||||
def has_error(error, &block)
|
||||
begin
|
||||
yield
|
||||
@formatador.display_line("[red]did not raise #{error}[/]")
|
||||
false
|
||||
rescue error
|
||||
true
|
||||
end
|
||||
end
|
||||
module Shindo
|
||||
class Tests
|
||||
|
||||
def has_format(original_data, original_format, original = true)
|
||||
valid = true
|
||||
data = original_data.dup
|
||||
format = original_format.dup
|
||||
for key, value in format
|
||||
valid &&= data.has_key?(key)
|
||||
datum = data.delete(key)
|
||||
format.delete(key)
|
||||
case value
|
||||
when Array
|
||||
valid &&= datum.is_a?(Array)
|
||||
for element in datum
|
||||
type = value.first
|
||||
if type.is_a?(Hash)
|
||||
valid &&= has_format({:element => element}, {:element => type}, false)
|
||||
else
|
||||
valid &&= element.is_a?(type)
|
||||
def formats(format, &block)
|
||||
test('has proper format') do
|
||||
formats_kernel(instance_eval(&block), format)
|
||||
end
|
||||
end
|
||||
|
||||
def succeeds(&block)
|
||||
test('succeeds') do
|
||||
begin
|
||||
instance_eval(&block)
|
||||
true
|
||||
rescue Exception, Interrupt
|
||||
false
|
||||
end
|
||||
end
|
||||
when Hash
|
||||
valid &&= datum.is_a?(Hash)
|
||||
valid &&= has_format(datum, value, false)
|
||||
else
|
||||
valid &&= datum.is_a?(value)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def formats_kernel(original_data, original_format, original = true)
|
||||
valid = true
|
||||
data = original_data.dup
|
||||
format = original_format.dup
|
||||
for key, value in format
|
||||
valid &&= data.has_key?(key)
|
||||
datum = data.delete(key)
|
||||
format.delete(key)
|
||||
case value
|
||||
when Array
|
||||
valid &&= datum.is_a?(Array)
|
||||
for element in datum
|
||||
type = value.first
|
||||
if type.is_a?(Hash)
|
||||
valid &&= formats_kernel({:element => element}, {:element => type}, false)
|
||||
else
|
||||
valid &&= element.is_a?(type)
|
||||
end
|
||||
end
|
||||
when Hash
|
||||
valid &&= datum.is_a?(Hash)
|
||||
valid &&= formats_kernel(datum, value, false)
|
||||
else
|
||||
valid &&= datum.is_a?(value)
|
||||
end
|
||||
end
|
||||
valid &&= data.empty? && format.empty?
|
||||
if !valid && original
|
||||
@message = "#{original_data.inspect} does not match #{original_format.inspect}"
|
||||
end
|
||||
valid
|
||||
end
|
||||
|
||||
end
|
||||
valid &&= data.empty? && format.empty?
|
||||
if !valid && original
|
||||
@formatador.display_line("[red]#{original_data.inspect} does not match #{original_format.inspect}[/]")
|
||||
end
|
||||
valid
|
||||
end
|
||||
|
|
|
@ -35,8 +35,10 @@ module Rackspace
|
|||
}
|
||||
|
||||
IMAGE = {
|
||||
'created' => String,
|
||||
'id' => Integer,
|
||||
'name' => String,
|
||||
'progress' => Integer,
|
||||
'serverId' => Integer,
|
||||
'status' => String,
|
||||
'updated' => String
|
||||
|
|
|
@ -1,22 +1,20 @@
|
|||
Shindo.tests('Rackspace::Servers#create_image', 'rackspace') do
|
||||
tests('success') do
|
||||
|
||||
before do
|
||||
@server_id = Rackspace[:servers].create_server(1, 3, 'fogcreateimage').body['server']['id']
|
||||
Fog.wait_for { Rackspace[:servers].get_server_details(@server_id).body['server']['status'] == 'ACTIVE' }
|
||||
@data = Rackspace[:servers].create_image(@server_id).body['image']
|
||||
@image_id = @data['id']
|
||||
@server = Rackspace[:servers].servers.create(:flavor_id => 1, :image_id => 19, :name => 'foggetserverdetails')
|
||||
@server.wait_for { ready? }
|
||||
@image_id = nil
|
||||
|
||||
tests("#create_image(#{@server.id})").formats(Rackspace::Servers::Formats::IMAGE.reject {|key,value| key == 'progress'}) do
|
||||
data = Rackspace[:servers].create_image(@server.id).body['image']
|
||||
@image_id = data['id']
|
||||
data
|
||||
end
|
||||
|
||||
after do
|
||||
Rackspace[:servers].delete_server(@server_id)
|
||||
Fog.wait_for { Rackspace[:servers].get_image_details(@image_id).body['image']['status'] == 'ACTIVE' }
|
||||
Rackspace[:servers].delete_image(@image_id)
|
||||
end
|
||||
|
||||
test('has proper output format') do
|
||||
has_format(@data, Rackspace::Servers::Formats::IMAGE)
|
||||
end
|
||||
@image = Rackspace[:servers].images.get(@image_id)
|
||||
@image.wait_for { ready? }
|
||||
@image.destroy
|
||||
@server.destroy
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,20 +1,18 @@
|
|||
Shindo.tests('Rackspace::Servers#create_server', 'rackspace') do
|
||||
tests('success') do
|
||||
|
||||
before do
|
||||
# 1 => 256MB, 3 => Gentoo
|
||||
@data = Rackspace[:servers].create_server(1, 3).body['server']
|
||||
@server_id = @data['id']
|
||||
@server_id = nil
|
||||
|
||||
tests('#create_server(1, 19)').formats(Rackspace::Servers::Formats::SERVER.merge('adminPass' => String)) do
|
||||
# 1 => 256MB, 19 => Gentoo
|
||||
data = Rackspace[:servers].create_server(1, 19).body['server']
|
||||
@server_id = data['id']
|
||||
data
|
||||
end
|
||||
|
||||
after do
|
||||
Fog.wait_for { Rackspace[:servers].get_server_details(@server_id).body['server']['status'] == 'ACTIVE' }
|
||||
Rackspace[:servers].delete_server(@server_id)
|
||||
end
|
||||
|
||||
test('has proper output format') do
|
||||
has_format(@data, Rackspace::Servers::Formats::SERVER.merge('adminPass' => String))
|
||||
end
|
||||
@server = Rackspace[:servers].servers.get(@server_id)
|
||||
@server.wait_for { ready? }
|
||||
@server.destroy
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,28 +1,22 @@
|
|||
Shindo.tests('Rackspace::Servers#delete_image', 'rackspace') do
|
||||
tests('success') do
|
||||
|
||||
before do
|
||||
@server_id = Rackspace[:servers].create_server(1, 3, 'fogdeleteimage').body['server']['id']
|
||||
@image_id = Rackspace[:servers].create_image(@server_id).body['image']['id']
|
||||
@server = Rackspace[:servers].servers.create(:flavor_id => 1, :image_id => 19, :name => 'foggetserverdetails')
|
||||
@server.wait_for { ready? }
|
||||
@image = Rackspace[:servers].images.create(:server_id => @server.id)
|
||||
@image.wait_for { ready? }
|
||||
|
||||
tests("#delete_image(#{@image.identity})").succeeds do
|
||||
Rackspace[:servers].delete_image(@image.identity)
|
||||
end
|
||||
|
||||
after do
|
||||
Fog.wait_for { Rackspace[:servers].get_server_details(@server_id).body['server']['status'] == 'ACTIVE' }
|
||||
Rackspace[:servers].delete_server(@server_id)
|
||||
end
|
||||
|
||||
test('has proper output format') do
|
||||
Fog.wait_for { Rackspace[:servers].get_image_details(@image_id).body['image']['status'] == 'ACTIVE' }
|
||||
Rackspace[:servers].delete_image(@image_id)
|
||||
end
|
||||
@server.destroy
|
||||
|
||||
end
|
||||
tests('failure') do
|
||||
|
||||
test('raises NotFound error if image does not exist') do
|
||||
has_error(Excon::Errors::NotFound) do
|
||||
Rackspace[:servers].delete_image(0)
|
||||
end
|
||||
tests('#delete_image(0)').raises(Excon::Errors::BadRequest) do
|
||||
Rackspace[:servers].delete_image(0)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,22 +1,18 @@
|
|||
Shindo.tests('Rackspace::Servers#delete_server', 'rackspace') do
|
||||
tests('success') do
|
||||
|
||||
before do
|
||||
@server_id = Rackspace[:servers].create_server(1, 3, 'fogdeleteserver').body['server']['id']
|
||||
end
|
||||
@server = Rackspace[:servers].servers.create(:flavor_id => 1, :image_id => 19, :name => 'foggetserverdetails')
|
||||
@server.wait_for { ready? }
|
||||
|
||||
test('has proper output format') do
|
||||
Fog.wait_for { Rackspace[:servers].get_server_details(@server_id).body['server']['status'] == 'ACTIVE' }
|
||||
Rackspace[:servers].delete_server(@server_id)
|
||||
tests("#delete_server(#{@server.id})").succeeds do
|
||||
Rackspace[:servers].delete_server(@server.id)
|
||||
end
|
||||
|
||||
end
|
||||
tests('failure') do
|
||||
|
||||
test('raises NotFound error if server does not exist') do
|
||||
has_error(Excon::Errors::NotFound) do
|
||||
Rackspace[:servers].delete_server(0)
|
||||
end
|
||||
tests('#delete_server(0)').raises(Excon::Errors::NotFound) do
|
||||
Rackspace[:servers].delete_server(0)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,21 +1,15 @@
|
|||
Shindo.tests('Rackspace::Servers#get_flavor_details', 'rackspace') do
|
||||
tests('success') do
|
||||
|
||||
before do
|
||||
@data = Rackspace[:servers].get_flavor_details(1).body['flavor']
|
||||
end
|
||||
|
||||
test('has proper output format') do
|
||||
has_format(@data, Rackspace::Servers::Formats::FLAVOR)
|
||||
tests('#get_flavor_details(1)').formats(Rackspace::Servers::Formats::FLAVOR) do
|
||||
Rackspace[:servers].get_flavor_details(1).body['flavor']
|
||||
end
|
||||
|
||||
end
|
||||
tests('failure') do
|
||||
|
||||
test('raises NotFound error if flavor does not exist') do
|
||||
has_error(Excon::Errors::NotFound) do
|
||||
Rackspace[:servers].get_flavor_details(0)
|
||||
end
|
||||
tests('#get_flavor_details(0)').raises(Excon::Errors::NotFound) do
|
||||
Rackspace[:servers].get_flavor_details(0)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,21 +1,15 @@
|
|||
Shindo.tests('Rackspace::Servers#get_image_details', 'rackspace') do
|
||||
tests('success') do
|
||||
|
||||
before do
|
||||
@data = Rackspace[:servers].get_image_details(3).body['image']
|
||||
end
|
||||
|
||||
test('has proper output format') do
|
||||
has_format(@data, Rackspace::Servers::Formats::IMAGE)
|
||||
tests('#get_image_details(19)').formats(Rackspace::Servers::Formats::IMAGE.reject {|key, value| ['progress', 'serverId'].include?(key)}) do
|
||||
Rackspace[:servers].get_image_details(19).body['image']
|
||||
end
|
||||
|
||||
end
|
||||
tests('failure') do
|
||||
|
||||
test('raises NotFound error if image does not exist') do
|
||||
has_error(Excon::Errors::NotFound) do
|
||||
Rackspace[:servers].get_image_details(0)
|
||||
end
|
||||
tests('#get_image_details(0)').raises(Excon::Errors::NotFound) do
|
||||
Rackspace[:servers].get_image_details(0)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,27 +1,20 @@
|
|||
Shindo.tests('Rackspace::Servers#get_server_details', 'rackspace') do
|
||||
tests('success') do
|
||||
|
||||
before do
|
||||
@server_id = Rackspace[:servers].create_server(1, 3, 'foggetserverdetails').body['server']['id']
|
||||
@data = Rackspace[:servers].get_server_details(@server_id).body['server']
|
||||
@server = Rackspace[:servers].servers.create(:flavor_id => 1, :image_id => 19, :name => 'foggetserverdetails')
|
||||
|
||||
tests("#get_server_details(#{@server.id})").formats(Rackspace::Servers::Formats::SERVER) do
|
||||
Rackspace[:servers].get_server_details(@server.id).body['server']
|
||||
end
|
||||
|
||||
after do
|
||||
Fog.wait_for { Rackspace[:servers].get_server_details(@server_id).body['server']['status'] == 'ACTIVE' }
|
||||
Rackspace[:servers].delete_server(@server_id)
|
||||
end
|
||||
|
||||
test('has proper output format') do
|
||||
has_format(@data, Rackspace::Servers::Formats::SERVER)
|
||||
end
|
||||
@server.wait_for { ready? }
|
||||
@server.destroy
|
||||
|
||||
end
|
||||
tests('failure') do
|
||||
|
||||
test('raises NotFound error if server does not exist') do
|
||||
has_error(Excon::Errors::NotFound) do
|
||||
Rackspace[:servers].get_server_details(0)
|
||||
end
|
||||
tests('#get_server_details(0)').raises(Excon::Errors::NotFound) do
|
||||
Rackspace[:servers].get_server_details(0)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,27 +1,20 @@
|
|||
Shindo.tests('Rackspace::Servers#list_addresses', 'rackspace') do
|
||||
tests('success') do
|
||||
|
||||
before do
|
||||
@server_id = Rackspace[:servers].create_server(1, 3, 'foglistaddresses').body['server']['id']
|
||||
@data = Rackspace[:servers].list_addresses(@server_id).body
|
||||
@server = Rackspace[:servers].servers.create(:flavor_id => 1, :image_id => 19, :name => 'foglistaddresses')
|
||||
|
||||
tests("#list_addresses(#{@server.id})").formats({'addresses' => {'private' => [String], 'public' => [String]}}) do
|
||||
Rackspace[:servers].list_addresses(@server.id).body
|
||||
end
|
||||
|
||||
after do
|
||||
Fog.wait_for { Rackspace[:servers].get_server_details(@server_id).body['server']['status'] == 'ACTIVE' }
|
||||
Rackspace[:servers].delete_server(@server_id)
|
||||
end
|
||||
|
||||
test('has proper output format') do
|
||||
has_format(@data, {'private' => [String], 'public' => [String]})
|
||||
end
|
||||
@server.wait_for { ready? }
|
||||
@server.destroy
|
||||
|
||||
end
|
||||
tests('failure') do
|
||||
|
||||
test('raises NotFound error if server does not exist') do
|
||||
has_error(Excon::Errors::NotFound) do
|
||||
Rackspace[:servers].list_addresses(0)
|
||||
end
|
||||
tests('#list_addresses(0)').raises(Excon::Errors::NotFound) do
|
||||
Rackspace[:servers].list_addresses(0)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,12 +1,8 @@
|
|||
Shindo.tests('Rackspace::Servers#list_flavors_detail', 'rackspace') do
|
||||
tests('success') do
|
||||
|
||||
before do
|
||||
@data = Rackspace[:servers].list_flavors_detail.body['flavors']
|
||||
end
|
||||
|
||||
test('has proper output format') do
|
||||
has_format(@data, [Rackspace::Servers::Formats::FLAVOR])
|
||||
tests('#list_flavors_detail').formats({'flavors' => [Rackspace::Servers::Formats::FLAVOR]}) do
|
||||
Rackspace[:servers].list_flavors_detail.body
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,12 +1,8 @@
|
|||
Shindo.tests('Rackspace::Servers#list_flavors', 'rackspace') do
|
||||
tests('success') do
|
||||
|
||||
before do
|
||||
@data = Rackspace[:servers].list_flavors.body['flavors']
|
||||
end
|
||||
|
||||
test('has proper output format') do
|
||||
has_format(@data, Rackspace::Servers::Formats::SUMMARY)
|
||||
tests('#list_flavors').formats({'flavors' => [Rackspace::Servers::Formats::SUMMARY]}) do
|
||||
Rackspace[:servers].list_flavors.body
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,12 +1,8 @@
|
|||
Shindo.tests('Rackspace::Servers#list_images_detail', 'rackspace') do
|
||||
tests('success') do
|
||||
|
||||
before do
|
||||
@data = Rackspace[:servers].list_images_detail.body['images']
|
||||
end
|
||||
|
||||
test('has proper output format') do
|
||||
has_format(@data, Rackspace::Servers::Formats::IMAGE)
|
||||
tests('#list_images_detail').formats({'images' => [Rackspace::Servers::Formats::IMAGE]})
|
||||
Rackspace[:servers].list_images_detail.body
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,12 +1,8 @@
|
|||
Shindo.tests('Rackspace::Servers#list_images', 'rackspace') do
|
||||
tests('success') do
|
||||
|
||||
before do
|
||||
@data = Rackspace[:servers].list_images.body['images']
|
||||
end
|
||||
|
||||
test('has proper output format') do
|
||||
has_format(@data, Rackspace::Servers::Formats::SUMMARY)
|
||||
tests('#list_images').formats({'images' => [Rackspace::Servers::Formats::SUMMARY]}) do
|
||||
Rackspace[:servers].list_images.body
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,27 +1,20 @@
|
|||
Shindo.tests('Rackspace::Servers#list_private_addresses', 'rackspace') do
|
||||
tests('success') do
|
||||
|
||||
before do
|
||||
@server_id = Rackspace[:servers].create_server(1, 3, 'foglistprivateaddresses').body['server']['id']
|
||||
@data = Rackspace[:servers].list_private_addresses(@server_id).body
|
||||
@server = Rackspace[:servers].servers.create(:flavor_id => 1, :image_id => 19, :name => 'foglistprivateaddresses')
|
||||
|
||||
tests("#list_private_addresses(#{@server.id})").formats({'private' => [String]}) do
|
||||
Rackspace[:servers].list_private_addresses(@server.id).body
|
||||
end
|
||||
|
||||
after do
|
||||
Fog.wait_for { Rackspace[:servers].get_server_details(@server_id).body['server']['status'] == 'ACTIVE' }
|
||||
Rackspace[:servers].delete_server(@server_id)
|
||||
end
|
||||
|
||||
test('has proper output format') do
|
||||
has_format(@data, [String])
|
||||
end
|
||||
@server.wait_for { ready? }
|
||||
@server.destroy
|
||||
|
||||
end
|
||||
tests('failure') do
|
||||
|
||||
test('raises NotFound error if server does not exist') do
|
||||
has_error(Excon::Errors::NotFound) do
|
||||
Rackspace[:servers].list_private_addresses(0)
|
||||
end
|
||||
tests('#list_private_addresses(0)').raises(Excon::Errors::NotFound) do
|
||||
Rackspace[:servers].list_private_addresses(0)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,27 +1,20 @@
|
|||
Shindo.tests('Rackspace::Servers#list_public_addresses', 'rackspace') do
|
||||
tests('success') do
|
||||
|
||||
before do
|
||||
@server_id = Rackspace[:servers].create_server(1, 3, 'foglistpublicaddresses').body['server']['id']
|
||||
@data = Rackspace[:servers].list_public_addresses(@server_id).body
|
||||
@server = Rackspace[:servers].servers.create(:flavor_id => 1, :image_id => 19, :name => 'foglistpublicaddresses')
|
||||
|
||||
tests("#list_public_addresses(#{@server.id})").formats({'public' => [String]}) do
|
||||
Rackspace[:servers].list_public_addresses(@server.id).body
|
||||
end
|
||||
|
||||
after do
|
||||
Fog.wait_for { Rackspace[:servers].get_server_details(@server_id).body['server']['status'] == 'ACTIVE' }
|
||||
Rackspace[:servers].delete_server(@server_id)
|
||||
end
|
||||
|
||||
test('has proper output format') do
|
||||
has_format(@data, [String])
|
||||
end
|
||||
@server.wait_for { ready? }
|
||||
@server.destroy
|
||||
|
||||
end
|
||||
tests('failure') do
|
||||
|
||||
test('raises NotFound error if server does not exist') do
|
||||
has_error(Excon::Errors::NotFound) do
|
||||
Rackspace[:servers].list_public_addresses(0)
|
||||
end
|
||||
tests('#list_public_addresses(0)').raises(Excon::Errors::NotFound) do
|
||||
Rackspace[:servers].list_public_addresses(0)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,19 +1,14 @@
|
|||
Shindo.tests('Rackspace::Servers#list_servers_detail', 'rackspace') do
|
||||
tests('success') do
|
||||
|
||||
before do
|
||||
@server_id = Rackspace[:servers].create_server(1, 3, 'foglistserversdetail').body['server']['id']
|
||||
@data = Rackspace[:servers].list_servers_detail.body['servers']
|
||||
@server = Rackspace[:servers].servers.create(:flavor_id => 1, :image_id => 19, :name => 'foglistserversdetail')
|
||||
|
||||
tests('#list_servers_detail').formats({'servers' => [Rackspace::Servers::Formats::SERVER]}) do
|
||||
Rackspace[:servers].list_servers_detail.body
|
||||
end
|
||||
|
||||
after do
|
||||
Fog.wait_for { Rackspace[:servers].get_server_details(@server_id).body['server']['status'] == 'ACTIVE' }
|
||||
Rackspace[:servers].delete_server(@server_id)
|
||||
end
|
||||
|
||||
test('has proper output format') do
|
||||
has_format(@data, Rackspace::Servers::Formats::SERVER)
|
||||
end
|
||||
@server.wait_for { ready? }
|
||||
@server.destroy
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,19 +1,14 @@
|
|||
Shindo.tests('Rackspace::Servers#list_servers', 'rackspace') do
|
||||
tests('success') do
|
||||
|
||||
before do
|
||||
@server_id = Rackspace[:servers].create_server(1, 3, 'foglistservers').body['server']['id']
|
||||
@data = Rackspace[:servers].list_servers.body['servers']
|
||||
@server = Rackspace[:servers].servers.create(:flavor_id => 1, :image_id => 19, :name => 'foglistservers')
|
||||
|
||||
tests('#list_servers').formats({'servers' => [Rackspace::Servers::Formats::SUMMARY]}) do
|
||||
Rackspace[:servers].list_servers.body
|
||||
end
|
||||
|
||||
after do
|
||||
Fog.wait_for { Rackspace[:servers].get_server_details(@server_id).body['server']['status'] == 'ACTIVE' }
|
||||
Rackspace[:servers].delete_server(@server_id)
|
||||
end
|
||||
|
||||
test('has proper output format') do
|
||||
has_format(@data, Rackspace::Servers::Formats::SUMMARY)
|
||||
end
|
||||
@server.wait_for { ready? }
|
||||
@server.destroy
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,36 +1,28 @@
|
|||
Shindo.tests('Rackspace::Servers#reboot_server', 'rackspace') do
|
||||
tests('success') do
|
||||
|
||||
@server = Rackspace[:servers].servers.create(:flavor_id => 1, :image_id => 19, :name => 'fogrebootserver')
|
||||
|
||||
before do
|
||||
@server_id = Rackspace[:servers].create_server(1, 3, 'fogrebootserver').body['server']['id']
|
||||
@server.wait_for { ready? }
|
||||
end
|
||||
|
||||
after do
|
||||
Fog.wait_for { Rackspace[:servers].get_server_details(@server_id).body['server']['status'] == 'ACTIVE' }
|
||||
Rackspace[:servers].delete_server(@server_id)
|
||||
tests("#reboot_server(#{@server.id}, 'HARD')").succeeds do
|
||||
Rackspace[:servers].reboot_server(@server.id, 'HARD')
|
||||
end
|
||||
|
||||
tests('HARD') do
|
||||
test('has proper output format') do
|
||||
Fog.wait_for { Rackspace[:servers].get_server_details(@server_id).body['server']['status'] == 'ACTIVE' }
|
||||
Rackspace[:servers].reboot_server(@server_id, 'HARD')
|
||||
end
|
||||
tests("#reboot_server(#{@server.id}, 'SOFT')").succeeds do
|
||||
Rackspace[:servers].reboot_server(@server.id, 'SOFT')
|
||||
end
|
||||
|
||||
tests('SOFT') do
|
||||
test('has proper output format') do
|
||||
Fog.wait_for { Rackspace[:servers].get_server_details(@server_id).body['server']['status'] == 'ACTIVE' }
|
||||
Rackspace[:servers].reboot_server(@server_id, 'SOFT')
|
||||
end
|
||||
end
|
||||
@server.wait_for { ready? }
|
||||
@server.destroy
|
||||
|
||||
end
|
||||
tests('failure') do
|
||||
|
||||
test('raises NotFound error if server does not exist') do
|
||||
has_error(Excon::Errors::NotFound) do
|
||||
Rackspace[:servers].reboot_server(0)
|
||||
end
|
||||
tests('#reboot_server(0)').raises(Excon::Errors::NotFound) do
|
||||
Rackspace[:servers].reboot_server(0)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,27 +1,20 @@
|
|||
Shindo.tests('Rackspace::Servers#update_server', 'rackspace') do
|
||||
tests('success') do
|
||||
|
||||
before do
|
||||
@server_id = Rackspace[:servers].create_server(1, 3, 'fogupdateserver').body['server']['id']
|
||||
Fog.wait_for { Rackspace[:servers].get_server_details(@server_id).body['server']['status'] == 'ACTIVE' }
|
||||
@data = Rackspace[:servers].update_server(@server_id, :name => 'fogupdatedserver', :adminPass => 'fogupdatedserver')
|
||||
@server = Rackspace[:servers].servers.create(:flavor_id => 1, :image_id => 19, :name => 'fogupdateserver')
|
||||
@server.wait_for { ready? }
|
||||
|
||||
tests("#update_server(#{@server.id}, :name => 'fogupdatedserver', :adminPass => 'fogupdatedserver')").succeeds do
|
||||
Rackspace[:servers].update_server(@server.id, :name => 'fogupdatedserver', :adminPass => 'fogupdatedserver')
|
||||
end
|
||||
|
||||
after do
|
||||
Rackspace[:servers].delete_server(@server_id)
|
||||
end
|
||||
|
||||
test('has proper output format') do
|
||||
has_format(@data, {'name' => String, 'adminPass' => String})
|
||||
end
|
||||
@server.destroy
|
||||
|
||||
end
|
||||
tests('failure') do
|
||||
|
||||
test('raises NotFound error if server does not exist') do
|
||||
has_error(Excon::Errors::NotFound) do
|
||||
Rackspace[:servers].update_server(0, :name => 'fogupdatedserver', :adminPass => 'fogupdatedserver')
|
||||
end
|
||||
tests("#update_server(0, :name => 'fogupdatedserver', :adminPass => 'fogupdatedserver')").raises(Excon::Errors::NotFound) do
|
||||
Rackspace[:servers].update_server(0, :name => 'fogupdatedserver', :adminPass => 'fogupdatedserver')
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue