Sha256: 47ac3e0ceb53aa08ebc22fe86084cceb874d13f8bea0f1939a5c6de7984b52b1

Contents?: true

Size: 1.03 KB

Versions: 5

Compression:

Stored size: 1.03 KB

Contents

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

# Test class for Create Virtual Machine Request
class TestCreateGeneralizedImage < Minitest::Test
  def setup
    @service = Fog::Compute::AzureRM.new(credentials)
    compute_client = @service.instance_variable_get(:@compute_mgmt_client)
    @image = compute_client.images
    @response = ApiStub::Requests::Compute::GeneralizedImage.create_generalized_image(compute_client)
    @input_params = ApiStub::Requests::Compute::GeneralizedImage.generalized_image_params
  end

  def test_create_generalized_image_success
    @image.stub :create_or_update, @response do
      assert_equal @service.create_generalized_image(@input_params), @response
    end
  end

  def test_create_generalized_image_failure
    response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
    @image.stub :create_or_update, response do
      assert_raises RuntimeError do
        @service.create_generalized_image(@input_params)
      end
    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_create_generalized_image.rb
fog-azure-rm-0.3.8 test/requests/compute/test_create_generalized_image.rb
fog-azure-rm-0.3.7 test/requests/compute/test_create_generalized_image.rb
fog-azure-rm-0.3.6 test/requests/compute/test_create_generalized_image.rb
fog-azure-rm-0.3.5 test/requests/compute/test_create_generalized_image.rb