aws-s3 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/INSTALL +4 -0
- data/README +28 -27
- data/Rakefile +33 -4
- data/lib/aws/s3.rb +1 -0
- data/lib/aws/s3/acl.rb +8 -3
- data/lib/aws/s3/base.rb +10 -8
- data/lib/aws/s3/bucket.rb +1 -5
- data/lib/aws/s3/connection.rb +48 -9
- data/lib/aws/s3/exceptions.rb +3 -0
- data/lib/aws/s3/extensions.rb +99 -9
- data/lib/aws/s3/logging.rb +152 -9
- data/lib/aws/s3/object.rb +30 -22
- data/lib/aws/s3/parsing.rb +0 -29
- data/lib/aws/s3/response.rb +2 -2
- data/lib/aws/s3/version.rb +2 -2
- data/support/faster-xml-simple/lib/faster_xml_simple.rb +30 -11
- data/support/faster-xml-simple/test/regression_test.rb +11 -5
- data/support/faster-xml-simple/test/test_helper.rb +17 -0
- data/support/faster-xml-simple/test/xml_simple_comparison_test.rb +2 -3
- data/test/acl_test.rb +13 -2
- data/test/connection_test.rb +8 -0
- data/test/extensions_test.rb +57 -4
- data/test/fixtures/loglines.yml +5 -0
- data/test/fixtures/logs.yml +7 -0
- data/test/logging_test.rb +54 -1
- data/test/object_test.rb +15 -0
- data/test/parsing_test.rb +0 -20
- data/test/remote/object_test.rb +49 -1
- metadata +5 -2
data/test/parsing_test.rb
CHANGED
@@ -1,24 +1,4 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/test_helper'
|
2
|
-
class CoercibleStringTest < Test::Unit::TestCase
|
3
|
-
|
4
|
-
def test_coerce
|
5
|
-
coercions = [
|
6
|
-
['1', 1],
|
7
|
-
['false', false],
|
8
|
-
['true', true],
|
9
|
-
['2006-10-29T23:14:47.000Z', Time.parse('2006-10-29T23:14:47.000Z')],
|
10
|
-
['Hello!', 'Hello!'],
|
11
|
-
['false23', 'false23'],
|
12
|
-
['03 1-2-3-Apple-Tree.mp3', '03 1-2-3-Apple-Tree.mp3']
|
13
|
-
]
|
14
|
-
|
15
|
-
coercions.each do |before, after|
|
16
|
-
assert_nothing_raised do
|
17
|
-
assert_equal after, Parsing::CoercibleString.coerce(before)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
2
|
|
23
3
|
class TypecastingTest < Test::Unit::TestCase
|
24
4
|
# Make it easier to call methods in tests
|
data/test/remote/object_test.rb
CHANGED
@@ -221,7 +221,7 @@ class RemoteS3ObjectTest < Test::Unit::TestCase
|
|
221
221
|
response = nil
|
222
222
|
test_file_key = File.basename(TEST_FILE)
|
223
223
|
assert_nothing_raised do
|
224
|
-
response = S3Object.store(test_file_key,
|
224
|
+
response = S3Object.store(test_file_key, open(TEST_FILE), TEST_BUCKET)
|
225
225
|
end
|
226
226
|
assert response.success?
|
227
227
|
|
@@ -315,6 +315,54 @@ class RemoteS3ObjectTest < Test::Unit::TestCase
|
|
315
315
|
S3Object.delete('name with spaces', TEST_BUCKET)
|
316
316
|
end
|
317
317
|
|
318
|
+
def test_copying_an_object_should_copy_over_its_acl_also
|
319
|
+
key = 'copied-objects-inherit-acl'
|
320
|
+
copy_key = key + '2'
|
321
|
+
S3Object.store(key, 'value does not matter', TEST_BUCKET)
|
322
|
+
original_object = S3Object.find(key, TEST_BUCKET)
|
323
|
+
original_object.acl.grants << ACL::Grant.grant(:public_read)
|
324
|
+
original_object.acl.grants << ACL::Grant.grant(:public_read_acp)
|
325
|
+
|
326
|
+
S3Object.acl(key, TEST_BUCKET, original_object.acl)
|
327
|
+
|
328
|
+
acl = S3Object.acl(key, TEST_BUCKET)
|
329
|
+
assert_equal 3, acl.grants.size
|
330
|
+
|
331
|
+
S3Object.copy(key, copy_key, TEST_BUCKET)
|
332
|
+
copied_object = S3Object.find(copy_key, TEST_BUCKET)
|
333
|
+
assert_equal acl.grants, copied_object.acl.grants
|
334
|
+
ensure
|
335
|
+
S3Object.delete(key, TEST_BUCKET)
|
336
|
+
S3Object.delete(copy_key, TEST_BUCKET)
|
337
|
+
end
|
338
|
+
|
339
|
+
def test_handling_a_path_that_is_not_valid_utf8
|
340
|
+
key = "318597/620065/GTL_75\24300_A600_A610.zip"
|
341
|
+
assert_nothing_raised do
|
342
|
+
S3Object.store(key, 'value does not matter', TEST_BUCKET)
|
343
|
+
end
|
344
|
+
|
345
|
+
object = nil
|
346
|
+
assert_nothing_raised do
|
347
|
+
object = S3Object.find(key, TEST_BUCKET)
|
348
|
+
end
|
349
|
+
|
350
|
+
assert object
|
351
|
+
|
352
|
+
url = nil
|
353
|
+
assert_nothing_raised do
|
354
|
+
url = S3Object.url_for(key, TEST_BUCKET)
|
355
|
+
end
|
356
|
+
|
357
|
+
assert url
|
358
|
+
|
359
|
+
assert_equal object.value, fetch_object_at(url).body
|
360
|
+
ensure
|
361
|
+
assert_nothing_raised do
|
362
|
+
S3Object.delete(key, TEST_BUCKET)
|
363
|
+
end
|
364
|
+
end
|
365
|
+
|
318
366
|
private
|
319
367
|
def fetch_object_at(url)
|
320
368
|
Net::HTTP.get_response(URI.parse(url))
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.0
|
|
3
3
|
specification_version: 1
|
4
4
|
name: aws-s3
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.
|
7
|
-
date: 2006-12-
|
6
|
+
version: 0.3.0
|
7
|
+
date: 2006-12-21 00:00:00 -06:00
|
8
8
|
summary: Client library for Amazon's Simple Storage Service's REST API
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -51,6 +51,7 @@ files:
|
|
51
51
|
- bin/setup.rb
|
52
52
|
- support/faster-xml-simple/lib/faster_xml_simple.rb
|
53
53
|
- support/faster-xml-simple/test/regression_test.rb
|
54
|
+
- support/faster-xml-simple/test/test_helper.rb
|
54
55
|
- support/faster-xml-simple/test/xml_simple_comparison_test.rb
|
55
56
|
- support/rdoc/code_info.rb
|
56
57
|
- README
|
@@ -78,6 +79,8 @@ test_files:
|
|
78
79
|
- test/fixtures/errors.yml
|
79
80
|
- test/fixtures/headers.yml
|
80
81
|
- test/fixtures/logging.yml
|
82
|
+
- test/fixtures/loglines.yml
|
83
|
+
- test/fixtures/logs.yml
|
81
84
|
- test/fixtures/policies.yml
|
82
85
|
- test/mocks/base.rb
|
83
86
|
- test/remote/acl_test.rb
|