Sha256: 18973b4384cf89a69e888c8e907950aec645fc7127c1610af74c25266727edba

Contents?: true

Size: 1.35 KB

Versions: 18

Compression:

Stored size: 1.35 KB

Contents

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

# Test class for Sql Server Model
class TestSqlServer < Minitest::Test
  def setup
    @service = Fog::Sql::AzureRM.new(credentials)
    @sql_server = sql_server(@service)
    @sql_server_client = @service.instance_variable_get(:@sql_mgmt_client)
  end

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

  def test_model_attributes
    attributes = [
      :name,
      :id,
      :type,
      :resource_group,
      :location,
      :version,
      :state,
      :administrator_login,
      :administrator_login_password,
      :fully_qualified_domain_name
    ]
    attributes.each do |attribute|
      assert_respond_to @sql_server, attribute
    end
  end

  def test_save_method_response
    create_response = ApiStub::Models::Sql::SqlServer.create_sql_server(@sql_server_client)
    @service.stub :create_or_update_sql_server, create_response do
      assert_instance_of Fog::Sql::AzureRM::SqlServer, @sql_server.save
    end
  end

  def test_destroy_method_true_response
    @service.stub :delete_sql_server, true do
      assert @sql_server.destroy
    end
  end

  def test_destroy_method_false_response
    @service.stub :delete_sql_server, false do
      assert !@sql_server.destroy
    end
  end
end

Version data entries

18 entries across 18 versions & 3 rubygems

Version Path
fog-azure-rm-temp-0.0.4 test/models/sql/test_sql_server.rb
fog-azure-rm-temp-0.0.3 test/models/sql/test_sql_server.rb
fog-azure-rm-0.3.3 test/models/sql/test_sql_server.rb
fog-azure-rm-temp-0.0.2 test/models/sql/test_sql_server.rb
fog-azure-rm-temp-0.0.1 test/models/sql/test_sql_server.rb
fog-azure-rm-0.3.2 test/models/sql/test_sql_server.rb
fog-azure-rm-downgraded-0.3.1 test/models/sql/test_sql_server.rb
fog-azure-rm-0.3.1 test/models/sql/test_sql_server.rb
fog-azure-rm-downgraded-0.3.0 test/models/sql/test_sql_server.rb
fog-azure-rm-0.3.0 test/models/sql/test_sql_server.rb
fog-azure-rm-0.2.7 test/models/sql/test_sql_server.rb
fog-azure-rm-0.2.6 test/models/sql/test_sql_server.rb
fog-azure-rm-0.2.5 test/models/sql/test_sql_server.rb
fog-azure-rm-0.2.4 test/models/sql/test_sql_server.rb
fog-azure-rm-0.2.3 test/models/sql/test_sql_server.rb
fog-azure-rm-0.2.2 test/models/sql/test_sql_server.rb
fog-azure-rm-0.2.1 test/models/sql/test_sql_server.rb
fog-azure-rm-0.2.0 test/models/sql/test_sql_server.rb