Sha256: 98895c27066cda10ce3c7b9421bc0648e80c72fa15907ad5d685cbefc1455f48

Contents?: true

Size: 1.06 KB

Versions: 3

Compression:

Stored size: 1.06 KB

Contents

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

# Test class for Create Database
class TestCreateOrUpdateDatabase < Minitest::Test
  def setup
    @service = Fog::Sql::AzureRM.new(credentials)
    @databases = @service.sql_databases
    @token_provider = Fog::Credentials::AzureRM.instance_variable_get(:@token_provider)
  end

  def test_create_or_update_database_success
    database_response = ApiStub::Requests::Sql::SqlDatabase.create_database_response
    data_hash = ApiStub::Requests::Sql::SqlDatabase.database_hash
    @token_provider.stub :get_authentication_header, 'Bearer <some-token>' do
      RestClient.stub :put, database_response do
        assert_equal @service.create_or_update_database(data_hash), JSON.parse(database_response)
      end
    end
  end

  def test_create_or_update_database_failure
    @token_provider.stub :get_authentication_header, 'Bearer <some-token>' do
      assert_raises ArgumentError do
        @service.create_or_update_database('test-resource-group', 'test-server-name')
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fog-azure-rm-0.1.1 test/requests/sql/test_create_or_update_database.rb
fog-azure-rm-0.1.0 test/requests/sql/test_create_or_update_database.rb
fog-azure-rm-0.0.9 test/requests/sql/test_create_or_update_database.rb