Sha256: e1684c5a5e0df8bc6ee1f141f01c110ead2351471b666c66907f7448928671bc

Contents?: true

Size: 1.33 KB

Versions: 15

Compression:

Stored size: 1.33 KB

Contents

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

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

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

    @url = ApiStub::Requests::Storage::File.blob_https_url
    @token = ApiStub::Requests::Storage::File.blob_url_token
  end

  def test_put_blob_http_urls_success
    @blob_client.stub :generate_uri, @url do
      @signature_client.stub :generate_service_sas_token, @token do
        assert_equal "#{@url}?#{@token}", @service.put_blob_https_url('test_container', 'test_blob', Time.now.utc + 3600)
        assert_equal "#{@url}?#{@token}", @service.put_object_url('test_container', 'test_blob', Time.now.utc + 3600, {})
      end
    end
  end

  def test_put_blob_https_url_mock
    assert_equal "#{@url}?#{@token}", @mock_service.put_blob_https_url('test_container', 'test_blob', Time.now.utc + 3600)
    assert_equal "#{@url}?#{@token}", @mock_service.put_object_url('test_container', 'test_blob', Time.now.utc + 3600, {})
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
gitlab-fog-azure-rm-1.8.0 test/requests/storage/test_put_blob_https_url.rb
gitlab-fog-azure-rm-1.7.0 test/requests/storage/test_put_blob_https_url.rb
gitlab-fog-azure-rm-1.6.0 test/requests/storage/test_put_blob_https_url.rb
gitlab-fog-azure-rm-1.5.0 test/requests/storage/test_put_blob_https_url.rb
gitlab-fog-azure-rm-1.4.0 test/requests/storage/test_put_blob_https_url.rb
gitlab-fog-azure-rm-1.3.0 test/requests/storage/test_put_blob_https_url.rb
gitlab-fog-azure-rm-1.2.0 test/requests/storage/test_put_blob_https_url.rb
gitlab-fog-azure-rm-1.1.1 test/requests/storage/test_put_blob_https_url.rb
gitlab-fog-azure-rm-1.0.1 test/requests/storage/test_put_blob_https_url.rb
gitlab-fog-azure-rm-1.0.0 test/requests/storage/test_put_blob_https_url.rb
gitlab-fog-azure-rm-0.9.0 test/requests/storage/test_put_blob_https_url.rb
gitlab-fog-azure-rm-0.8.1 test/requests/storage/test_put_blob_https_url.rb
gitlab-fog-azure-rm-0.8.0 test/requests/storage/test_put_blob_https_url.rb
gitlab-fog-azure-rm-0.7.0 test/requests/storage/test_put_blob_https_url.rb
gitlab-fog-azure-rm-0.6.0 test/requests/storage/test_put_blob_https_url.rb