Sha256: 2e51ca1fd56d5b9e78ae1de62ae6e3b9e467eed0e085561c74c1667a767657cc
Contents?: true
Size: 1.14 KB
Versions: 6
Compression:
Stored size: 1.14 KB
Contents
require File.expand_path '../../test_helper', __dir__ require 'webrick' class TestGetBlobGzipped < Minitest::Test def setup @server = WEBrick::HTTPServer.new( BindAddress: '127.0.0.1', Port: 0, Logger: WEBrick::Log.new(nil, 0), AccessLog: [] ) @server_uri = URI.parse("http://#{@server.config.values_at(:BindAddress, :Port).join(':')}/test") @thread = Thread.new do @server.start end @service = Fog::AzureRM::Storage.new(storage_account_credentials) @blob_client = @service.instance_variable_get(:@blob_client) end def teardown @server&.shutdown @thread&.join end def test_get_blob_with_encoding io = StringIO.new.binmode gzip = Zlib::GzipWriter.new(io) gzip.write "Hello world.\n" gzip.close @server.mount_proc '/' do |_request, response| response.header['Content-Encoding'] = 'gzip' response.body = io.string end blob, content = @blob_client.stub :generate_uri, @server_uri do @service.get_blob('test_container', 'test_blob') end assert_equal 'gzip', blob.properties[:content_encoding] assert_equal io.string, content end end
Version data entries
6 entries across 6 versions & 1 rubygems