Sha256: 131223642656acd8084e6f1353531a2c60bd8a0a91649c3cbc5f4732892b9542

Contents?: true

Size: 1.65 KB

Versions: 36

Compression:

Stored size: 1.65 KB

Contents

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

  @machine_format = {
    "id" => String,
    "name" => String,
    "type" => String,
    "state" => String,
    "dataset" => String,
    "memory" => Integer,
    "disk" => Integer,
    "ips" => Array,
    "metadata" => Hash,
    "created" => Time,
    "updated" => Time
  }

  if Fog.mock?
    @machines = Fog::Compute[:joyent].data[:machines] = {
      "15080eca-3786-4bb8-a4d0-f43e1981cd72" => {
        "id" => "15080eca-3786-4bb8-a4d0-f43e1981cd72",
        "name" => "getting-started",
        "type" => "smartmachine",
        "state" => "running",
        "dataset" => "sdc:sdc:smartos:1.3.15",
        "memory" => 256,
        "disk" => 5120,
        "ips" => ["10.88.88.50"],
        "metadata" => {},
        "created" => Time.parse("2011-06-03T00:02:31+00:00"),
        "updated" => Time.parse("2011-06-03T00:02:31+00:00")
      }
    }
  end

  @provider = Fog::Compute[:joyent]

  #
  # https://us-west-1.api.joyentcloud.com/docs#ListMachines
  #
  tests("#list_machines") do
    if Fog.mock?
      returns(@machines.length, "correct number of machines") do
        @provider.list_machines.body.length
      end
    end

    returns(Array, "returns an Array of machines") do
      @provider.list_machines.body.class
    end

    formats([@machine_format]) do
      @provider.list_machines.body
    end
  end

  # https://us-west-1.api.joyentcloud.com/docs#GetMachine
  tests("#get_machine") do
    machines = @provider.list_machines.body
    unless machines.empty?
      formats(@machine_format) do
        id = machines.first["id"]
        @provider.get_machine(id).body
      end
    end
  end
end

Version data entries

36 entries across 34 versions & 6 rubygems

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