Sha256: 0f2c77455ef280d1fe68d97256c8a7693cb24542381d590474093bb2ee87da1c

Contents?: true

Size: 1.28 KB

Versions: 3

Compression:

Stored size: 1.28 KB

Contents

require File.expand_path '../../test_helper', __dir__

# Test class for Servers Collection
class TestServers < Minitest::Test
  def setup
    @service = Fog::Compute::AzureRM.new(credentials)
    @servers = Fog::Compute::AzureRM::Servers.new(resource_group: 'fog-test-rg', service: @service)
    @compute_client = @service.instance_variable_get(:@compute_mgmt_client)
    @response = ApiStub::Models::Compute::Server.create_windows_virtual_machine_response(@compute_client)
  end

  def test_collection_methods
    methods = [
      :all,
      :get
    ]
    methods.each do |method|
      assert_respond_to @servers, method
    end
  end

  def test_collection_attributes
    assert_respond_to @servers, :resource_group
  end

  def test_all_method_response
    response = [@response]
    @service.stub :list_virtual_machines, response do
      assert_instance_of Fog::Compute::AzureRM::Servers, @servers.all
      assert @servers.all.size >= 1
      @servers.all.each do |s|
        assert_instance_of Fog::Compute::AzureRM::Server, s
      end
    end
  end

  def test_get_method_response
    @service.stub :get_virtual_machine, @response do
      assert_instance_of Fog::Compute::AzureRM::Server, @servers.get('fog-test-rg', 'fog-test-server')
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fog-azure-rm-0.1.1 test/models/compute/test_servers.rb
fog-azure-rm-0.1.0 test/models/compute/test_servers.rb
fog-azure-rm-0.0.9 test/models/compute/test_servers.rb