Class: Torpedo::Compute::Keypairs

Inherits:
Test::Unit::TestCase
  • Object
show all
Defined in:
lib/torpedo/compute/keypairs.rb

Constant Summary collapse

@@key_pairs =
[]
@@key_pair =

ref to last created key_pair

nil
@@key_pair_name =

ref to last created key_pair

'torpedo'

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.key_pairObject

public access to the key_pair ref



12
13
14
# File 'lib/torpedo/compute/keypairs.rb', line 12

def self.key_pair
  @@key_pair
end

Instance Method Details

#create_key_pair(options) ⇒ Object



20
21
22
23
24
# File 'lib/torpedo/compute/keypairs.rb', line 20

def create_key_pair(options)
  @@key_pair = @conn.key_pairs.create(options)
  @@key_pairs << @@key_pair
  @@key_pair
end

#setupObject



16
17
18
# File 'lib/torpedo/compute/keypairs.rb', line 16

def setup
  @conn=Helper::get_connection
end

#test_001_create_key_pairObject



26
27
28
29
30
31
32
# File 'lib/torpedo/compute/keypairs.rb', line 26

def test_001_create_key_pair
  public_key = IO.read(SSH_PUBLIC_KEY)
  options = {:public_key => public_key, :name => @@key_pair_name}
  key_pair = create_key_pair(options)
  assert_equal(@@key_pair_name, key_pair.name)
  assert_equal(public_key, key_pair.public_key)
end