Sha256: 3c5f4186c0677ad793c088d44279ba8367c9148a9bc7f0ef67e24a92135814e8

Contents?: true

Size: 1.58 KB

Versions: 108

Compression:

Stored size: 1.58 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
    # Setup
    @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

    # Teardown
    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

108 entries across 108 versions & 12 rubygems

Version Path
fog-maestrodev-1.20.0.20140305101305 tests/openstack/requests/compute/image_tests.rb
fog-maestrodev-1.19.0.20140212012611 tests/openstack/requests/compute/image_tests.rb
fog-1.20.0 tests/openstack/requests/compute/image_tests.rb
fog-maestrodev-1.19.0.20140110004459 tests/openstack/requests/compute/image_tests.rb
fog-maestrodev-1.19.0.20140110003812 tests/openstack/requests/compute/image_tests.rb
fog-maestrodev-1.19.0.20140109202555 tests/openstack/requests/compute/image_tests.rb
fog-maestrodev-1.19.0.20140107192102 tests/openstack/requests/compute/image_tests.rb
fog-maestrodev-1.19.0.20140107142106 tests/openstack/requests/compute/image_tests.rb
fog-maestrodev-1.19.0.20131219203941 tests/openstack/requests/compute/image_tests.rb
fog-maestrodev-1.18.0.20131219193542 tests/openstack/requests/compute/image_tests.rb
fog-1.19.0 tests/openstack/requests/compute/image_tests.rb
fog-maestrodev-1.18.0.20131219033443 tests/openstack/requests/compute/image_tests.rb
fog-maestrodev-1.18.0.20131219032002 tests/openstack/requests/compute/image_tests.rb
fog-maestrodev-1.18.0.20131219030716 tests/openstack/requests/compute/image_tests.rb
fog-maestrodev-1.18.0.20131219022322 tests/openstack/requests/compute/image_tests.rb
fog-maestrodev-1.18.0.20131218202447 tests/openstack/requests/compute/image_tests.rb
fog-maestrodev-1.18.0.20131209091424 tests/openstack/requests/compute/image_tests.rb
fog-maestrodev-1.18.0.20131209090811 tests/openstack/requests/compute/image_tests.rb
fog-maestrodev-1.18.0.20131206115947 tests/openstack/requests/compute/image_tests.rb
fog-maestrodev-1.18.0.20131205181604 tests/openstack/requests/compute/image_tests.rb