Sha256: 74e7a86928939d77276ab3d0d15049601cbbb4dc21331fe027cea48cc65615da

Contents?: true

Size: 1.85 KB

Versions: 130

Compression:

Stored size: 1.85 KB

Contents

Shindo.tests("Storage[:aws] | files", ["aws"]) do

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

  directory_attributes = {
      :key => uniq_id('fogfilestests')
  }

  @directory = Fog::Storage[:aws].directories.create(directory_attributes)
  @directory.versioning = true

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

    v1 = @instance.version
    v2 = @directory.service.put_object(@directory.key, @instance.key, 'version 2 content').headers['x-amz-version-id']
    v3 = @directory.service.delete_object(@directory.key, @instance.key).headers['x-amz-version-id']
    v4 = @directory.service.put_object(@directory.key, @instance.key, 'version 3 content').headers['x-amz-version-id']

    tests("#get") do
      tests("#get without version fetches the latest version").returns(v4) do
        @directory.files.get(@instance.key).version
      end

      tests("#get with version fetches that exact version").returns(v2) do
        @directory.files.get(@instance.key, 'versionId' => v2).version
      end

      tests("#get with a deleted version returns nil").returns(nil) do
        pending # getting 405 Method Not Allowed
        @directory.files.get(@instance.key, 'versionId' => v3)
      end
    end

    tests("#head") do
      tests("#head without version fetches the latest version").returns(v4) do
        @directory.files.head(@instance.key).version
      end

      tests("#head with version fetches that exact version").returns(v2) do
        @directory.files.head(@instance.key, 'versionId' => v2).version
      end

      tests("#head with a deleted version returns nil").returns(nil) do
        pending # getting 405 Method Not Allowed
        @directory.files.head(@instance.key, 'versionId' => v3)
      end
    end

  end

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

end

Version data entries

130 entries across 128 versions & 8 rubygems

Version Path
fog-maestrodev-1.18.0.20131126122111 tests/aws/models/storage/files_tests.rb
fog-maestrodev-1.18.0.20131125111730 tests/aws/models/storage/files_tests.rb
fog-maestrodev-1.18.0.20131125083406 tests/aws/models/storage/files_tests.rb
fog-maestrodev-1.18.0.20131123105121 tests/aws/models/storage/files_tests.rb
fog-maestrodev-1.18.0.20131122203507 tests/aws/models/storage/files_tests.rb
fog-maestrodev-1.18.0.20131121075022 tests/aws/models/storage/files_tests.rb
fog-maestrodev-1.18.0.20131118164830 tests/aws/models/storage/files_tests.rb
fog-maestrodev-1.18.0.20131115184302 tests/aws/models/storage/files_tests.rb
fog-maestrodev-1.18.0.20131114200144 tests/aws/models/storage/files_tests.rb
gapinc-fog-1.12.1.2.1 tests/aws/models/storage/files_tests.rb
fog-maestrodev-1.18.0.20131112185232 tests/aws/models/storage/files_tests.rb
fog-maestrodev-1.18.0.20131111203459 tests/aws/models/storage/files_tests.rb
fog-1.18.0 tests/aws/models/storage/files_tests.rb
fog-1.17.0 tests/aws/models/storage/files_tests.rb
fog-1.16.0 tests/aws/models/storage/files_tests.rb
fog-maestrodev-1.15.0.20130927082724 tests/aws/models/storage/files_tests.rb
fog-maestrodev-1.15.0.20130829165835 tests/aws/models/storage/files_tests.rb
fog-1.15.0 tests/aws/models/storage/files_tests.rb
gapinc-fog-1.14.0 tests/aws/models/storage/files_tests.rb
fog-maestrodev-1.14.0.20130806165225 tests/aws/models/storage/files_tests.rb