Sha256: 012d8b87c757653707517afa31f6b3ae08102ddcd43d0721131da739f9eb6579

Contents?: true

Size: 1.46 KB

Versions: 3

Compression:

Stored size: 1.46 KB

Contents

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

# Test class for Network Security Group Collection
class TestNetworkSecurityGroups < Minitest::Test
  def setup
    @service = Fog::Network::AzureRM.new(credentials)
    client = @service.instance_variable_get(:@network_client)
    @network_security_groups = Fog::Network::AzureRM::NetworkSecurityGroups.new(resource_group: 'fog-test-rg', service: @service)
    @response = [ApiStub::Models::Network::NetworkSecurityGroup.create_network_security_group_response(client)]
  end

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

  def test_collection_attributes
    assert_respond_to @network_security_groups, :resource_group
  end

  def test_all_method_response
    @service.stub :list_network_security_groups, @response do
      assert_instance_of Fog::Network::AzureRM::NetworkSecurityGroups, @network_security_groups.all
      assert @network_security_groups.all.size >= 1
      @network_security_groups.all.each do |nsg|
        assert_instance_of Fog::Network::AzureRM::NetworkSecurityGroup, nsg
      end
    end
  end

  def test_get_method_response
    @service.stub :get_network_security_group, @response[0] do
      assert_instance_of Fog::Network::AzureRM::NetworkSecurityGroup, @network_security_groups.get('fog-test-rg', 'fog-test-nsg')
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fog-azure-rm-0.1.1 test/models/network/test_network_security_groups.rb
fog-azure-rm-0.1.0 test/models/network/test_network_security_groups.rb
fog-azure-rm-0.0.9 test/models/network/test_network_security_groups.rb