Sha256: 9bb18dc38d3950aca4f47edb7fc2eb47e49b22e47b2b02f7cc6712cf18fdaec6

Contents?: true

Size: 1.16 KB

Versions: 1

Compression:

Stored size: 1.16 KB

Contents

lib_path = File.expand_path('../../lib', __FILE__)
$:.unshift(lib_path)

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

require 'helper'
require 'openstack_activeresource'
require 'utils'

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

1 entries across 1 versions & 1 rubygems

Version Path
openstack_activeresource-0.4.0 test/test_nova_keypairs.rb