Sha256: 2755ca8907d2b5aa887d624b699d0a6da737a75ee446954c03f2762d364c2274

Contents?: true

Size: 1.58 KB

Versions: 9

Compression:

Stored size: 1.58 KB

Contents

test_path = File.expand_path('..', __FILE__)
$:.unshift(test_path)

require 'helper'

class TestOpenStackActiveResource < Test::Unit::TestCase
  include OpenstackTestUtils

  # Keystone

  # Authentication

  def test_10_authentications
    OpenStack::Keystone::Public::Base.site = TEST_CONFIG[:public_base_site]

    # User auth
    assert_nothing_raised ActiveResource::ClientError, "Cannot authenticate as user" do
      auth = OpenStack::Keystone::Public::Auth.create :username => TEST_CONFIG[:user_username],
                                                      :password => TEST_CONFIG[:user_password],
                                                      :tenant_id => TEST_CONFIG[:user_tenant_id]

      assert_not_nil auth.token, "Cannot authenticate as user"

      auth = OpenStack::Keystone::Public::Auth.create :username => "baduser",
                                                      :password => "badpassword",
                                                      :tenant_id => TEST_CONFIG[:user_tenant_id]

      assert_nil auth.token, "Authentication seems broken!"
    end

    # Admin auth
    return unless admin_test_possible?

    assert_nothing_raised ActiveResource::ClientError, "Cannot authenticate as admin" do
      auth = OpenStack::Keystone::Public::Auth.create :username => TEST_CONFIG[:admin_username],
                                                      :password => TEST_CONFIG[:admin_password],
                                                      :tenant_id => TEST_CONFIG[:admin_tenant_id]

      assert_not_nil auth.token, "Cannot authenticate as admin"
    end

  end

end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
openstack_activeresource-0.7.1 test/test_keystone_authentications.rb
openstack_activeresource-0.7.0 test/test_keystone_authentications.rb
openstack_activeresource-0.6.3 test/test_keystone_authentications.rb
openstack_activeresource-0.6.2 test/test_keystone_authentications.rb
openstack_activeresource-0.6.1 test/test_keystone_authentications.rb
openstack_activeresource-0.6.0 test/test_keystone_authentications.rb
openstack_activeresource-0.5.2 test/test_keystone_authentications.rb
openstack_activeresource-0.5.1 test/test_keystone_authentications.rb
openstack_activeresource-0.5.0 test/test_keystone_authentications.rb