Sha256: 540ca1563c6eac87122bbd42c1f2517942328dac51f78aa67bc4cbd0dcc7d2d8

Contents?: true

Size: 1.79 KB

Versions: 46

Compression:

Stored size: 1.79 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,
      :check_load_balancer_exists
    ]
    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

  def test_check_load_balancer_exists_true_response
    @service.stub :check_load_balancer_exists, true do
      assert @load_balancers.check_load_balancer_exists('fog-test-rg', 'mylb1')
    end
  end

  def test_check_load_balancer_exists_false_response
    @service.stub :check_load_balancer_exists, false do
      assert !@load_balancers.check_load_balancer_exists('fog-test-rg', 'mylb1')
    end
  end
end

Version data entries

46 entries across 46 versions & 4 rubygems

Version Path
fog-azure-rm-0.4.1 test/models/network/test_load_balancers.rb
fog-azure-rm-0.4.0 test/models/network/test_load_balancers.rb
fog-azure-rm-0.3.9 test/models/network/test_load_balancers.rb
fog-azure-rm-0.3.8 test/models/network/test_load_balancers.rb
fog-azure-rm-0.3.7 test/models/network/test_load_balancers.rb
fog-azure-rm-0.3.6 test/models/network/test_load_balancers.rb
fog-azure-rm-0.3.5 test/models/network/test_load_balancers.rb
fog-azure-rm-0.3.4 test/models/network/test_load_balancers.rb
fog-azure-rm-temp-0.0.4 test/models/network/test_load_balancers.rb
fog-azure-rm-temp-0.0.3 test/models/network/test_load_balancers.rb
fog-azure-rm-0.3.3 test/models/network/test_load_balancers.rb
fog-azure-rm-temp-0.0.2 test/models/network/test_load_balancers.rb
fog-azure-rm-temp-0.0.1 test/models/network/test_load_balancers.rb
fog-azure-rm-0.3.2 test/models/network/test_load_balancers.rb
fog-azure-rm-downgraded-0.3.1 test/models/network/test_load_balancers.rb
fog-azure-rm-0.3.1 test/models/network/test_load_balancers.rb
fog-azure-rm-downgraded-0.3.0 test/models/network/test_load_balancers.rb
fog-azure-rm-0.3.0 test/models/network/test_load_balancers.rb
fog-azure-rm-0.2.7 test/models/network/test_load_balancers.rb
fog-azure-rm-0.2.6 test/models/network/test_load_balancers.rb