Sha256: 235f256c5fb6a13ce4c8d52c6bf22bce6c0722e62c391440bb44bddaea855bb0

Contents?: true

Size: 1.09 KB

Versions: 2

Compression:

Stored size: 1.09 KB

Contents

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

# Storage Blob Class
class TestGetObject < Minitest::Test
  # This class posesses the test cases for the requests of getting storage blob.
  def setup
    Fog.mock!
    @mock_service = Fog::Storage::AzureRM.new(storage_account_credentials)
    Fog.unmock!
    @mocked_response = mocked_storage_http_error

    @service = Fog::Storage::AzureRM.new(storage_account_credentials)
    @blob_client = @service.instance_variable_get(:@blob_client)

    @raw_cloud_blob = storage_blob
    @blob = ApiStub::Requests::Storage::File.blob_as_hash
    @blob_with_content = @blob.merge(body: 'content')
  end

  def test_get_object_success
    @blob_client.stub :get_blob, @blob_with_content do
      assert_equal @blob_with_content, @service.get_object('test_container', 'test_blob')
    end
  end

  def test_get_object_not_found
    exception = ->(*) { raise StandardError.new('Not found(404). Not exist') }
    @blob_client.stub :get_blob, exception do
      assert_raises('NotFound') do
        @service.get_object('test_container', 'test_blob')
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
gitlab-fog-azure-rm-1.8.0 test/requests/storage/test_get_object.rb
gitlab-fog-azure-rm-1.7.0 test/requests/storage/test_get_object.rb