Sha256: 653e9cb771ee0788bb2cf8ff49ebc38ca12c1e7f808f76c7380a31520179edef

Contents?: true

Size: 1.15 KB

Versions: 1

Compression:

Stored size: 1.15 KB

Contents

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

# Storage Blob Class
class TestCreatePageBlob < Minitest::Test
  # This class posesses the test cases for the requests of creating storage page blobs.
  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)
  end

  def test_create_page_blob_success
    @blob_client.stub :create_page_blob, true do
      assert @service.create_page_blob('test_container', 'test_blob', 1_024)
    end
  end

  def test_create_page_blob_http_exception
    http_exception = ->(*) { raise Azure::Core::Http::HTTPError.new(@mocked_response) }
    @blob_client.stub :create_page_blob, http_exception do
      assert_raises(RuntimeError) do
        @service.create_page_blob('test_container', 'test_blob', 1_024)
      end
    end
  end

  def test_create_page_blob_mock
    assert @mock_service.create_page_blob('test_container', 'test_blob', 1_024)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fog-azure-rm-0.1.1 test/requests/storage/test_create_page_blob.rb