Sha256: efb3c231bd53fdf5de3f17a16c099c96c96db5fe2739dbda611451961616d040

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 Sql Server
class TestCreateOrUpdateSqlServer < Minitest::Test
  def setup
    @service = Fog::Sql::AzureRM.new(credentials)
    @databases = @service.sql_servers
    @token_provider = Fog::Credentials::AzureRM.instance_variable_get(:@token_provider)
  end

  def test_create_or_update_sql_server_success
    server_response = ApiStub::Requests::Sql::SqlServer.create_sql_server_response
    data_hash = ApiStub::Requests::Sql::SqlServer.sql_server_hash
    @token_provider.stub :get_authentication_header, 'Bearer <some-token>' do
      RestClient.stub :put, server_response do
        assert_equal @service.create_or_update_sql_server(data_hash), JSON.parse(server_response)
      end
    end
  end

  def test_create_or_update_sql_server_failure
    @token_provider.stub :get_authentication_header, 'Bearer <some-token>' do
      assert_raises ArgumentError do
        @service.create_or_update_sql_server('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_sql_server.rb
fog-azure-rm-0.1.0 test/requests/sql/test_create_or_update_sql_server.rb
fog-azure-rm-0.0.9 test/requests/sql/test_create_or_update_sql_server.rb