Sha256: a4c6d796b94c92b870a62ecb57f56da0e50ff0b8cae6da00cf3339d1e1d84f4f

Contents?: true

Size: 937 Bytes

Versions: 8

Compression:

Stored size: 937 Bytes

Contents

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

# Test class for Create Image Request
class TestCreateImage < 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::Image.create_image(compute_client)
    @input_params = ApiStub::Requests::Compute::Image.image_params
  end

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

  def test_create_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_image(@input_params)
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 3 rubygems

Version Path
fog-azure-rm-0.4.5 test/requests/compute/test_create_image.rb
fog-azure-rm-temp-0.0.5 test/requests/compute/test_create_image.rb
fog-azure-rm-0.4.4 test/requests/compute/test_create_image.rb
fog-azure-rm-0.4.3 test/requests/compute/test_create_image.rb
far-gem-0.5.1 test/requests/compute/test_create_image.rb
fog-azure-rm-0.4.2 test/requests/compute/test_create_image.rb
fog-azure-rm-0.4.1 test/requests/compute/test_create_image.rb
fog-azure-rm-0.4.0 test/requests/compute/test_create_image.rb