Sha256: 318529ddfe2410ce64bd57d45f83fcc24c2bb9d4f32be7dd67c6f53e805081e4

Contents?: true

Size: 1.6 KB

Versions: 18

Compression:

Stored size: 1.6 KB

Contents

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

# Test class for Database Model
class TestDatabase < Minitest::Test
  def setup
    @service = Fog::Sql::AzureRM.new(credentials)
    @database = database(@service)
    @database_client = @service.instance_variable_get(:@sql_mgmt_client)
  end

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

  def test_model_attributes
    attributes = [
      :name,
      :id,
      :resource_group,
      :server_name,
      :type,
      :collation,
      :create_mode,
      :creation_date,
      :current_service_level_objective_id,
      :database_id,
      :default_secondary_location,
      :edition,
      :earliest_restore_date,
      :elastic_pool_name,
      :location,
      :max_size_bytes,
      :requested_service_objective_id,
      :requested_service_objective_name,
      :service_level_objective,
      :source_database_id
    ]
    attributes.each do |attribute|
      assert_respond_to @database, attribute
    end
  end

  def test_save_method_response
    create_response = ApiStub::Models::Sql::SqlDatabase.create_database(@database_client)
    @service.stub :create_or_update_database, create_response do
      assert_instance_of Fog::Sql::AzureRM::SqlDatabase, @database.save
    end
  end

  def test_destroy_method_true_response
    @service.stub :delete_database, true do
      assert @database.destroy
    end
  end

  def test_destroy_method_false_response
    @service.stub :delete_database, false do
      assert !@database.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_database.rb
fog-azure-rm-temp-0.0.3 test/models/sql/test_database.rb
fog-azure-rm-0.3.3 test/models/sql/test_database.rb
fog-azure-rm-temp-0.0.2 test/models/sql/test_database.rb
fog-azure-rm-temp-0.0.1 test/models/sql/test_database.rb
fog-azure-rm-0.3.2 test/models/sql/test_database.rb
fog-azure-rm-downgraded-0.3.1 test/models/sql/test_database.rb
fog-azure-rm-0.3.1 test/models/sql/test_database.rb
fog-azure-rm-downgraded-0.3.0 test/models/sql/test_database.rb
fog-azure-rm-0.3.0 test/models/sql/test_database.rb
fog-azure-rm-0.2.7 test/models/sql/test_database.rb
fog-azure-rm-0.2.6 test/models/sql/test_database.rb
fog-azure-rm-0.2.5 test/models/sql/test_database.rb
fog-azure-rm-0.2.4 test/models/sql/test_database.rb
fog-azure-rm-0.2.3 test/models/sql/test_database.rb
fog-azure-rm-0.2.2 test/models/sql/test_database.rb
fog-azure-rm-0.2.1 test/models/sql/test_database.rb
fog-azure-rm-0.2.0 test/models/sql/test_database.rb