Sha256: 4623bb61639e356bc6fba9b6928890bb012146c5682ac318f89aa78d6cdc1499

Contents?: true

Size: 1.55 KB

Versions: 3

Compression:

Stored size: 1.55 KB

Contents

$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
require 'tests/drivers/rhevm/common'

module RHEVMTest

  class ImagesTest < Test::Unit::TestCase
    include Rack::Test::Methods

    def app
      Rack::Builder.new {
        map '/' do
          use Rack::Static, :urls => ["/stylesheets", "/javascripts"], :root => "public"
          run Rack::Cascade.new([Deltacloud::API])
        end
      }
    end

    def test_01_it_returns_images
      get_auth_url '/api;driver=rhevm/images'
      puts last_response.body
      (last_xml_response/'images/image').length.should > 0
    end

    def test_02_each_image_has_correct_properties
      get_auth_url '/api;driver=rhevm/images'
      (last_xml_response/'images/image').each do |image|
        (image/'name').should_not == nil
        (image/'name').should_not == ''
        (image/'description').should_not == nil
        (image/'description').should_not == ''
        (image/'architecture').should_not == nil
        (image/'architecture').should_not == ''
        (image/'state').text.should == 'OK'
        (image/'owner_id').text.should == ENV['API_USER']
        (image/'actions/link').length.should == 1
        (image/'actions/link').first[:rel].should == 'create_instance'
      end
    end

    def test_03_it_returns_single_image
      get_auth_url '/api;driver=rhevm/images/3e82e2d5-913f-4095-ae72-ebcfa9d0571d'
      (last_xml_response/'image').length.should == 1
      (last_xml_response/'image/name').text.should == 'f15-minimal-2'
      (last_xml_response/'image/state').text.should == 'OK'
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
deltacloud-core-1.0.2 tests/deprecated/drivers/rhevm/images_test.rb
deltacloud-core-1.0.1 tests/drivers/rhevm/images_test.rb
deltacloud-core-1.0.0 tests/drivers/rhevm/images_test.rb