Sha256: 1312df200c02fac4ce68b6cc441e4d0212456a665dfd511fb43890f509d5017f

Contents?: true

Size: 957 Bytes

Versions: 14

Compression:

Stored size: 957 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 MsRestAzure::AzureOperationError do
        @service.create_image(@input_params)
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 2 rubygems

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