Sha256: 8f51603ffe580d03d640536c242313e69a3b03e0f04a06f97ef5b5eca202118f

Contents?: true

Size: 1.99 KB

Versions: 109

Compression:

Stored size: 1.99 KB

Contents

Shindo.tests('Fog::Storage[:google] | bucket requests', ["google"]) do

  tests('success') do

    @bucket_format = {
      'CommonPrefixes' => [],
      'IsTruncated'     => Fog::Boolean,
      'Marker'          => NilClass,
      'Name'            => String,
      'Prefix'          => NilClass,
      'Contents'        => [{
        'ETag'          => String,
        'Key'           => String,
        'LastModified'  => Time,
        'Owner' => {
          'DisplayName' => String,
          'ID'          => String
        },
        'Size' => Integer
      }]
    }

    @service_format = {
      'Buckets' => [{
        'CreationDate'  => Time,
        'Name'          => String,
      }],
      'Owner'   => {
        'ID'          => String
      }
    }

    tests("#put_bucket('fogbuckettests')").succeeds do
      Fog::Storage[:google].put_bucket('fogbuckettests')
    end

    tests("#get_service").formats(@service_format) do
      Fog::Storage[:google].get_service.body
    end

    file = Fog::Storage[:google].directories.get('fogbuckettests').files.create(:body => 'y', :key => 'x')

    tests("#get_bucket('fogbuckettests)").formats(@bucket_format) do
      Fog::Storage[:google].get_bucket('fogbuckettests').body
    end

    file.destroy

    tests("#delete_bucket('fogbuckettests')").succeeds do
      Fog::Storage[:google].delete_bucket('fogbuckettests')
    end

  end

  tests('failure') do

    tests("#delete_bucket('fognonbucket')").raises(Excon::Errors::NotFound) do
      Fog::Storage[:google].delete_bucket('fognonbucket')
    end

    @bucket = Fog::Storage[:google].directories.create(:key => 'fognonempty')
    @file = @bucket.files.create(:key => 'foo', :body => 'bar')

    tests("#delete_bucket('fognonempty')").raises(Excon::Errors::Conflict) do
      Fog::Storage[:google].delete_bucket('fognonempty')
    end

    @file.destroy
    @bucket.destroy

    tests("#get_bucket('fognonbucket')").raises(Excon::Errors::NotFound) do
      Fog::Storage[:google].get_bucket('fognonbucket')
    end

  end

end

Version data entries

109 entries across 107 versions & 15 rubygems

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