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

  tests('success') do
    # TODO: Fix this for non-mock tests
    @server         = nil
    @instance_id    = nil

    @name           = "fog-test-instance-" + Time.now.to_i.to_s(32)
    @image_id       = "20015393"
    @instance_type  = "BRZ32.1/2048/60*175"
    @location_id    = "101"

    @key_name       = "fog-test-key-" + Time.now.to_i.to_s(32)
    @key            = Fog::Compute[:ibm].keys.create(:name => @key_name)

    tests('Fog::Compute::IBM::Server.new') do
      @server = Fog::Compute[:ibm].servers.new(
        :name           => @name,
        :image_id       => @image_id,
        :instance_type  => @instance_type,
        :location_id    => @location,
        :key_name       => @key_name
      )
      returns(@name) { @server.name }
    end

    tests('Fog::Compute::IBM::Server#save') do
      returns(true)   { @server.save }
      returns(String) { @server.id.class }
      @instance_id = @server.id
    end

    tests('Fog::Compute::IBM::Server#wait_for { ready? }') do
      @server = Fog::Compute[:ibm].servers.get(@instance_id)
      @server.wait_for { ready? }
    end

    tests('Fog::Compute::IBM::Server#id') do
      returns(@instance_id) { @server.id }
    end

    tests('Fog::Compute::IBM::Server#ready?') do
      returns(true) { @server.ready? }
    end

    tests('Fog::Compute::IBM::Server#status') do
      returns("Active") { @server.state }
    end

    tests('Fog::Compute::IBM::Server#reboot') do
      returns(true) { @server.reboot }
    end

    tests('Fog::Compute::IBM::Server#rename("name")') do
      name = @server.name + "-rename"
      returns(true) { @server.rename(name) }
      returns(name) { @server.name }
    end

    tests('Fog::Compute::IBM::Server#image') do
      returns(@image_id) { @server.image.id }
    end

    tests('Fog::Compute::IBM::Server#to_image') do
      data = @server.to_image(:name => @server.name)
      returns(@server.name) { data['name'] }
      returns(true) { Fog::Compute[:ibm].delete_image(data['id']).body['success'] }
    end

    tests('Fog::Compute::IBM::Server#expire!') do
      returns(true) { @server.expire! }
    end

    tests('Fog::Compute::IBM::Server#destroy') do
      returns(true) { @server.destroy }
    end

    @key.wait_for { instance_ids.empty? }
    @key.destroy

  end

end<commit_msg>[ibm] Rename data -> body<commit_after>Shindo.tests('Fog::Compute[:ibm] | server', ['ibm']) do

  tests('success') do
    # TODO: Fix this for non-mock tests
    @server         = nil
    @instance_id    = nil

    @name           = "fog-test-instance-" + Time.now.to_i.to_s(32)
    @image_id       = "20015393"
    @instance_type  = "BRZ32.1/2048/60*175"
    @location_id    = "101"

    @key_name       = "fog-test-key-" + Time.now.to_i.to_s(32)
    @key            = Fog::Compute[:ibm].keys.create(:name => @key_name)

    tests('Fog::Compute::IBM::Server.new') do
      @server = Fog::Compute[:ibm].servers.new(
        :name           => @name,
        :image_id       => @image_id,
        :instance_type  => @instance_type,
        :location_id    => @location,
        :key_name       => @key_name
      )
      returns(@name) { @server.name }
    end

    tests('Fog::Compute::IBM::Server#save') do
      returns(true)   { @server.save }
      returns(String) { @server.id.class }
      @instance_id = @server.id
    end

    tests('Fog::Compute::IBM::Server#wait_for { ready? }') do
      @server = Fog::Compute[:ibm].servers.get(@instance_id)
      @server.wait_for { ready? }
    end

    tests('Fog::Compute::IBM::Server#id') do
      returns(@instance_id) { @server.id }
    end

    tests('Fog::Compute::IBM::Server#ready?') do
      returns(true) { @server.ready? }
    end

    tests('Fog::Compute::IBM::Server#status') do
      returns("Active") { @server.state }
    end

    tests('Fog::Compute::IBM::Server#reboot') do
      returns(true) { @server.reboot }
    end

    tests('Fog::Compute::IBM::Server#rename("name")') do
      name = @server.name + "-rename"
      returns(true) { @server.rename(name) }
      returns(name) { @server.name }
    end

    tests('Fog::Compute::IBM::Server#image') do
      returns(@image_id) { @server.image.id }
    end

    tests('Fog::Compute::IBM::Server#to_image') do
      body = @server.to_image(:name => @server.name)
      returns(@server.name) { body['name'] }
      returns(true) { Fog::Compute[:ibm].delete_image(body['id']).body['success'] }
    end

    tests('Fog::Compute::IBM::Server#expire!') do
      returns(true) { @server.expire! }
    end

    tests('Fog::Compute::IBM::Server#destroy') do
      returns(true) { @server.destroy }
    end

    @key.wait_for { instance_ids.empty? }
    @key.destroy

  end

end
{'fraction_non_alphanumeric': 0.17849643007139857, 'fraction_numerical': 0.01133977320453591, 'mean_word_length': 2.715288611544462, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 18, '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': '3857126', 'n_tokens_mistral': 1743, 'n_tokens_neox': 1693, 'n_words': 252}