Sha256: 21c26f2873407d8b38ad0966d77412d69f79fd27456c63698aa73bd45091630d

Contents?: true

Size: 1.57 KB

Versions: 3

Compression:

Stored size: 1.57 KB

Contents

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

# Test class for Network Security Rule Collection
class TestNetworkSecurityRules < Minitest::Test
  def setup
    @service = Fog::Network::AzureRM.new(credentials)
    client = @service.instance_variable_get(:@network_client)
    @network_security_rules = Fog::Network::AzureRM::NetworkSecurityRules.new(resource_group: 'fog-test-rg', network_security_group_name: 'fog-test-nsg', service: @service)
    @response = [ApiStub::Models::Network::NetworkSecurityRule.create_network_security_rule_response(client)]
  end

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

  def test_collection_attributes
    assert_respond_to @network_security_rules, :resource_group
    assert_respond_to @network_security_rules, :network_security_group_name
  end

  def test_all_method_response
    @service.stub :list_network_security_rules, @response do
      assert_instance_of Fog::Network::AzureRM::NetworkSecurityRules, @network_security_rules.all
      assert @network_security_rules.all.size >= 1
      @network_security_rules.all.each do |nsr|
        assert_instance_of Fog::Network::AzureRM::NetworkSecurityRule, nsr
      end
    end
  end

  def test_get_method_response
    @service.stub :get_network_security_rule, @response[0] do
      assert_instance_of Fog::Network::AzureRM::NetworkSecurityRule, @network_security_rules.get('fog-test-rg', 'fog-test-nsg', 'fog-test-nsr')
    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_rules.rb
fog-azure-rm-0.1.0 test/models/network/test_network_security_rules.rb
fog-azure-rm-0.0.9 test/models/network/test_network_security_rules.rb