Sha256: cb01375cbfa5048d7409a5f001474a916b49566e2d17c20e676f752d8be332b6

Contents?: true

Size: 1.56 KB

Versions: 30

Compression:

Stored size: 1.56 KB

Contents

require 'fog/openstack'

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

  @image_format = {
    'created'   => Fog::Nullable::String,
    'id'        => String,
    'name'      => String,
    'progress'  => Fog::Nullable::Integer,
    'status'    => String,
    'updated'   => String,
    'minRam'    => Integer,
    'minDisk'   => Integer,
    'server'    => Fog::Nullable::Hash,
    'metadata'  => Hash,
    'links'  => Array
  }

  tests('success') do

    @image_id = Fog::Compute[:openstack].images[0].id

    unless Fog.mocking?
      Fog::Compute[:openstack].images.get(@image_id).wait_for { ready? }
    end
    tests("#get_image_details(#{@image_id})").formats(@image_format) do
      pending if Fog.mocking?
      Fog::Compute[:openstack].get_image_details(@image_id).body['image']
    end

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

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

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

  end

  tests('failure') do

    tests('#delete_image(0)').raises(Fog::Compute::OpenStack::NotFound) do
      pending if Fog.mocking?
      Fog::Compute[:openstack].delete_image(0)
    end

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

  end

end

Version data entries

30 entries across 30 versions & 10 rubygems

Version Path
fog-parser-fix-1.6.1 tests/openstack/requests/compute/image_tests.rb
fog-test-again-1.6.0 tests/openstack/requests/compute/image_tests.rb
fog-parser-fix-1.6.0 tests/openstack/requests/compute/image_tests.rb
fog-1.6.0 tests/openstack/requests/compute/image_tests.rb
fog-1.5.0 tests/openstack/requests/compute/image_tests.rb
rackspace-fog-1.4.2 tests/openstack/requests/compute/image_tests.rb
fog-1.4.0 tests/openstack/requests/compute/image_tests.rb
brightbox-cli-0.18.1 lib/brightbox-cli/vendor/fog/tests/openstack/requests/compute/image_tests.rb
michiels-fog-1.3.1 tests/openstack/requests/compute/image_tests.rb
ftl-0.2.0 vendor/bundle/gems/fog-1.3.1/tests/openstack/requests/compute/image_tests.rb
brightbox-cli-0.18.0 lib/brightbox-cli/vendor/fog/tests/openstack/requests/compute/image_tests.rb
fog-1.3.1 tests/openstack/requests/compute/image_tests.rb
fog-1.3.0 tests/openstack/requests/compute/image_tests.rb
brightbox-cli-0.17.5 lib/brightbox-cli/vendor/fog/tests/openstack/requests/compute/image_tests.rb
fog-1.2.0 tests/openstack/requests/compute/image_tests.rb
ktheory-fog-1.1.2 tests/openstack/requests/compute/image_tests.rb
brightbox-cli-0.17.4 lib/brightbox-cli/vendor/fog/tests/openstack/requests/compute/image_tests.rb
brightbox-cli-0.17.3 lib/brightbox-cli/vendor/fog/tests/openstack/requests/compute/image_tests.rb
brightbox-cli-0.17.2 lib/brightbox-cli/vendor/fog/tests/openstack/requests/compute/image_tests.rb
brightbox-cli-0.17.1 lib/brightbox-cli/vendor/fog/tests/openstack/requests/compute/image_tests.rb