Sha256: 2e346e05d6e56fdc009f3ca4b932546d5834486fd7332c6e30e1957dc2f032db

Contents?: true

Size: 1.98 KB

Versions: 46

Compression:

Stored size: 1.98 KB

Contents

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

# Test class for NetworkInterface Collection
class TestNetworkInterfaces < Minitest::Test
  def setup
    @service = Fog::Network::AzureRM.new(credentials)
    @network_interfaces = Fog::Network::AzureRM::NetworkInterfaces.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_network_interface_exists
    ]
    methods.each do |method|
      assert_respond_to @network_interfaces, method
    end
  end

  def test_collection_attributes
    assert_respond_to @network_interfaces, :resource_group
  end

  def test_all_method_response
    response = [ApiStub::Models::Network::NetworkInterface.create_network_interface_response(@network_client)]
    @service.stub :list_network_interfaces, response do
      assert_instance_of Fog::Network::AzureRM::NetworkInterfaces, @network_interfaces.all
      assert @network_interfaces.all.size >= 1
      @network_interfaces.all.each do |nic|
        assert_instance_of Fog::Network::AzureRM::NetworkInterface, nic
      end
    end
  end

  def test_get_method_response
    response = ApiStub::Models::Network::NetworkInterface.create_network_interface_response(@network_client)
    @service.stub :get_network_interface, response do
      assert_instance_of Fog::Network::AzureRM::NetworkInterface, @network_interfaces.get('fog-test-rg', 'fog-test-network-interface')
    end
  end

  def test_check_network_interface_exists_true_response
    @service.stub :check_network_interface_exists, true do
      assert @network_interfaces.check_network_interface_exists('fog-test-rg', 'fog-test-network-interface')
    end
  end

  def test_check_network_interface_exists_false_response
    @service.stub :check_network_interface_exists, false do
      assert !@network_interfaces.check_network_interface_exists('fog-test-rg', 'fog-test-network-interface')
    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_network_interfaces.rb
fog-azure-rm-0.5.3 test/models/network/test_network_interfaces.rb
fog-azure-rm-0.5.2 test/models/network/test_network_interfaces.rb
far-gem-0.5.6 test/models/network/test_network_interfaces.rb
fog-azure-rm-0.5.1 test/models/network/test_network_interfaces.rb
far-gem-0.5.5 test/models/network/test_network_interfaces.rb
fog-azure-rm-0.5.0 test/models/network/test_network_interfaces.rb
far-gem-0.5.4 test/models/network/test_network_interfaces.rb
far-gem-0.5.3 test/models/network/test_network_interfaces.rb
fog-azure-rm-0.4.9 test/models/network/test_network_interfaces.rb
far-gem-0.5.2 test/models/network/test_network_interfaces.rb
fog-azure-rm-0.4.8 test/models/network/test_network_interfaces.rb
fog-azure-rm-0.4.7 test/models/network/test_network_interfaces.rb
fog-azure-rm-0.4.6 test/models/network/test_network_interfaces.rb
fog-azure-rm-0.4.5 test/models/network/test_network_interfaces.rb
fog-azure-rm-temp-0.0.5 test/models/network/test_network_interfaces.rb
fog-azure-rm-0.4.4 test/models/network/test_network_interfaces.rb
fog-azure-rm-0.4.3 test/models/network/test_network_interfaces.rb
far-gem-0.5.1 test/models/network/test_network_interfaces.rb
fog-azure-rm-0.4.2 test/models/network/test_network_interfaces.rb