Sha256: 4debfa98e0580e06ccb8a88d32b27eac8094af962b502d9791a6aaed4c607bba

Contents?: true

Size: 1.26 KB

Versions: 46

Compression:

Stored size: 1.26 KB

Contents

#
# Author:: Matt Eldridge (<matt.eldridge@us.ibm.com>)
# © Copyright IBM Corporation 2014.
#
# LICENSE: MIT (http://opensource.org/licenses/MIT)
#

Shindo.tests("Fog::Compute[:softlayer] | KeyPair model", ["softlayer"]) do
  pending unless Fog.mocking?

  @sl_connection = Fog::Compute[:softlayer]
  @key_gen = Proc.new { string='ssh-rsa ';  while string.length < 380 do; string << Fog::Mock.random_base64(1); end; string; }
  @kp1 = @sl_connection.key_pairs.create(:label => 'test-key-1', :key => @key_gen.call)

  tests("success") do

    tests("#label=") do
      returns('new-label') { @kp1.label = 'new-label' }
    end

    tests("#label") do
      returns('new-label') { @kp1.label}
    end

    tests("#key=") do
      @new_key_value = @key_gen.call
      returns(@new_key_value) { @kp1.key = @new_key_value }
    end

    tests("#key") do
      returns(@new_key_value) { @kp1.key }
    end

    tests("#create(:label => 'test-key-2', :key => #{@key_gen.call}") do
      data_matches_schema(Fog::Compute::Softlayer::KeyPair) { @sl_connection.key_pairs.create(:label => 'test-key-2', :key => @key_gen.call)}
    end

    tests("#destroy") do
      returns(true) { @sl_connection.key_pairs.first.destroy }
    end

  end

  tests ("failure") do
    # ToDo: Failure cases.
  end
end

Version data entries

46 entries across 44 versions & 3 rubygems

Version Path
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/fog-softlayer-1.1.4/tests/softlayer/models/compute/key_pair_tests.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/fog-softlayer-1.1.4/tests/softlayer/models/compute/key_pair_tests.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/fog-softlayer-1.1.4/tests/softlayer/models/compute/key_pair_tests.rb
fog-softlayer-1.1.4 tests/softlayer/models/compute/key_pair_tests.rb
fog-softlayer-1.1.3 tests/softlayer/models/compute/key_pair_tests.rb
fog-softlayer-1.1.2 tests/softlayer/models/compute/key_pair_tests.rb
fog-softlayer-1.1.1 tests/softlayer/models/compute/key_pair_tests.rb
fog-softlayer-1.1.0 tests/softlayer/models/compute/key_pair_tests.rb
fog-softlayer-1.0.3 tests/softlayer/models/compute/key_pair_tests.rb
fog-softlayer-1.0.2 tests/softlayer/models/compute/key_pair_tests.rb
fog-softlayer-1.0.1 tests/softlayer/models/compute/key_pair_tests.rb
fog-softlayer-1.0.0 tests/softlayer/models/compute/key_pair_tests.rb
vagrant-cloudstack-1.2.0 vendor/bundle/gems/fog-softlayer-0.4.7/tests/softlayer/models/compute/key_pair_tests.rb
fog-softlayer-0.4.7 tests/softlayer/models/compute/key_pair_tests.rb
fog-softlayer-0.4.6 tests/softlayer/models/compute/key_pair_tests.rb
fog-softlayer-0.4.5 tests/softlayer/models/compute/key_pair_tests.rb
fog-softlayer-0.4.4 tests/softlayer/models/compute/key_pair_tests.rb
fog-softlayer-0.4.3 tests/softlayer/models/compute/key_pair_tests.rb
fog-softlayer-0.4.2 tests/softlayer/models/compute/key_pair_tests.rb
fog-softlayer-0.4.2.pre tests/softlayer/models/compute/key_pair_tests.rb