Sha256: 3d5b9eecf0e49e7d89c4e4a4b5e875f3c5c865e881b1f837e88b8ffe74adb329

Contents?: true

Size: 1.78 KB

Versions: 46

Compression:

Stored size: 1.78 KB

Contents

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

# Test class for ApplicationGateway Collection
class TestGateways < Minitest::Test
  def setup
    @service = Fog::ApplicationGateway::AzureRM.new(credentials)
    @gateways = Fog::ApplicationGateway::AzureRM::Gateways.new(resource_group: 'fog-test-rg', service: @service)
    @gateway_client = @service.instance_variable_get(:@network_client)
    @response = ApiStub::Models::ApplicationGateway::Gateway.create_application_gateway_response(@gateway_client)
  end

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

  def test_collection_attributes
    assert_respond_to @gateways, :resource_group
  end

  def test_all_method_response
    response = [@response]
    @service.stub :list_application_gateways, response do
      assert_instance_of Fog::ApplicationGateway::AzureRM::Gateways, @gateways.all
      assert @gateways.all.size >= 1
      @gateways.all.each do |application_gateway|
        assert_instance_of Fog::ApplicationGateway::AzureRM::Gateway, application_gateway
      end
    end
  end

  def test_get_method_response
    @service.stub :get_application_gateway, @response do
      assert_instance_of Fog::ApplicationGateway::AzureRM::Gateway, @gateways.get('fog-test-rg', 'gateway')
    end
  end

  def test_check_application_gateway_exists_true_case
    @service.stub :check_ag_exists, true do
      assert @gateways.check_application_gateway_exists('fog-test-rg', 'gateway')
    end
  end

  def test_check_application_gateway_exists_false_case
    @service.stub :check_ag_exists, false do
      assert !@gateways.check_application_gateway_exists('fog-test-rg', 'gateway')
    end
  end
end

Version data entries

46 entries across 46 versions & 4 rubygems

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