Sha256: ce81cac1e82f232b4f82fb4ecbed9bd80da589992043b3e7bb03eeadcf1def08

Contents?: true

Size: 1.2 KB

Versions: 44

Compression:

Stored size: 1.2 KB

Contents

Shindo.tests('Fog::Compute::RackspaceV2 | key_pairs', ['rackspace']) do
  service = Fog::Compute::RackspaceV2.new

  name  = Fog::Mock.random_letters(32)
  key   = nil

  tests("API access") do
    begin
        tests("create").succeeds do
          key = service.key_pairs.create({:name => name})
        end

        tests("list all").succeeds do
          service.key_pairs.all
        end

        tests("get").succeeds do
          service.key_pairs.get(name)
        end

        tests("delete").succeeds do
          key = nil if service.key_pairs.destroy(name)
          key == nil
        end

        tests("get unknown").returns(nil) do
          service.key_pairs.get(Fog::Mock.random_letters(32))
        end

        tests("delete unknown").raises(Fog::Compute::RackspaceV2::NotFound) do
            service.key_pairs.destroy(Fog::Mock.random_letters(32))
        end

        tests("create again after delete").succeeds do
          key = service.key_pairs.create({:name => name})
        end

        tests("create already existing").raises(Fog::Compute::RackspaceV2::ServiceError) do
          service.key_pairs.create({:name => name})
        end

    ensure
        key.destroy if key
    end
    
  end
end

Version data entries

44 entries across 44 versions & 3 rubygems

Version Path
fog-1.22.0 tests/rackspace/models/compute_v2/keypairs_tests.rb
fog-1.21.0 tests/rackspace/models/compute_v2/keypairs_tests.rb
fog-maestrodev-1.20.0.20140305101839 tests/rackspace/models/compute_v2/keypairs_tests.rb
fog-maestrodev-1.20.0.20140305101305 tests/rackspace/models/compute_v2/keypairs_tests.rb
fog-maestrodev-1.19.0.20140212012611 tests/rackspace/models/compute_v2/keypairs_tests.rb
fog-1.20.0 tests/rackspace/models/compute_v2/keypairs_tests.rb
fog-maestrodev-1.19.0.20140110004459 tests/rackspace/models/compute_v2/keypairs_tests.rb
fog-maestrodev-1.19.0.20140110003812 tests/rackspace/models/compute_v2/keypairs_tests.rb
fog-maestrodev-1.19.0.20140109202555 tests/rackspace/models/compute_v2/keypairs_tests.rb
fog-maestrodev-1.19.0.20140107192102 tests/rackspace/models/compute_v2/keypairs_tests.rb
fog-maestrodev-1.19.0.20140107142106 tests/rackspace/models/compute_v2/keypairs_tests.rb
fog-maestrodev-1.19.0.20131219203941 tests/rackspace/models/compute_v2/keypairs_tests.rb
fog-maestrodev-1.18.0.20131219193542 tests/rackspace/models/compute_v2/keypairs_tests.rb
fog-1.19.0 tests/rackspace/models/compute_v2/keypairs_tests.rb
fog-maestrodev-1.18.0.20131219033443 tests/rackspace/models/compute_v2/keypairs_tests.rb
fog-maestrodev-1.18.0.20131219032002 tests/rackspace/models/compute_v2/keypairs_tests.rb
fog-maestrodev-1.18.0.20131219030716 tests/rackspace/models/compute_v2/keypairs_tests.rb
fog-maestrodev-1.18.0.20131219022322 tests/rackspace/models/compute_v2/keypairs_tests.rb
fog-maestrodev-1.18.0.20131218202447 tests/rackspace/models/compute_v2/keypairs_tests.rb
fog-maestrodev-1.18.0.20131209091424 tests/rackspace/models/compute_v2/keypairs_tests.rb