Sha256: 63eb211871b325a9bbc32cba970f4da4f3a7e2ef4b7062070691d383eaa76b48

Contents?: true

Size: 1.37 KB

Versions: 46

Compression:

Stored size: 1.37 KB

Contents

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

# Test class for Sql Server Firewall Rule Collection
class TestFirewallRules < Minitest::Test
  def setup
    @service = Fog::Sql::AzureRM.new(credentials)
    @firewall_rules = sql_server_firewall_rules(@service)
    @firewall_client = @service.instance_variable_get(:@sql_mgmt_client)
    @create_firewall_rule_response = ApiStub::Models::Sql::SqlFirewallRule.create_firewall_rule(@firewall_client)
  end

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

  def test_collection_attributes
    assert_respond_to @firewall_rules, :resource_group
  end

  def test_all_method_response
    list_firewall_rule_response = [@create_firewall_rule_response]
    @service.stub :list_firewall_rules, list_firewall_rule_response do
      assert_instance_of Fog::Sql::AzureRM::FirewallRules, @firewall_rules.all
      assert @firewall_rules.all.size >= 1
      @firewall_rules.all.each do |s|
        assert_instance_of Fog::Sql::AzureRM::FirewallRule, s
      end
    end
  end

  def test_get_method_response
    @service.stub :get_firewall_rule, @create_firewall_rule_response do
      assert_instance_of Fog::Sql::AzureRM::FirewallRule, @firewall_rules.get('fog-test-rg', 'fog-test-server-name', 'fog-test-rule-name')
    end
  end
end

Version data entries

46 entries across 46 versions & 4 rubygems

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