Sha256: fbc0d02fa5e79e256f209e3c8b3c75eab735c9af53b0c12f22de68a3105e7f4a

Contents?: true

Size: 1.04 KB

Versions: 9

Compression:

Stored size: 1.04 KB

Contents

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

require 'helper'

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

  def test_keypair_list
    auth_user

    assert_nothing_raised ActiveResource::ClientError, "Cannot list keypair" do
      keys = OpenStack::Nova::Compute::KeyPair.all

      assert_not_nil keys, "Cannot retrieve key-pairs"
    end

  end

  def test_keypair_create_destroy
    auth_user

    keypair_name = '___my_new_keypair'
    key = nil
    assert_nothing_raised ActiveResource::ClientError, "Cannot create key pair" do
      key = OpenStack::Nova::Compute::KeyPair.create :name => keypair_name
    end
    assert_not_nil key, "Cannot create key pair"

    key = nil
    assert_nothing_raised ActiveResource::ClientError, "Cannot find keypair '#{keypair_name}'" do
      key = OpenStack::Nova::Compute::KeyPair.find_by_name keypair_name
    end

    assert_not_nil key, "Cannot find key pair"

    assert_nothing_raised "Cannot destroy key pair" do
      key.destroy
    end

  end

end

Version data entries

9 entries across 9 versions & 1 rubygems

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