Sha256: a58f04b2965c8c32463f567b9c689743146452a1d74fdd0ec613b8c91529bb80

Contents?: true

Size: 1.09 KB

Versions: 6

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::AzureRM::Storage.new(storage_account_credentials)
    Fog.unmock!
    @mocked_response = mocked_storage_http_error

    @service = Fog::AzureRM::Storage.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

6 entries across 6 versions & 1 rubygems

Version Path
gitlab-fog-azure-rm-2.2.0 test/requests/storage/test_get_object.rb
gitlab-fog-azure-rm-2.1.0 test/requests/storage/test_get_object.rb
gitlab-fog-azure-rm-2.0.1 test/requests/storage/test_get_object.rb
gitlab-fog-azure-rm-2.0.0 test/requests/storage/test_get_object.rb
gitlab-fog-azure-rm-1.9.1 test/requests/storage/test_get_object.rb
gitlab-fog-azure-rm-1.9.0 test/requests/storage/test_get_object.rb