Sha256: b697224e666de62938fde2891c0d9b450d1b27d9e2ac61536f079cbaed1ce3d6

Contents?: true

Size: 1.97 KB

Versions: 5

Compression:

Stored size: 1.97 KB

Contents

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

  tests('success') do

    ## Difficult to test without having uploaded an Image to your account to register
    # creation_options = {
    #   "arch" => "i686",
    #   "source" => "fnord"
    # }
    # tests("#create_image(#{creation_options.inspect})")
    #   result = Fog::Compute[:brightbox].create_image(creation_options)
    #   @image_id = result["id"]
    #   formats(Brightbox::Compute::Formats::Full::IMAGE) { result }
    # end

    # Fog::Compute[:brightbox].images.get(@image_id).wait_for { ready? }

    tests("#list_images") do
      pending if Fog.mocking?
      result = Fog::Compute[:brightbox].list_images
      @image_id = result.first["id"]
      formats(Brightbox::Compute::Formats::Collection::IMAGES) { result }
    end

    tests("#get_image('#{@image_id}')") do
      pending if Fog.mocking?
      result = Fog::Compute[:brightbox].get_image(@image_id)
      formats(Brightbox::Compute::Formats::Full::IMAGE) { result }
    end

    ## Until Image creation can be automated, we shouldn't be updating Images randomly
    # update_options = {}
    # tests("#update_image('#{@image_id}', #{update_options.inspect})") do
    #   result = Fog::Compute[:brightbox].update_image(@image_id, :name => "New name from Fog test")
    #   formats(Brightbox::Compute::Formats::Full::IMAGE) { result }
    # end

    ## Same as other tests - can't be deleting them unless part of the test run
    # tests("#destroy_server('#{@image_id}')") do
    #   result = Fog::Compute[:brightbox].destroy_image(@image_id)
    #   formats(Brightbox::Compute::Formats::Full::IMAGE) { result }
    # end

  end

  tests('failure') do

    tests("#get_image('img-00000')").raises(Excon::Errors::NotFound) do
      pending if Fog.mocking?
      Fog::Compute[:brightbox].get_image('img-00000')
    end

    tests("#get_image").raises(ArgumentError) do
      pending if Fog.mocking?
      Fog::Compute[:brightbox].get_image
    end

  end

end

Version data entries

5 entries across 5 versions & 3 rubygems

Version Path
brightbox-cli-0.17.1 lib/brightbox-cli/vendor/fog/tests/brightbox/requests/compute/image_tests.rb
brightbox-cli-0.17.0 lib/brightbox-cli/vendor/fog/tests/brightbox/requests/compute/image_tests.rb
fog-1.1.2 tests/brightbox/requests/compute/image_tests.rb
fog_tractical-1.1.4 tests/brightbox/requests/compute/image_tests.rb
fog_tractical-1.1.3 tests/brightbox/requests/compute/image_tests.rb