Sha256: c4711074e5824c23cd2c32b4739eea611c514353c7b5784ccb7cbe903b444317

Contents?: true

Size: 1.34 KB

Versions: 4

Compression:

Stored size: 1.34 KB

Contents

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

# Test class for LoadBalancer Collection
class TestLoadBalancers < Minitest::Test
  def setup
    @service = Fog::Network::AzureRM.new(credentials)
    @load_balancers = Fog::Network::AzureRM::LoadBalancers.new(resource_group: 'fog-test-rg', service: @service)
    @network_client = @service.instance_variable_get(:@network_client)
    @response = ApiStub::Models::Network::LoadBalancer.create_load_balancer_response(@network_client)
  end

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

  def test_collection_attributes
    assert_respond_to @load_balancers, :resource_group
  end

  def test_all_method_response
    response = [@response]
    @service.stub :list_load_balancers, response do
      assert_instance_of Fog::Network::AzureRM::LoadBalancers, @load_balancers.all
      assert @load_balancers.all.size >= 1
      @load_balancers.all.each do |lb|
        assert_instance_of Fog::Network::AzureRM::LoadBalancer, lb
      end
    end
  end

  def test_get_method_response
    @service.stub :get_load_balancer, @response do
      assert_instance_of Fog::Network::AzureRM::LoadBalancer, @load_balancers.get('fog-test-rg', 'mylb1')
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fog-azure-rm-0.1.2 test/models/network/test_load_balancers.rb
fog-azure-rm-0.1.1 test/models/network/test_load_balancers.rb
fog-azure-rm-0.1.0 test/models/network/test_load_balancers.rb
fog-azure-rm-0.0.9 test/models/network/test_load_balancers.rb