Sha256: 59c28c4d515fe478c7f1cd55fefeeddf2d0a9485fa22f99fe921101aff6af224

Contents?: true

Size: 1.3 KB

Versions: 2

Compression:

Stored size: 1.3 KB

Contents

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

# Test class for Sql Server Firewall Rule Model
class TestFirewallRule < Minitest::Test
  def setup
    @service = Fog::Sql::AzureRM.new(credentials)
    @firewall_rule = sql_server_firewall_rule(@service)
  end

  def test_model_methods
    methods = [
      :save,
      :destroy
    ]
    methods.each do |method|
      assert_respond_to @firewall_rule, method
    end
  end

  def test_model_attributes
    attributes = [
      :name,
      :id,
      :type,
      :resource_group,
      :location,
      :start_ip,
      :end_ip,
      :server_name
    ]
    attributes.each do |attribute|
      assert_respond_to @firewall_rule, attribute
    end
  end

  def test_save_method_response
    create_response = ApiStub::Models::Sql::SqlFirewallRule.create_firewall_rule
    @service.stub :create_or_update_firewall_rule, create_response do
      assert_instance_of Fog::Sql::AzureRM::FirewallRule, @firewall_rule.save
    end
  end

  def test_destroy_method_true_response
    @service.stub :delete_firewall_rule, true do
      assert @firewall_rule.destroy
    end
  end

  def test_destroy_method_false_response
    @service.stub :delete_firewall_rule, false do
      assert !@firewall_rule.destroy
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fog-azure-rm-0.1.1 test/models/sql/test_firewall_rule.rb
fog-azure-rm-0.1.0 test/models/sql/test_firewall_rule.rb