Sha256: 7a42695d697c0ee249b87b1158b291633ec7a2959dd56f70c1de59fd655d476f

Contents?: true

Size: 1.41 KB

Versions: 1

Compression:

Stored size: 1.41 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
    ]
    methods.each do |method|
      assert @gateways.respond_to? method
    end
  end

  def test_collection_attributes
    assert @gateways.respond_to? :resource_group
  end

  def test_all_method_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 :list_application_gateways, @response do
      assert_instance_of Fog::ApplicationGateway::AzureRM::Gateway, @gateways.get('gateway')
      assert @gateways.get('wrong-name').nil?, true
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fog-azure-rm-0.0.5 test/models/application_gateway/test_gateways.rb