fakes3 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -0
- data/README.md +2 -0
- data/lib/fakes3/file_store.rb +6 -2
- data/lib/fakes3/version.rb +1 -1
- data/test/aws_sdk_commands_test.rb +28 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 241deda826d3d91b172ce08830a500ee014d452a
|
4
|
+
data.tar.gz: 0fff1ebd2cd5e02f5f7ec9d5228927eef3802e2a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 11825967dc25673fe37a311a7fc52e631c7c695186c9b0721b4468f6cb560ad7a22d1efbf06880759c8ae6d8cb27c900a5771820ae122a92fbc6e754c7fe5572
|
7
|
+
data.tar.gz: 9a5c1824a3fad9d4c59e71335e9231d7526acd7d2ce1a8415fbbf5ce6e27605ff9bdc4c4304b63e9136f3b2b88b3436d44a49d8ed06f32dfc179921cc53b92da
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -58,3 +58,5 @@ It is a still a TODO to get this to be just one command
|
|
58
58
|
## More Information
|
59
59
|
|
60
60
|
Check out the [wiki](https://github.com/jubos/fake-s3/wiki)
|
61
|
+
|
62
|
+
[![Join the chat at https://gitter.im/jubos/fake-s3](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/jubos/fake-s3?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
data/lib/fakes3/file_store.rb
CHANGED
@@ -263,14 +263,18 @@ module FakeS3
|
|
263
263
|
metadata[:content_type] = request.header["content-type"].first
|
264
264
|
metadata[:size] = File.size(content)
|
265
265
|
metadata[:modified_date] = File.mtime(content).utc.iso8601(SUBSECOND_PRECISION)
|
266
|
+
metadata[:amazon_metadata] = {}
|
266
267
|
metadata[:custom_metadata] = {}
|
267
268
|
|
268
269
|
# Add custom metadata from the request header
|
269
270
|
request.header.each do |key, value|
|
270
|
-
match = /^x-amz-
|
271
|
-
|
271
|
+
match = /^x-amz-([^-]+)-(.*)$/.match(key)
|
272
|
+
next unless match
|
273
|
+
if match[1].eql?('meta') && (match_key = match[2])
|
272
274
|
metadata[:custom_metadata][match_key] = value.join(', ')
|
275
|
+
next
|
273
276
|
end
|
277
|
+
metadata[:amazon_metadata][key.gsub(/^x-amz-/, '')] = value.join(', ')
|
274
278
|
end
|
275
279
|
return metadata
|
276
280
|
end
|
data/lib/fakes3/version.rb
CHANGED
@@ -28,4 +28,32 @@ class AwsSdkCommandsTest < Test::Unit::TestCase
|
|
28
28
|
assert object.exists?
|
29
29
|
assert_equal "thisisaverybigfile", object.read
|
30
30
|
end
|
31
|
+
|
32
|
+
def test_metadata
|
33
|
+
file_path = './test_root/test_metadata/metaobject'
|
34
|
+
FileUtils.rm_rf file_path
|
35
|
+
|
36
|
+
bucket = @s3.buckets["test_metadata"]
|
37
|
+
object = bucket.objects["metaobject"]
|
38
|
+
object.write(
|
39
|
+
'data',
|
40
|
+
# this is sent as header x-amz-storage-class
|
41
|
+
:storage_class => 'REDUCED_REDUNDANCY',
|
42
|
+
# this is sent as header x-amz-meta-custom1
|
43
|
+
:metadata => {
|
44
|
+
"custom1" => "foobar"
|
45
|
+
}
|
46
|
+
)
|
47
|
+
assert object.exists?
|
48
|
+
metadata_file = YAML.load(IO.read("#{file_path}/.fakes3_metadataFFF/metadata"))
|
49
|
+
|
50
|
+
assert metadata_file.has_key?(:custom_metadata), 'Metadata file does not contain a :custom_metadata key'
|
51
|
+
assert metadata_file[:custom_metadata].has_key?('custom1'), ':custom_metadata does not contain field "custom1"'
|
52
|
+
assert_equal 'foobar', metadata_file[:custom_metadata]['custom1'], '"custom1" does not equal expected value "foobar"'
|
53
|
+
|
54
|
+
assert metadata_file.has_key?(:amazon_metadata), 'Metadata file does not contain an :amazon_metadata key'
|
55
|
+
assert metadata_file[:amazon_metadata].has_key?('storage-class'), ':amazon_metadata does not contain field "storage-class"'
|
56
|
+
assert_equal 'REDUCED_REDUNDANCY', metadata_file[:amazon_metadata]['storage-class'], '"storage-class" does not equal expected value "REDUCED_REDUNDANCY"'
|
57
|
+
|
58
|
+
end
|
31
59
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fakes3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Curtis Spencer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-11-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|