Sha256: 7e5a8f20093d34df0d808d3981593165c6c65260541f3c9eb32219944908a5f4

Contents?: true

Size: 1.6 KB

Versions: 3

Compression:

Stored size: 1.6 KB

Contents

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

module OpenstackTest

  class ApiTest < 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_entry_points
      get_auth_url '/api;driver=openstack/?force_auth=1'
      (last_xml_response/'/api').first[:driver].should == 'openstack'
      (last_xml_response/'/api/link').length.should > 0
    end

    def test_02_it_has_openstack_features
      get_url '/api;driver=openstack'
      features = (last_xml_response/'/api/link[@rel="instances"]/feature').collect { |f| f[:name] }
      features.include?('user_name').should == true
      features.include?('authentication_password').should == true
      features.include?('user_files').should == true
      features.length.should == 3
    end

    def test_03_it_has_openstack_collections
      get_url '/api;driver=openstack'
      collections = (last_xml_response/'/api/link').collect { |f| f[:rel] }
      collections.include?('instance_states').should == true
      collections.include?('instances').should == true
      collections.include?('images').should == true
      collections.include?('buckets').should == true # NOT YET IMPLEMENTED FOR V2 driver
      collections.include?('realms').should == true
      collections.include?('hardware_profiles').should == true
      collections.length.should == 7
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
deltacloud-core-1.0.2 tests/deprecated/drivers/openstack/api_test.rb
deltacloud-core-1.0.1 tests/drivers/openstack/api_test.rb
deltacloud-core-1.0.0 tests/drivers/openstack/api_test.rb