Sha256: b877a551bea6dfa11d02acb28021316c0fadfed61342d3255e875571016c8171

Contents?: true

Size: 1.38 KB

Versions: 34

Compression:

Stored size: 1.38 KB

Contents

Shindo.tests('Fog::Compute[:vsphere] | list_virtual_machines request', ['vsphere']) do

  key = 'virtual_machines'

  tests("When listing all machines") do

    response = Fog::Compute[:vsphere].list_virtual_machines

    tests("The response data format ...") do
      test("be a kind of Hash") { response.kind_of? Hash }
      test("have a #{key} key") do
        response.has_key? key
      end
      test("it should be a kind of Array") do
        response[key].kind_of? Array
      end
    end
  end

  tests("When providing an instance_uuid") do

    # pending unless Fog.mock?

    tests("that does exist") do
      uuid = "5032c8a5-9c5e-ba7a-3804-832a03e16381"
      response = Fog::Compute[:vsphere].list_virtual_machines({'instance_uuid' => uuid})

      tests("The response should") do
        test("contain one vm") { response[key].length == 1 }
        test("contain that is an attribute hash") { response[key][0].kind_of? Hash }
        test("find jefftest") { response[key].first['name'] == 'jefftest' }
      end
    end

    tests("that does not exist or is a template") do
      %w{ does-not-exist-and-is-not-a-uuid 50323f93-6835-1178-8b8f-9e2109890e1a }.each do |uuid|
        response = Fog::Compute[:vsphere].list_virtual_machines({'instance_uuid' => uuid})

        tests("The response should") do
          test("be empty") { response[key].empty? }
        end
      end
    end
  end

end

Version data entries

34 entries across 34 versions & 11 rubygems

Version Path
fog-parser-fix-1.6.1 tests/vsphere/requests/compute/list_virtual_machines_tests.rb
fog-test-again-1.6.0 tests/vsphere/requests/compute/list_virtual_machines_tests.rb
fog-parser-fix-1.6.0 tests/vsphere/requests/compute/list_virtual_machines_tests.rb
fog-maestrodev-1.7.0.20121114190951 tests/vsphere/requests/compute/list_virtual_machines_tests.rb
fog-1.7.0 tests/vsphere/requests/compute/list_virtual_machines_tests.rb
fog-1.6.0 tests/vsphere/requests/compute/list_virtual_machines_tests.rb
fog-1.5.0 tests/vsphere/requests/compute/list_virtual_machines_tests.rb
rackspace-fog-1.4.2 tests/vsphere/requests/compute/list_virtual_machines_tests.rb
fog-1.4.0 tests/vsphere/requests/compute/list_virtual_machines_tests.rb
brightbox-cli-0.18.1 lib/brightbox-cli/vendor/fog/tests/vsphere/requests/compute/list_virtual_machines_tests.rb
michiels-fog-1.3.1 tests/vsphere/requests/compute/list_virtual_machines_tests.rb
ftl-0.2.0 vendor/bundle/gems/fog-1.3.1/tests/vsphere/requests/compute/list_virtual_machines_tests.rb
brightbox-cli-0.18.0 lib/brightbox-cli/vendor/fog/tests/vsphere/requests/compute/list_virtual_machines_tests.rb
fog-1.3.1 tests/vsphere/requests/compute/list_virtual_machines_tests.rb
fog-1.3.0 tests/vsphere/requests/compute/list_virtual_machines_tests.rb
brightbox-cli-0.17.5 lib/brightbox-cli/vendor/fog/tests/vsphere/requests/compute/list_virtual_machines_tests.rb
fog-1.2.0 tests/vsphere/requests/compute/list_virtual_machines_tests.rb
ktheory-fog-1.1.2 tests/vsphere/requests/compute/list_virtual_machines_tests.rb
brightbox-cli-0.17.4 lib/brightbox-cli/vendor/fog/tests/vsphere/requests/compute/list_virtual_machines_tests.rb
brightbox-cli-0.17.3 lib/brightbox-cli/vendor/fog/tests/vsphere/requests/compute/list_virtual_machines_tests.rb