Sha256: 64cab339473c127c5acfe67e98ffc1c5a6ee196f77276e9dc1f91875bffcf6ce

Contents?: true

Size: 1.55 KB

Versions: 39

Compression:

Stored size: 1.55 KB

Contents

Shindo.tests("Storage[:internetarchive] | file", ["internetarchive"]) do

  # Fog.mock!

  require 'tempfile'

  file_attributes = {
    :key => 'fog_file_tests',
    :body => lorem_file,
    :public => true,
    :auto_make_bucket => 1,
  }

  directory_attributes = {
    # Add a random suffix to prevent collision
    :key => "fogfilestests-#{rand(65536)}",
    :collections => ['test_collection']
  }

  @directory = Fog::Storage[:internetarchive].directories.create(directory_attributes)

  model_tests(@directory.files, file_attributes, Fog.mocking?) do

    tests("#set_metadata_array_headers") do

      @instance.collections = ['test_collection', 'opensource']
      @options = {}
      @instance.set_metadata_array_headers(:collections, @options)

      tests("#set_metadata_array_headers should set options").returns(true) do
        @options['x-archive-meta01-collection'] == 'opensource' &&
        @options['x-archive-meta02-collection'] == 'test_collection'
      end
    end

  end

  model_tests(@directory.files, file_attributes, Fog.mocking?) do

    tests("multipart upload") do
      pending if Fog.mocking?

      # A 6MB file
      @large_file = Tempfile.new("fog-test-ia-s3-multipart")
      6.times { @large_file.write("x" * (1024**2)) }
      @large_file.rewind

      tests("#save(:multipart_chunk_size => 5242880)").succeeds do
        @directory.files.create(:key => 'multipart-upload', :body => @large_file, :multipart_chunk_size => 5242880)
      end

      @large_file.close

    end

  end

  # @directory.versions.each(&:destroy)
  @directory.destroy

end

Version data entries

39 entries across 37 versions & 6 rubygems

Version Path
fog-internet-archive-0.0.2 tests/internet_archive/models/storage/file_tests.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/fog-internet-archive-0.0.1/tests/internet_archive/models/storage/file_tests.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/fog-internet-archive-0.0.1/tests/internet_archive/models/storage/file_tests.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/fog-internet-archive-0.0.1/tests/internet_archive/models/storage/file_tests.rb
fog-1.40.0 tests/internet_archive/models/storage/file_tests.rb
fog-1.39.0 tests/internet_archive/models/storage/file_tests.rb
fog-internet-archive-0.0.1 tests/internet_archive/models/storage/file_tests.rb
fog-1.38.0 tests/internet_archive/models/storage/file_tests.rb
fog-1.37.0 tests/internet_archive/models/storage/file_tests.rb
fog-1.36.0 tests/internet_archive/models/storage/file_tests.rb
fog-1.35.0 tests/internet_archive/models/storage/file_tests.rb
fog-2.0.0.pre.0 tests/internet_archive/models/storage/file_tests.rb
vagrant-cloudstack-1.2.0 vendor/bundle/gems/fog-1.32.0/tests/internet_archive/models/storage/file_tests.rb
fog-1.34.0 tests/internet_archive/models/storage/file_tests.rb
fog-1.33.0 tests/internet_archive/models/storage/file_tests.rb
fog-1.32.0 tests/internet_archive/models/storage/file_tests.rb
fog-1.31.0 tests/internet_archive/models/storage/file_tests.rb
vagrant-cloudstack-1.1.0 vendor/bundle/gems/fog-1.22.1/tests/internet_archive/models/storage/file_tests.rb
fog-1.30.0 tests/internet_archive/models/storage/file_tests.rb
fog-1.29.0 tests/internet_archive/models/storage/file_tests.rb