Sha256: 9715c338dea100f79a5029911d048b7a1aacc0bee42fcd5fd5bcbf01daabe7a9

Contents?: true

Size: 891 Bytes

Versions: 5

Compression:

Stored size: 891 Bytes

Contents

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

# Test class for Delete Virtual Machine Request
class TestDeleteGeneralizedImage < Minitest::Test
  def setup
    @service = Fog::Compute::AzureRM.new(credentials)
    compute_client = @service.instance_variable_get(:@compute_mgmt_client)
    @generalized_image = compute_client.images
  end

  def test_delete_generalized_image_success
    @generalized_image.stub :delete, true do
      assert @service.delete_generalized_image('fog-test-rg', 'fog-test-server-osImage')
    end
  end

  def test_delete_generalized_image_failure
    response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
    @generalized_image.stub :delete, response do
      assert_raises(RuntimeError) { @service.delete_generalized_image('fog-test-rg', 'fog-test-server-osImage') }
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
fog-azure-rm-0.3.9 test/requests/compute/test_delete_generalized_image.rb
fog-azure-rm-0.3.8 test/requests/compute/test_delete_generalized_image.rb
fog-azure-rm-0.3.7 test/requests/compute/test_delete_generalized_image.rb
fog-azure-rm-0.3.6 test/requests/compute/test_delete_generalized_image.rb
fog-azure-rm-0.3.5 test/requests/compute/test_delete_generalized_image.rb