<commit_before>Shindo.tests('Fog::Compute[:ibm] | key requests', ['ibm']) do

  @key_format  = {
    'default'           => Fog::Boolean,
    'instanceIds'       => Array,
    'keyMaterial'       => String,
    'keyName'           => String,
    'lastModifiedTime'  => Integer
  }

  @keys_format = {
    'keys'     => [ @key_format ]
  }

  tests('success') do

    @key_name  = "fog test key"
    @public_key = <<-EOF
    -----BEGIN RSA PUBLIC KEY-----
    <KEY>
    -----END RSA PUBLIC KEY-----
    EOF
    @public_key.gsub!(/^\s{4}/, '')

    tests("#create_key('#{@key_name}')").formats(@key_format) do
      Fog::Compute[:ibm].create_key(@key_name).body
    end

    tests("#create_key('#{@key_name}', '#{@public_key}')").formats(@key_format) do
      Fog::Compute[:ibm].create_key(@key_name, @public_key).body
    end

    tests("#list_keys").formats(@keys_format) do
      Fog::Compute[:ibm].list_keys.body
    end

    tests("#get_key('#{@key_name}')").formats(@key_format) do
      Fog::Compute[:ibm].get_key(@key_name).body
    end

    tests("#set_default_key('#{@key_name}')") do
      returns(@key_name) { Fog::Compute[:ibm].modify_key(@key_name, 'default' => true).body }
    end

    tests("#update_key('#{@key_name}', 'publicKey' => '#{@public_key}')") do
      returns(true) { Fog::Compute[:ibm].modify_key(@key_name, 'publicKey' => @public_key).body['success'] }
    end

    tests("#delete_key('#{@key_name}')") do
      returns(true) { Fog::Compute[:ibm].delete_key(@key_name).body['success'] }
    end

  end

end<commit_msg>[ibm] Setting default key returns success, not key name<commit_after>Shindo.tests('Fog::Compute[:ibm] | key requests', ['ibm']) do

  @key_format  = {
    'default'           => Fog::Boolean,
    'instanceIds'       => Array,
    'keyMaterial'       => String,
    'keyName'           => String,
    'lastModifiedTime'  => Integer
  }

  @keys_format = {
    'keys'     => [ @key_format ]
  }

  tests('success') do

    @key_name  = "fog test key"
    @public_key = <<-EOF
    -----BEGIN RSA PUBLIC KEY-----
    <KEY>
    <KEY>
    -----END RSA PUBLIC KEY-----
    EOF
    @public_key.gsub!(/^\s{4}/, '')

    tests("#create_key('#{@key_name}')").formats(@key_format) do
      Fog::Compute[:ibm].create_key(@key_name).body
    end

    tests("#create_key('#{@key_name}', '#{@public_key}')").formats(@key_format) do
      Fog::Compute[:ibm].create_key(@key_name, @public_key).body
    end

    tests("#list_keys").formats(@keys_format) do
      Fog::Compute[:ibm].list_keys.body
    end

    tests("#get_key('#{@key_name}')").formats(@key_format) do
      Fog::Compute[:ibm].get_key(@key_name).body
    end

    tests("#set_default_key('#{@key_name}')") do
      returns(true) { Fog::Compute[:ibm].modify_key(@key_name, 'default' => true).body['success'] }
    end

    tests("#update_key('#{@key_name}', 'publicKey' => '#{@public_key}')") do
      returns(true) { Fog::Compute[:ibm].modify_key(@key_name, 'publicKey' => @public_key).body['success'] }
    end

    tests("#delete_key('#{@key_name}')") do
      returns(true) { Fog::Compute[:ibm].delete_key(@key_name).body['success'] }
    end

  end

end
{'fraction_non_alphanumeric': 0.2100253807106599, 'fraction_numerical': 0.0006345177664974619, 'mean_word_length': 3.2608108108108107, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 24, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6801844', 'n_tokens_mistral': 1171, 'n_tokens_neox': 1151, 'n_words': 166}