fakes3 0.2.4 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/CONTRIBUTING.md +50 -0
- data/DEPLOY_README.md +18 -0
- data/README.md +12 -40
- data/fakes3.gemspec +4 -2
- data/lib/fakes3/cli.rb +3 -2
- data/lib/fakes3/server.rb +22 -13
- data/lib/fakes3/version.rb +1 -1
- data/test/aws_sdk_v2_commands_test.rb +65 -0
- data/test/cli_test.rb +18 -0
- data/test/minitest_helper.rb +46 -0
- data/test/right_aws_commands_test.rb +1 -1
- data/test/s3cmd_test.rb +2 -2
- data/test/test_helper.rb +2 -0
- metadata +42 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a7c7f31dbcec54846627f3c63f998eb7fa82fa56
|
4
|
+
data.tar.gz: e0f13efeb4b223f9094360a42837ba8c4830f7b0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fb67ce99ae0fa4eb1948584e338b6ccebeb542154f2f1c606632614283b5d950d4d9056a118972c20ac623436c7ed3685b05dd41672fd7183d923e068e724910
|
7
|
+
data.tar.gz: ce6b1e73a3ab5464dcaad3285200b51e9eb4e16ddd8f153196a0dff80381d5e370f4c5c6b97f2fa67149f3c5c4709d36260de9cc58167f10450a2847bb2548ab
|
data/.gitignore
CHANGED
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
## Contributing to Fake S3
|
2
|
+
|
3
|
+
Contributions in the form of pull requests, bug reports, documentation, or anything else are welcome! We do have a few small rules to follow:
|
4
|
+
|
5
|
+
- Ensure tests pass before making a pull request. (You can read the Testing section below for how to set up your development environment and run tests)
|
6
|
+
|
7
|
+
- Please use a coding style similar to the rest of the file(s) you change. This isn't a hard rule but if it's too different, it will stand out.
|
8
|
+
|
9
|
+
- Unless your contributions fall under the trivial exemption policy (below), contributors must sign our Contributor License Agreement (CLA) to be eligible to contribute. Read more in section is below.
|
10
|
+
|
11
|
+
|
12
|
+
## Testing
|
13
|
+
|
14
|
+
There are some prerequisites to actually being able to run the unit/integration tests.
|
15
|
+
|
16
|
+
On macOS, edit your /etc/hosts and add the following line:
|
17
|
+
|
18
|
+
127.0.0.1 posttest.localhost
|
19
|
+
|
20
|
+
Then ensure that the following packages are installed (boto, s3cmd):
|
21
|
+
|
22
|
+
> pip install boto
|
23
|
+
> brew install s3cmd
|
24
|
+
|
25
|
+
|
26
|
+
Start the test server using:
|
27
|
+
|
28
|
+
rake test_server
|
29
|
+
|
30
|
+
Finally, in another terminal window run:
|
31
|
+
|
32
|
+
rake test
|
33
|
+
|
34
|
+
|
35
|
+
## Signing the Contributor License agreement
|
36
|
+
|
37
|
+
We have a contributor license agreement (CLA) based off of Google and Apache's CLA. If you would feel comfortable contributing to, say, Angular.js, you should feel comfortable with this CLA.
|
38
|
+
|
39
|
+
To sign the CLA:
|
40
|
+
|
41
|
+
[Click here and fill out the form.](https://docs.google.com/forms/d/e/1FAIpQLSeKKSKNNz5ji1fd5bbu5RaGFbhD45zEaCnAjzBZPpzOaXQsvQ/viewform)
|
42
|
+
|
43
|
+
If you're interested, [this blog post](https://julien.ponge.org/blog/in-defense-of-contributor-license-agreements/) discusses why to use a CLA, and even goes over the text of the CLA we based ours on.
|
44
|
+
|
45
|
+
|
46
|
+
## Trivial Exemption Policy
|
47
|
+
|
48
|
+
The Trivial Exemption Policy exempts contributions that would not be sufficiently robust or creative to enjoy copyright protection, and therefore do not need to sign the CLA. This would generally be changes that don't involve much creativity.
|
49
|
+
|
50
|
+
Contributions considered trivial are generally fewer than 10 lines of actual code. (It may be longer than 10 lines, for example these would often be larger: blank lines, changes in indentation, formatting, simple comments, logging messages, changes to metadata like Gemfiles or gitignore, reordering, breaking or combining files, renaming files, or other unoriginal changes)
|
data/DEPLOY_README.md
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
# Helpful things to remember when deploying to RubyGems
|
2
|
+
|
3
|
+
Ensure the version number is updated (lib/fakes3/version.rb)
|
4
|
+
|
5
|
+
Ensure the tests pass
|
6
|
+
```
|
7
|
+
rake test_server followed by rake test
|
8
|
+
```
|
9
|
+
|
10
|
+
Build the Gem
|
11
|
+
```
|
12
|
+
gem build fakes3.gemspec
|
13
|
+
```
|
14
|
+
|
15
|
+
Push to RubyGems
|
16
|
+
```
|
17
|
+
gem push fakes3-VERSION.gem
|
18
|
+
```
|
data/README.md
CHANGED
@@ -1,15 +1,13 @@
|
|
1
1
|
## Introduction
|
2
|
-
|
3
|
-
|
4
|
-
|
2
|
+
|
3
|
+
Fake S3 is a lightweight server that responds to the same API of Amazon S3.
|
4
|
+
|
5
|
+
It is extremely useful for testing of S3 in a sandbox environment without actually making calls to Amazon, which not only requires a network connection, but also costs money with every use.
|
5
6
|
|
6
7
|
The goal of Fake S3 is to minimize runtime dependencies and be more of a
|
7
|
-
development tool to test S3 calls in your code rather than a production server
|
8
|
-
looking to duplicate S3 functionality. Trying RiakCS, ParkPlace/Boardwalk, or
|
9
|
-
Ceph might be a place to start if that is your goal.
|
8
|
+
development tool to test S3 calls in your code rather than a production server looking to duplicate S3 functionality.
|
10
9
|
|
11
|
-
|
12
|
-
list, copy, and make bucket are supported. More coming soon.
|
10
|
+
Many commands are supported, including put, get, list, copy, and make bucket.
|
13
11
|
|
14
12
|
## Installation
|
15
13
|
|
@@ -17,46 +15,20 @@ list, copy, and make bucket are supported. More coming soon.
|
|
17
15
|
|
18
16
|
## Running
|
19
17
|
|
20
|
-
To run
|
18
|
+
To run the server, you just specify a root and a port.
|
21
19
|
|
22
20
|
fakes3 -r /mnt/fakes3_root -p 4567
|
23
21
|
|
24
|
-
## Connecting to
|
22
|
+
## Connecting to Fake S3
|
25
23
|
|
26
|
-
Take a look at the test cases to see client example usage. For now,
|
24
|
+
Take a look at the test cases to see client example usage. For now, Fake S3 is
|
27
25
|
mainly tested with s3cmd, aws-s3 gem, and right_aws. There are plenty more
|
28
26
|
libraries out there, and please do mention if other clients work or not.
|
29
27
|
|
30
28
|
Here is a running list of [supported clients](https://github.com/jubos/fake-s3/wiki/Supported-Clients "Supported Clients")
|
31
29
|
|
32
|
-
##
|
33
|
-
|
34
|
-
There are some pre-requesites to actually being able to run the unit/integration tests
|
35
|
-
|
36
|
-
### On OSX
|
37
|
-
|
38
|
-
Edit your /etc/hosts and add the following line:
|
39
|
-
|
40
|
-
127.0.0.1 posttest.localhost
|
41
|
-
|
42
|
-
Then ensure that the following packages are installed (boto, s3cmd)
|
43
|
-
|
44
|
-
> pip install boto
|
45
|
-
> brew install s3cmd
|
46
|
-
|
47
|
-
|
48
|
-
Start the test server using
|
49
|
-
|
50
|
-
rake test_server
|
51
|
-
|
52
|
-
Then in another terminal window run
|
53
|
-
|
54
|
-
rake test
|
55
|
-
|
56
|
-
It is a still a TODO to get this to be just one command
|
57
|
-
|
58
|
-
## More Information
|
30
|
+
## Contributing
|
59
31
|
|
60
|
-
|
32
|
+
Contributions in the form of pull requests, bug reports, documentation, or anything else are welcome! Please read the CONTRIBUTING.md file for more info:
|
61
33
|
|
62
|
-
|
34
|
+
(https://github.com/jubos/fake-s3/CONTRIBUTING.md)[https://github.com/jubos/fake-s3/CONTRIBUTING.md]
|
data/fakes3.gemspec
CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |s|
|
|
8
8
|
s.authors = ["Curtis Spencer"]
|
9
9
|
s.email = ["thorin@gmail.com"]
|
10
10
|
s.homepage = "https://github.com/jubos/fake-s3"
|
11
|
-
s.summary = %q{
|
12
|
-
s.description = %q{Use
|
11
|
+
s.summary = %q{Fake S3 is a server that simulates S3 commands so you can test your S3 functionality in your projects}
|
12
|
+
s.description = %q{Use Fake S3 to test basic S3 functionality without actually connecting to S3}
|
13
13
|
s.license = "MIT"
|
14
14
|
|
15
15
|
s.rubyforge_project = "fakes3"
|
@@ -19,8 +19,10 @@ Gem::Specification.new do |s|
|
|
19
19
|
s.add_development_dependency "right_aws"
|
20
20
|
s.add_development_dependency "rest-client"
|
21
21
|
s.add_development_dependency "rake"
|
22
|
+
s.add_development_dependency "aws-sdk", "~> 2"
|
22
23
|
s.add_development_dependency "aws-sdk-v1"
|
23
24
|
s.add_development_dependency "test-unit"
|
25
|
+
s.add_development_dependency "mocha"
|
24
26
|
#s.add_development_dependency "ruby-debug"
|
25
27
|
#s.add_development_dependency "debugger"
|
26
28
|
s.add_dependency "thor"
|
data/lib/fakes3/cli.rb
CHANGED
@@ -11,6 +11,7 @@ module FakeS3
|
|
11
11
|
method_option :port, :type => :numeric, :aliases => '-p', :required => true
|
12
12
|
method_option :address, :type => :string, :aliases => '-a', :required => false, :desc => "Bind to this address. Defaults to 0.0.0.0"
|
13
13
|
method_option :hostname, :type => :string, :aliases => '-H', :desc => "The root name of the host. Defaults to s3.amazonaws.com."
|
14
|
+
method_option :quiet, :type => :boolean, :aliases => '-q', :desc => "Quiet; do not write anything to standard output."
|
14
15
|
method_option :limit, :aliases => '-l', :type => :string, :desc => 'Rate limit for serving (ie. 50K, 1.0M)'
|
15
16
|
method_option :sslcert, :type => :string, :desc => 'Path to SSL certificate'
|
16
17
|
method_option :sslkey, :type => :string, :desc => 'Path to SSL certificate key'
|
@@ -52,8 +53,8 @@ module FakeS3
|
|
52
53
|
abort "If you specify an SSL certificate you must also specify an SSL certificate key"
|
53
54
|
end
|
54
55
|
|
55
|
-
puts "Loading FakeS3 with #{root} on port #{options[:port]} with hostname #{hostname}"
|
56
|
-
server = FakeS3::Server.new(address,options[:port],store,hostname,ssl_cert_path,ssl_key_path)
|
56
|
+
puts "Loading FakeS3 with #{root} on port #{options[:port]} with hostname #{hostname}" unless options[:quiet]
|
57
|
+
server = FakeS3::Server.new(address,options[:port],store,hostname,ssl_cert_path,ssl_key_path, quiet: !!options[:quiet])
|
57
58
|
server.serve
|
58
59
|
end
|
59
60
|
|
data/lib/fakes3/server.rb
CHANGED
@@ -77,7 +77,7 @@ module FakeS3
|
|
77
77
|
query = {
|
78
78
|
:marker => s_req.query["marker"] ? s_req.query["marker"].to_s : nil,
|
79
79
|
:prefix => s_req.query["prefix"] ? s_req.query["prefix"].to_s : nil,
|
80
|
-
:max_keys => s_req.query["
|
80
|
+
:max_keys => s_req.query["max-keys"] ? s_req.query["max-keys"].to_i : nil,
|
81
81
|
:delimiter => s_req.query["delimiter"] ? s_req.query["delimiter"].to_s : nil
|
82
82
|
}
|
83
83
|
bq = bucket_obj.query_for_range(query)
|
@@ -161,7 +161,7 @@ module FakeS3
|
|
161
161
|
end
|
162
162
|
end
|
163
163
|
|
164
|
-
def do_PUT(request,response)
|
164
|
+
def do_PUT(request, response)
|
165
165
|
s_req = normalize_request(request)
|
166
166
|
query = CGI::parse(request.request_uri.query || "")
|
167
167
|
|
@@ -258,7 +258,7 @@ module FakeS3
|
|
258
258
|
|
259
259
|
response.body = XmlAdapter.complete_multipart_result real_obj
|
260
260
|
elsif request.content_type =~ /^multipart\/form-data; boundary=(.+)/
|
261
|
-
key=request.query['key']
|
261
|
+
key = request.query['key']
|
262
262
|
|
263
263
|
success_action_redirect = request.query['success_action_redirect']
|
264
264
|
success_action_status = request.query['success_action_status']
|
@@ -300,7 +300,7 @@ module FakeS3
|
|
300
300
|
response['Access-Control-Expose-Headers'] = 'ETag'
|
301
301
|
end
|
302
302
|
|
303
|
-
def do_DELETE(request,response)
|
303
|
+
def do_DELETE(request, response)
|
304
304
|
s_req = normalize_request(request)
|
305
305
|
|
306
306
|
case s_req.type
|
@@ -326,7 +326,7 @@ module FakeS3
|
|
326
326
|
|
327
327
|
private
|
328
328
|
|
329
|
-
def normalize_delete(webrick_req,s_req)
|
329
|
+
def normalize_delete(webrick_req, s_req)
|
330
330
|
path = webrick_req.path
|
331
331
|
path_len = path.size
|
332
332
|
query = webrick_req.query
|
@@ -353,7 +353,7 @@ module FakeS3
|
|
353
353
|
end
|
354
354
|
end
|
355
355
|
|
356
|
-
def normalize_get(webrick_req,s_req)
|
356
|
+
def normalize_get(webrick_req, s_req)
|
357
357
|
path = webrick_req.path
|
358
358
|
path_len = path.size
|
359
359
|
query = webrick_req.query
|
@@ -382,7 +382,7 @@ module FakeS3
|
|
382
382
|
end
|
383
383
|
end
|
384
384
|
|
385
|
-
def normalize_put(webrick_req,s_req)
|
385
|
+
def normalize_put(webrick_req, s_req)
|
386
386
|
path = webrick_req.path
|
387
387
|
path_len = path.size
|
388
388
|
if path == "/"
|
@@ -432,11 +432,10 @@ module FakeS3
|
|
432
432
|
path_len = path.size
|
433
433
|
|
434
434
|
s_req.path = webrick_req.query['key']
|
435
|
-
|
436
435
|
s_req.webrick_request = webrick_req
|
437
436
|
|
438
437
|
if s_req.is_path_style
|
439
|
-
elems = path[1,path_len].split("/")
|
438
|
+
elems = path[1, path_len].split("/")
|
440
439
|
s_req.bucket = elems[0]
|
441
440
|
s_req.object = elems[1..-1].join('/') if elems.size >= 2
|
442
441
|
else
|
@@ -478,7 +477,7 @@ module FakeS3
|
|
478
477
|
return s_req
|
479
478
|
end
|
480
479
|
|
481
|
-
def parse_complete_multipart_upload
|
480
|
+
def parse_complete_multipart_upload(request)
|
482
481
|
parts_xml = ""
|
483
482
|
request.body { |chunk| parts_xml << chunk }
|
484
483
|
|
@@ -506,7 +505,7 @@ module FakeS3
|
|
506
505
|
|
507
506
|
|
508
507
|
class Server
|
509
|
-
def initialize(address,port,store,hostname,ssl_cert_path,ssl_key_path)
|
508
|
+
def initialize(address, port, store, hostname, ssl_cert_path, ssl_key_path, extra_options={})
|
510
509
|
@address = address
|
511
510
|
@port = port
|
512
511
|
@store = store
|
@@ -526,12 +525,22 @@ module FakeS3
|
|
526
525
|
}
|
527
526
|
)
|
528
527
|
end
|
528
|
+
|
529
|
+
if extra_options[:quiet]
|
530
|
+
webrick_config.merge!(
|
531
|
+
:Logger => WEBrick::Log.new("/dev/null"),
|
532
|
+
:AccessLog => []
|
533
|
+
)
|
534
|
+
end
|
535
|
+
|
529
536
|
@server = WEBrick::HTTPServer.new(webrick_config)
|
530
537
|
end
|
531
538
|
|
532
539
|
def serve
|
533
|
-
@server.mount "/", Servlet, @store
|
534
|
-
|
540
|
+
@server.mount "/", Servlet, @store, @hostname
|
541
|
+
shutdown = proc { @server.shutdown }
|
542
|
+
trap "INT", &shutdown
|
543
|
+
trap "TERM", &shutdown
|
535
544
|
@server.start
|
536
545
|
end
|
537
546
|
|
data/lib/fakes3/version.rb
CHANGED
@@ -0,0 +1,65 @@
|
|
1
|
+
require 'test/test_helper'
|
2
|
+
require 'aws-sdk'
|
3
|
+
|
4
|
+
class AwsSdkV2CommandsTest < Test::Unit::TestCase
|
5
|
+
def setup
|
6
|
+
@creds = Aws::Credentials.new('123', 'abc')
|
7
|
+
@s3 = Aws::S3::Client.new(credentials: @creds, region: 'us-east-1', endpoint: 'http://localhost:10453/')
|
8
|
+
@resource = Aws::S3::Resource.new(client: @s3)
|
9
|
+
@bucket = @resource.create_bucket(bucket: 'v2_bucket')
|
10
|
+
|
11
|
+
# Delete all objects to avoid sharing state between tests
|
12
|
+
@bucket.objects.each(&:delete)
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_create_bucket
|
16
|
+
bucket = @resource.create_bucket(bucket: 'v2_create_bucket')
|
17
|
+
assert_not_nil bucket
|
18
|
+
|
19
|
+
bucket_names = @resource.buckets.map(&:name)
|
20
|
+
assert(bucket_names.index("v2_create_bucket") >= 0)
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_destroy_bucket
|
24
|
+
@bucket.delete
|
25
|
+
|
26
|
+
begin
|
27
|
+
@s3.head_bucket(bucket: 'v2_bucket')
|
28
|
+
assert_fail("Shouldn't succeed here")
|
29
|
+
rescue
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_create_object
|
34
|
+
object = @bucket.object('key')
|
35
|
+
object.put(body: 'test')
|
36
|
+
|
37
|
+
assert_equal 'test', object.get.body.string
|
38
|
+
end
|
39
|
+
|
40
|
+
def test_delete_object
|
41
|
+
object = @bucket.object('exists')
|
42
|
+
object.put(body: 'test')
|
43
|
+
|
44
|
+
assert_equal 'test', object.get.body.string
|
45
|
+
|
46
|
+
object.delete
|
47
|
+
|
48
|
+
assert_raise Aws::S3::Errors::NoSuchKey do
|
49
|
+
object.get
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
# TODO - get this test working
|
54
|
+
#
|
55
|
+
#def test_copy_object
|
56
|
+
# object = @bucket.object("key_one")
|
57
|
+
# object.put(body: 'asdf')
|
58
|
+
|
59
|
+
# # TODO: explore why 'key1' won't work but 'key_one' will
|
60
|
+
# object2 = @bucket.object('key_two')
|
61
|
+
# object2.copy_from(copy_source: 'testing_copy/key_one')
|
62
|
+
|
63
|
+
# assert_equal 2, @bucket.objects.count
|
64
|
+
#end
|
65
|
+
end
|
data/test/cli_test.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'test/test_helper'
|
2
|
+
require 'test/minitest_helper'
|
3
|
+
require 'fakes3/cli'
|
4
|
+
|
5
|
+
|
6
|
+
class CLITest < Test::Unit::TestCase
|
7
|
+
def setup
|
8
|
+
super
|
9
|
+
FakeS3::Server.any_instance.stubs(:serve)
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_quiet_mode
|
13
|
+
script = FakeS3::CLI.new([], :root => '.', :port => 4567, :quiet => true)
|
14
|
+
assert_output('') do
|
15
|
+
script.invoke(:server)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# LICENSE:
|
2
|
+
#
|
3
|
+
# (The MIT License)
|
4
|
+
#
|
5
|
+
# Copyright © Ryan Davis, seattle.rb
|
6
|
+
#
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
8
|
+
#
|
9
|
+
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
10
|
+
#
|
11
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
12
|
+
|
13
|
+
# The following is from minitest:
|
14
|
+
# TODO - decide whether to switch to minitest or what to do about these:
|
15
|
+
|
16
|
+
def capture_io
|
17
|
+
require 'stringio'
|
18
|
+
|
19
|
+
captured_stdout, captured_stderr = StringIO.new, StringIO.new
|
20
|
+
|
21
|
+
orig_stdout, orig_stderr = $stdout, $stderr
|
22
|
+
$stdout, $stderr = captured_stdout, captured_stderr
|
23
|
+
|
24
|
+
begin
|
25
|
+
yield
|
26
|
+
ensure
|
27
|
+
$stdout = orig_stdout
|
28
|
+
$stderr = orig_stderr
|
29
|
+
end
|
30
|
+
|
31
|
+
return captured_stdout.string, captured_stderr.string
|
32
|
+
end
|
33
|
+
|
34
|
+
def assert_output stdout = nil, stderr = nil
|
35
|
+
out, err = capture_io do
|
36
|
+
yield
|
37
|
+
end
|
38
|
+
|
39
|
+
err_msg = Regexp === stderr ? :assert_match : :assert_equal if stderr
|
40
|
+
out_msg = Regexp === stdout ? :assert_match : :assert_equal if stdout
|
41
|
+
|
42
|
+
y = send err_msg, stderr, err, "In stderr" if err_msg
|
43
|
+
x = send out_msg, stdout, out, "In stdout" if out_msg
|
44
|
+
|
45
|
+
(!stdout || x) && (!stderr || y)
|
46
|
+
end
|
@@ -77,7 +77,7 @@ class RightAWSCommandsTest < Test::Unit::TestCase
|
|
77
77
|
assert_equal ["delimited/"], common_prefixes
|
78
78
|
|
79
79
|
common_prefixes = []
|
80
|
-
@s3.incrementally_list_bucket("s3media", {:prefix => "delimited/", :delimiter => '/', "max-keys" =>
|
80
|
+
@s3.incrementally_list_bucket("s3media", {:prefix => "delimited/", :delimiter => '/', "max-keys" => 100}) do |currentResponse|
|
81
81
|
key_names += currentResponse[:contents].map do |key|
|
82
82
|
key[:key]
|
83
83
|
end
|
data/test/s3cmd_test.rb
CHANGED
@@ -24,7 +24,7 @@ class S3CmdTest < Test::Unit::TestCase
|
|
24
24
|
end
|
25
25
|
end
|
26
26
|
output = `#{@s3cmd} put /tmp/fakes3_upload s3://s3cmd_bucket/upload`
|
27
|
-
assert_match(/
|
27
|
+
assert_match(/upload/,output)
|
28
28
|
|
29
29
|
FileUtils.rm("/tmp/fakes3_upload")
|
30
30
|
end
|
@@ -36,7 +36,7 @@ class S3CmdTest < Test::Unit::TestCase
|
|
36
36
|
end
|
37
37
|
end
|
38
38
|
output = `#{@s3cmd} put /tmp/fakes3_acl_upload s3://s3cmd_bucket/acl_upload`
|
39
|
-
assert_match(/
|
39
|
+
assert_match(/upload/,output)
|
40
40
|
|
41
41
|
output = `#{@s3cmd} --force setacl -P s3://s3cmd_bucket/acl_upload`
|
42
42
|
end
|
data/test/test_helper.rb
CHANGED
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.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Curtis Spencer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-12-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -80,6 +80,20 @@ dependencies:
|
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: aws-sdk
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '2'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '2'
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: aws-sdk-v1
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -108,6 +122,20 @@ dependencies:
|
|
108
122
|
- - ">="
|
109
123
|
- !ruby/object:Gem::Version
|
110
124
|
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: mocha
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
111
139
|
- !ruby/object:Gem::Dependency
|
112
140
|
name: thor
|
113
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -136,7 +164,7 @@ dependencies:
|
|
136
164
|
- - ">="
|
137
165
|
- !ruby/object:Gem::Version
|
138
166
|
version: '0'
|
139
|
-
description: Use
|
167
|
+
description: Use Fake S3 to test basic S3 functionality without actually connecting
|
140
168
|
to S3
|
141
169
|
email:
|
142
170
|
- thorin@gmail.com
|
@@ -146,7 +174,10 @@ extensions: []
|
|
146
174
|
extra_rdoc_files: []
|
147
175
|
files:
|
148
176
|
- ".gitignore"
|
177
|
+
- CONTRIBUTING.md
|
178
|
+
- DEPLOY_README.md
|
149
179
|
- Gemfile
|
180
|
+
- Gemfile.lock
|
150
181
|
- MIT-LICENSE
|
151
182
|
- README.md
|
152
183
|
- Rakefile
|
@@ -166,9 +197,12 @@ files:
|
|
166
197
|
- lib/fakes3/version.rb
|
167
198
|
- lib/fakes3/xml_adapter.rb
|
168
199
|
- test/aws_sdk_commands_test.rb
|
200
|
+
- test/aws_sdk_v2_commands_test.rb
|
169
201
|
- test/boto_test.rb
|
170
202
|
- test/botocmd.py
|
203
|
+
- test/cli_test.rb
|
171
204
|
- test/local_s3_cfg
|
205
|
+
- test/minitest_helper.rb
|
172
206
|
- test/post_test.rb
|
173
207
|
- test/right_aws_commands_test.rb
|
174
208
|
- test/s3_commands_test.rb
|
@@ -194,16 +228,19 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
194
228
|
version: '0'
|
195
229
|
requirements: []
|
196
230
|
rubyforge_project: fakes3
|
197
|
-
rubygems_version: 2.
|
231
|
+
rubygems_version: 2.6.8
|
198
232
|
signing_key:
|
199
233
|
specification_version: 4
|
200
|
-
summary:
|
234
|
+
summary: Fake S3 is a server that simulates S3 commands so you can test your S3 functionality
|
201
235
|
in your projects
|
202
236
|
test_files:
|
203
237
|
- test/aws_sdk_commands_test.rb
|
238
|
+
- test/aws_sdk_v2_commands_test.rb
|
204
239
|
- test/boto_test.rb
|
205
240
|
- test/botocmd.py
|
241
|
+
- test/cli_test.rb
|
206
242
|
- test/local_s3_cfg
|
243
|
+
- test/minitest_helper.rb
|
207
244
|
- test/post_test.rb
|
208
245
|
- test/right_aws_commands_test.rb
|
209
246
|
- test/s3_commands_test.rb
|