Sha256: 5b49062f81b4c094891459d80e9ee313349cfb64b5da9dc01a2febfc1b886939

Contents?: true

Size: 1.48 KB

Versions: 123

Compression:

Stored size: 1.48 KB

Contents

Shindo.tests("Fog::Compute[:joyent] | key requests", ['joyent']) do

  @key_format = {
    "name" => String,
    "key" => String,
    "created" => Time,
    "updated" => Time
  }

  before do
    #
    # Clear out all the test keys on the account in prep for test
    #
    Fog::Compute[:joyent].list_keys.body.each do |key|
      if key["name"] =~ /^fog-test/
        Fog::Compute[:joyent].delete_key(key["name"])
      end
    end

    @test_key_name = "fog-test-#{Time.now.utc.to_i}"

    Fog::Compute[:joyent].create_key(
      :name => @test_key_name,
      :key => "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDWxSNYngOTeu0pYd+2tpfYGISuMfMUNGyAIh4yRprAbacVddRq4Nyr12vDklzaRTzgd9PgX/82JMb4RARbVTtUKXJXmaBLvg2epGM+ScanZIitzL53whJrlGx+7nT+TnRdkB1XG7uIf2EpTQBaKrT4iG0magCXh5bmOqCyWte2gV8fArMg5bZclUT1p2E7qEW0htaLOiMSyGkjBlxb6vYQCA/Pa8VWETHehIF46S942gCj0aaL81gTocfyTm5/F+AgvUAsjHzRVkB/Dlhwq7Q7sK+4iAhlKPYMflkKC8r+nF0/LL9S3lllLZvbkEWJfEqlMCAbgmjTpYlBzQEqf/eN"
    )
  end

  tests("#list_keys").formats(@key_format) do
    Fog::Compute[:joyent].list_keys.body.first
  end

  tests("#get_key").formats(@key_format) do
    Fog::Compute[:joyent].get_key(@test_key_name).body
  end

  tests("#delete_key") do
    returns(204 , "returns status code 204") do
      Fog::Compute[:joyent].delete_key(@test_key_name).status
    end

    raises(Excon::Errors::NotFound, "when a key no longer exists") do
      Fog::Compute[:joyent].delete_key(@test_key_name)
      Fog::Compute[:joyent].delete_key(@test_key_name)
    end
  end

end

Version data entries

123 entries across 121 versions & 20 rubygems

Version Path
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/fog-joyent-0.0.1/tests/joyent/requests/compute/keys_tests.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/fog-joyent-0.0.1/tests/joyent/requests/compute/keys_tests.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/fog-joyent-0.0.1/tests/joyent/requests/compute/keys_tests.rb
fog-joyent-0.0.1 tests/joyent/requests/compute/keys_tests.rb
fog-1.40.0 tests/joyent/requests/compute/keys_tests.rb
fog-1.39.0 tests/joyent/requests/compute/keys_tests.rb
fog-1.38.0 tests/joyent/requests/compute/keys_tests.rb
fog-1.37.0 tests/joyent/requests/compute/keys_tests.rb
fog-1.36.0 tests/joyent/requests/compute/keys_tests.rb
fog-1.35.0 tests/joyent/requests/compute/keys_tests.rb
fog-2.0.0.pre.0 tests/joyent/requests/compute/keys_tests.rb
vagrant-cloudstack-1.2.0 vendor/bundle/gems/fog-1.32.0/tests/joyent/requests/compute/keys_tests.rb
fog-1.34.0 tests/joyent/requests/compute/keys_tests.rb
fog-1.33.0 tests/joyent/requests/compute/keys_tests.rb
fog-1.32.0 tests/joyent/requests/compute/keys_tests.rb
fog-1.31.0 tests/joyent/requests/compute/keys_tests.rb
vagrant-cloudstack-1.1.0 vendor/bundle/gems/fog-1.22.1/tests/joyent/requests/compute/keys_tests.rb
fog-1.30.0 tests/joyent/requests/compute/keys_tests.rb
fog-1.29.0 tests/joyent/requests/compute/keys_tests.rb
fog-1.28.0 tests/joyent/requests/compute/keys_tests.rb