Sha256: 5b91bfed060b44edd5127d6acd0ae2229818025898cdbcfb718ebc04f731c152

Contents?: true

Size: 1.91 KB

Versions: 45

Compression:

Stored size: 1.91 KB

Contents

Shindo.tests('Fog::Compute[:rackspace] | image requests', ['rackspace']) do

  @image_format = {
    'created'   => Fog::Nullable::String,
    'id'        => Integer,
    'name'      => String,
    'progress'  => Fog::Nullable::Integer,
    'serverId'  => Fog::Nullable::Integer,
    'status'    => String,
    'updated'   => String
  }

  tests('success') do

    @server = Fog::Compute[:rackspace].servers.create(:flavor_id => 1, :image_id => 19)
    @server.wait_for { ready? }
    @image_id = nil

    tests("#create_image(#{@server.id})").formats(@image_format) do
      data = Fog::Compute[:rackspace].create_image(@server.id).body['image']
      @image_id = data['id']
      data
    end

    unless Fog.mocking?
      Fog::Compute[:rackspace].images.get(@image_id).wait_for { ready? }
    end

    tests("#get_image_details(#{@image_id})").formats(@image_format) do
      pending if Fog.mocking?
      Fog::Compute[:rackspace].get_image_details(@image_id).body['image']
    end

    tests('#list_images').formats({'images' => [Rackspace::Compute::Formats::SUMMARY]}) do
      Fog::Compute[:rackspace].list_images.body
    end

    tests('#list_images_detail').formats({'images' => [@image_format]}) do
      Fog::Compute[:rackspace].list_images_detail.body
    end

    unless Fog.mocking?
      Fog::Compute[:rackspace].images.get(@image_id).wait_for { ready? }
    end

    tests("#delete_image(#{@image_id})").succeeds do
      pending if Fog.mocking? # because it will fail without the wait just above here, which won't work
      Fog::Compute[:rackspace].delete_image(@image_id)
    end

    @server.destroy

  end

  tests('failure') do

    tests('#delete_image(0)').raises(Excon::Errors::BadRequest) do
      Fog::Compute[:rackspace].delete_image(0)
    end

    tests('#get_image_details(0)').raises(Fog::Compute::Rackspace::NotFound) do
      pending if Fog.mocking?
      Fog::Compute[:rackspace].get_image_details(0)
    end

  end

end

Version data entries

45 entries across 45 versions & 14 rubygems

Version Path
fog-nirvanix-1.8.2 tests/rackspace/requests/compute/image_tests.rb
fog-nirvanix-1.8.1 tests/rackspace/requests/compute/image_tests.rb
fog-parser-fix-1.6.1 tests/rackspace/requests/compute/image_tests.rb
fog-test-again-1.6.0 tests/rackspace/requests/compute/image_tests.rb
fog-parser-fix-1.6.0 tests/rackspace/requests/compute/image_tests.rb
fog-sgonyea-1.8.1 tests/rackspace/requests/compute/image_tests.rb
fog-1.8.0 tests/rackspace/requests/compute/image_tests.rb
fog-maestrodev-1.7.0.20121114190951 tests/rackspace/requests/compute/image_tests.rb
fog-1.7.0 tests/rackspace/requests/compute/image_tests.rb
fog-1.6.0 tests/rackspace/requests/compute/image_tests.rb
fog-1.5.0 tests/rackspace/requests/compute/image_tests.rb
rackspace-fog-1.4.2 tests/rackspace/requests/compute/image_tests.rb
fog-1.4.0 tests/rackspace/requests/compute/image_tests.rb
brightbox-cli-0.18.1 lib/brightbox-cli/vendor/fog/tests/rackspace/requests/compute/image_tests.rb
michiels-fog-1.3.1 tests/rackspace/requests/compute/image_tests.rb
ftl-0.2.0 vendor/bundle/gems/fog-1.3.1/tests/rackspace/requests/compute/image_tests.rb
brightbox-cli-0.18.0 lib/brightbox-cli/vendor/fog/tests/rackspace/requests/compute/image_tests.rb
fog-1.3.1 tests/rackspace/requests/compute/image_tests.rb
fog-1.3.0 tests/rackspace/requests/compute/image_tests.rb
brightbox-cli-0.17.5 lib/brightbox-cli/vendor/fog/tests/rackspace/requests/compute/image_tests.rb