Sha256: 4c24d7a89419b3cdc5d6eac38055ec80d79acbfdd6426dd667fc7571361e89d1

Contents?: true

Size: 1.59 KB

Versions: 36

Compression:

Stored size: 1.59 KB

Contents

Shindo.tests('Rackspace::Servers | image requests', ['rackspace']) do

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

  tests('success') do

    @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(@image_format.reject {|key,value| key == 'progress'}) do
      data = Rackspace[:servers].create_image(@server.id).body['image']
      @image_id = data['id']
      data
    end

    Rackspace[:servers].images.get(@image_id).wait_for { ready? }

    tests("#get_image_details(#{@image_id})").formats(@image_format) do
      Rackspace[:servers].get_image_details(@image_id).body['image']
    end

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

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

    tests("#delete_image(#{@image_id})").succeeds do
      Rackspace[:servers].delete_image(@image_id)
    end

    @server.destroy

  end

  tests('failure') do

    tests('#delete_image(0)').raises(Excon::Errors::BadRequest) do
      Rackspace[:servers].delete_image(0)
    end

    tests('#get_image_details(0)').raises(Fog::Rackspace::Servers::NotFound) do
      Rackspace[:servers].get_image_details(0)
    end

  end

end

Version data entries

36 entries across 36 versions & 2 rubygems

Version Path
fog-0.2.30 tests/rackspace/requests/servers/image_tests.rb
fog-0.2.28 tests/rackspace/requests/servers/image_tests.rb
fog-0.2.27 tests/rackspace/requests/servers/image_tests.rb
fog-0.2.26 tests/rackspace/requests/servers/image_tests.rb
fog-0.2.25 tests/rackspace/requests/servers/image_tests.rb
fog-0.2.24 tests/rackspace/requests/servers/image_tests.rb
tecnh-fog-0.2.23.vpc tests/rackspace/requests/servers/image_tests.rb
fog-0.2.23 tests/rackspace/requests/servers/image_tests.rb
fog-0.2.22 tests/rackspace/requests/servers/image_tests.rb
fog-0.2.21 tests/rackspace/requests/servers/image_tests.rb
fog-0.2.20 tests/rackspace/requests/servers/image_tests.rb
fog-0.2.19 tests/rackspace/requests/servers/image_tests.rb
fog-0.2.18 tests/rackspace/requests/servers/image_tests.rb
fog-0.2.17 tests/rackspace/requests/servers/image_tests.rb
fog-0.2.16 tests/rackspace/requests/servers/image_tests.rb
fog-0.2.15 tests/rackspace/requests/servers/image_tests.rb
fog-0.2.14 tests/rackspace/requests/servers/image_tests.rb
fog-0.2.13 tests/rackspace/requests/servers/image_tests.rb
fog-0.2.12 tests/rackspace/requests/servers/image_tests.rb
fog-0.2.11 tests/rackspace/requests/servers/image_tests.rb