Sha256: 19ac33fd9deb337bc615b38080ecb50828a0fc45ca7e586892e5511587a39a0a

Contents?: true

Size: 1.91 KB

Versions: 46

Compression:

Stored size: 1.91 KB

Contents

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

# Test class for ExpressRouteCircuit Collection
class TestExpressRouteCircuits < Minitest::Test
  def setup
    @service = Fog::Network::AzureRM.new(credentials)
    @circuits = Fog::Network::AzureRM::ExpressRouteCircuits.new(resource_group: 'fog-test-rg', service: @service)
    @network_client = @service.instance_variable_get(:@network_client)
  end

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

  def test_collection_attributes
    assert_respond_to @circuits, :resource_group
  end

  def test_all_method_response
    response = [ApiStub::Models::Network::ExpressRouteCircuit.create_express_route_circuit_response(@network_client)]
    @service.stub :list_express_route_circuits, response do
      assert_instance_of Fog::Network::AzureRM::ExpressRouteCircuits, @circuits.all
      assert @circuits.all.size >= 1
      @circuits.all.each do |circuit|
        assert_instance_of Fog::Network::AzureRM::ExpressRouteCircuit, circuit
      end
    end
  end

  def test_get_method_response
    response = ApiStub::Models::Network::ExpressRouteCircuit.create_express_route_circuit_response(@network_client)
    @service.stub :get_express_route_circuit, response do
      assert_instance_of Fog::Network::AzureRM::ExpressRouteCircuit, @circuits.get('HaiderRG', 'testCircuit')
    end
  end

  def test_check_express_route_circuit_exists_true_response
    @service.stub :check_express_route_circuit_exists, true do
      assert @circuits.check_express_route_circuit_exists('HaiderRG', 'testCircuit')
    end
  end

  def test_check_express_route_circuit_exists_false_response
    @service.stub :check_express_route_circuit_exists, false do
      assert !@circuits.check_express_route_circuit_exists('HaiderRG', 'testCircuit')
    end
  end
end

Version data entries

46 entries across 46 versions & 4 rubygems

Version Path
fog-azure-rm-0.6.0 test/models/network/test_express_route_circuits.rb
fog-azure-rm-0.5.3 test/models/network/test_express_route_circuits.rb
fog-azure-rm-0.5.2 test/models/network/test_express_route_circuits.rb
far-gem-0.5.6 test/models/network/test_express_route_circuits.rb
fog-azure-rm-0.5.1 test/models/network/test_express_route_circuits.rb
far-gem-0.5.5 test/models/network/test_express_route_circuits.rb
fog-azure-rm-0.5.0 test/models/network/test_express_route_circuits.rb
far-gem-0.5.4 test/models/network/test_express_route_circuits.rb
far-gem-0.5.3 test/models/network/test_express_route_circuits.rb
fog-azure-rm-0.4.9 test/models/network/test_express_route_circuits.rb
far-gem-0.5.2 test/models/network/test_express_route_circuits.rb
fog-azure-rm-0.4.8 test/models/network/test_express_route_circuits.rb
fog-azure-rm-0.4.7 test/models/network/test_express_route_circuits.rb
fog-azure-rm-0.4.6 test/models/network/test_express_route_circuits.rb
fog-azure-rm-0.4.5 test/models/network/test_express_route_circuits.rb
fog-azure-rm-temp-0.0.5 test/models/network/test_express_route_circuits.rb
fog-azure-rm-0.4.4 test/models/network/test_express_route_circuits.rb
fog-azure-rm-0.4.3 test/models/network/test_express_route_circuits.rb
far-gem-0.5.1 test/models/network/test_express_route_circuits.rb
fog-azure-rm-0.4.2 test/models/network/test_express_route_circuits.rb