Sha256: b8921d0646722cea15345871c2bc04d217138aa23daf7c1b5e730616d61632ee

Contents?: true

Size: 1002 Bytes

Versions: 14

Compression:

Stored size: 1002 Bytes

Contents

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

# Test class for Create Vault Request
class TestCreateOrUpdateVault < Minitest::Test
  def setup
    @service = Fog::KeyVault::AzureRM.new(credentials)
    key_vault_client = @service.instance_variable_get(:@key_vault_client)
    @vaults = key_vault_client.vaults
    @response = ApiStub::Requests::KeyVault::Vault.create_vault_response(key_vault_client)
    @vault_params = ApiStub::Requests::KeyVault::Vault.vault_params
  end

  def test_create_or_update_vault_success
    @vaults.stub :create_or_update, @response do
      assert_equal @service.create_or_update_vault(@vault_params), @response
    end
  end

  def test_create_vault_failure
    response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
    @vaults.stub :create_or_update, response do
      assert_raises(MsRestAzure::AzureOperationError) { @service.create_or_update_vault(name: 'fog-test-kv') }
    end
  end
end

Version data entries

14 entries across 14 versions & 2 rubygems

Version Path
fog-azure-rm-0.6.0 test/requests/key_vault/test_create_or_update_vault.rb
fog-azure-rm-0.5.3 test/requests/key_vault/test_create_or_update_vault.rb
fog-azure-rm-0.5.2 test/requests/key_vault/test_create_or_update_vault.rb
far-gem-0.5.6 test/requests/key_vault/test_create_or_update_vault.rb
fog-azure-rm-0.5.1 test/requests/key_vault/test_create_or_update_vault.rb
far-gem-0.5.5 test/requests/key_vault/test_create_or_update_vault.rb
fog-azure-rm-0.5.0 test/requests/key_vault/test_create_or_update_vault.rb
far-gem-0.5.4 test/requests/key_vault/test_create_or_update_vault.rb
far-gem-0.5.3 test/requests/key_vault/test_create_or_update_vault.rb
fog-azure-rm-0.4.9 test/requests/key_vault/test_create_or_update_vault.rb
far-gem-0.5.2 test/requests/key_vault/test_create_or_update_vault.rb
fog-azure-rm-0.4.8 test/requests/key_vault/test_create_or_update_vault.rb
fog-azure-rm-0.4.7 test/requests/key_vault/test_create_or_update_vault.rb
fog-azure-rm-0.4.6 test/requests/key_vault/test_create_or_update_vault.rb