simple_aws 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.md +12 -0
- data/README.md +26 -26
- data/lib/{aws → simple_aws}/api.rb +4 -4
- data/lib/{aws → simple_aws}/auto_scaling.rb +6 -6
- data/lib/{aws → simple_aws}/call_types/action_param.rb +8 -8
- data/lib/{aws → simple_aws}/cloud_formation.rb +6 -6
- data/lib/{aws → simple_aws}/cloud_front.rb +17 -17
- data/lib/{aws → simple_aws}/cloud_watch.rb +6 -6
- data/lib/{aws → simple_aws}/core/connection.rb +4 -4
- data/lib/{aws → simple_aws}/core/request.rb +2 -2
- data/lib/{aws → simple_aws}/core/response.rb +4 -4
- data/lib/{aws → simple_aws}/core/util.rb +1 -1
- data/lib/{aws → simple_aws}/ec2.rb +6 -6
- data/lib/{aws → simple_aws}/elasti_cache.rb +6 -6
- data/lib/{aws → simple_aws}/elastic_beanstalk.rb +6 -6
- data/lib/{aws → simple_aws}/elb.rb +6 -6
- data/lib/{aws → simple_aws}/iam.rb +6 -6
- data/lib/{aws → simple_aws}/import_export.rb +6 -6
- data/lib/{aws → simple_aws}/map_reduce.rb +6 -6
- data/lib/{aws → simple_aws}/mechanical_turk.rb +5 -5
- data/lib/{aws → simple_aws}/rds.rb +6 -6
- data/lib/{aws → simple_aws}/s3.rb +15 -15
- data/lib/{aws → simple_aws}/ses.rb +6 -6
- data/lib/{aws → simple_aws}/signing/version2.rb +1 -1
- data/lib/{aws → simple_aws}/signing/version3.rb +1 -1
- data/lib/{aws → simple_aws}/sns.rb +6 -6
- data/lib/{aws → simple_aws}/sqs.rb +8 -8
- data/samples/cloud_front.rb +2 -2
- data/samples/ec2.rb +2 -2
- data/samples/elb.rb +2 -2
- data/samples/iam.rb +2 -2
- data/samples/s3.rb +2 -2
- data/samples/s3_batch_download.rb +2 -2
- data/samples/sqs.rb +2 -2
- data/samples/turk.rb +2 -2
- data/simple_aws.gemspec +1 -1
- data/test/{aws → simple_aws}/api_test.rb +3 -3
- data/test/{aws → simple_aws}/auto_scaling_test.rb +5 -5
- data/test/{aws → simple_aws}/call_types/action_param_test.rb +7 -7
- data/test/{aws → simple_aws}/cloud_formation_test.rb +5 -5
- data/test/{aws → simple_aws}/cloud_front_test.rb +11 -11
- data/test/{aws → simple_aws}/cloud_watch_test.rb +5 -5
- data/test/{aws → simple_aws}/core/connection_test.rb +16 -16
- data/test/{aws → simple_aws}/core/request_test.rb +3 -3
- data/test/{aws → simple_aws}/core/response_test.rb +23 -23
- data/test/{aws → simple_aws}/core/util_test.rb +7 -7
- data/test/{aws → simple_aws}/ec2_test.rb +5 -5
- data/test/{aws → simple_aws}/elasti_cache_test.rb +5 -5
- data/test/{aws → simple_aws}/elastic_beanstalk_test.rb +5 -5
- data/test/{aws → simple_aws}/elb_test.rb +5 -5
- data/test/{aws → simple_aws}/iam_test.rb +5 -5
- data/test/{aws → simple_aws}/import_export_test.rb +6 -6
- data/test/{aws → simple_aws}/map_reduce_test.rb +5 -5
- data/test/{aws → simple_aws}/mechanical_turk_test.rb +6 -6
- data/test/{aws → simple_aws}/rds_test.rb +5 -5
- data/test/{aws → simple_aws}/s3_test.rb +14 -14
- data/test/{aws → simple_aws}/ses.rb +6 -6
- data/test/{aws → simple_aws}/signing/version2_test.rb +8 -8
- data/test/{aws → simple_aws}/signing/version3.rb +8 -8
- data/test/{aws → simple_aws}/sns_test.rb +5 -5
- data/test/{aws → simple_aws}/sqs.rb +7 -7
- metadata +82 -81
@@ -1,10 +1,10 @@
|
|
1
1
|
require 'test_helper'
|
2
|
-
require '
|
2
|
+
require 'simple_aws/core/request'
|
3
3
|
|
4
|
-
describe
|
4
|
+
describe SimpleAWS::Request do
|
5
5
|
|
6
6
|
before do
|
7
|
-
@request =
|
7
|
+
@request = SimpleAWS::Request.new :get, "https://example.com", "/action"
|
8
8
|
end
|
9
9
|
|
10
10
|
it "is constructed with a method, host and path" do
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'test_helper'
|
2
|
-
require '
|
2
|
+
require 'simple_aws/core/response'
|
3
3
|
|
4
|
-
describe
|
4
|
+
describe SimpleAWS::Response do
|
5
5
|
|
6
6
|
def response_stub(success = true, code = 200)
|
7
7
|
http_response = stub
|
@@ -30,8 +30,8 @@ describe AWS::Response do
|
|
30
30
|
|
31
31
|
error =
|
32
32
|
lambda {
|
33
|
-
|
34
|
-
}.must_raise
|
33
|
+
SimpleAWS::Response.new @http_response
|
34
|
+
}.must_raise SimpleAWS::UnsuccessfulResponse
|
35
35
|
|
36
36
|
error.code.must_equal 401
|
37
37
|
error.error_type.must_equal "AuthFailure"
|
@@ -51,8 +51,8 @@ describe AWS::Response do
|
|
51
51
|
|
52
52
|
error =
|
53
53
|
lambda {
|
54
|
-
|
55
|
-
}.must_raise
|
54
|
+
SimpleAWS::Response.new @http_response
|
55
|
+
}.must_raise SimpleAWS::UnsuccessfulResponse
|
56
56
|
|
57
57
|
error.code.must_equal 401
|
58
58
|
error.error_type.must_equal "AuthFailure"
|
@@ -70,8 +70,8 @@ describe AWS::Response do
|
|
70
70
|
|
71
71
|
error =
|
72
72
|
lambda {
|
73
|
-
|
74
|
-
}.must_raise
|
73
|
+
SimpleAWS::Response.new @http_response
|
74
|
+
}.must_raise SimpleAWS::UnsuccessfulResponse
|
75
75
|
|
76
76
|
error.code.must_equal 401
|
77
77
|
error.error_type.must_equal "AuthFailure"
|
@@ -86,8 +86,8 @@ describe AWS::Response do
|
|
86
86
|
|
87
87
|
error =
|
88
88
|
lambda {
|
89
|
-
|
90
|
-
}.must_raise
|
89
|
+
SimpleAWS::Response.new @http_response
|
90
|
+
}.must_raise SimpleAWS::UnknownErrorResponse
|
91
91
|
|
92
92
|
error.message.must_match /Unable to parse error code from/
|
93
93
|
end
|
@@ -98,8 +98,8 @@ describe AWS::Response do
|
|
98
98
|
@http_response.stubs(:response).returns("This is a response ok?")
|
99
99
|
|
100
100
|
error = lambda {
|
101
|
-
response =
|
102
|
-
}.must_raise
|
101
|
+
response = SimpleAWS::Response.new @http_response
|
102
|
+
}.must_raise SimpleAWS::UnsuccessfulResponse
|
103
103
|
|
104
104
|
error.code.must_equal 404
|
105
105
|
error.message.must_equal " (404): This is a response ok?"
|
@@ -119,7 +119,7 @@ describe AWS::Response do
|
|
119
119
|
@http_response = response_stub
|
120
120
|
@http_response.stubs(:parsed_response).returns(@response_hash)
|
121
121
|
|
122
|
-
@response =
|
122
|
+
@response = SimpleAWS::Response.new @http_response
|
123
123
|
end
|
124
124
|
|
125
125
|
it "saves the parsed response" do
|
@@ -143,7 +143,7 @@ describe AWS::Response do
|
|
143
143
|
|
144
144
|
it "handles responses with no body" do
|
145
145
|
@http_response.stubs(:parsed_response).returns(nil)
|
146
|
-
response =
|
146
|
+
response = SimpleAWS::Response.new @http_response
|
147
147
|
response.body.must_be_nil
|
148
148
|
end
|
149
149
|
|
@@ -153,7 +153,7 @@ describe AWS::Response do
|
|
153
153
|
|
154
154
|
it "pulls out any response headers" do
|
155
155
|
@http_response.stubs(:headers).returns({"Header1" => "Value2"})
|
156
|
-
response =
|
156
|
+
response = SimpleAWS::Response.new @http_response
|
157
157
|
|
158
158
|
response.headers.must_equal "Header1" => "Value2"
|
159
159
|
end
|
@@ -175,7 +175,7 @@ describe AWS::Response do
|
|
175
175
|
http_response = response_stub true, 202
|
176
176
|
http_response.stubs(:parsed_response).returns(response_hash)
|
177
177
|
|
178
|
-
response =
|
178
|
+
response = SimpleAWS::Response.new http_response
|
179
179
|
|
180
180
|
response.volume_id.must_equal "v-12345"
|
181
181
|
response["volumeId"].must_equal "v-12345"
|
@@ -189,7 +189,7 @@ describe AWS::Response do
|
|
189
189
|
http_response = response_stub true, 202
|
190
190
|
http_response.stubs(:parsed_response).returns(response_hash)
|
191
191
|
|
192
|
-
response =
|
192
|
+
response = SimpleAWS::Response.new http_response
|
193
193
|
response.wont_be_nil
|
194
194
|
end
|
195
195
|
|
@@ -244,7 +244,7 @@ describe AWS::Response do
|
|
244
244
|
@http_response = response_stub true, 202
|
245
245
|
@http_response.stubs(:parsed_response).returns(@response_hash)
|
246
246
|
|
247
|
-
@response =
|
247
|
+
@response = SimpleAWS::Response.new @http_response
|
248
248
|
end
|
249
249
|
|
250
250
|
describe "#keys" do
|
@@ -350,7 +350,7 @@ describe AWS::Response do
|
|
350
350
|
@http_response = response_stub true, 200
|
351
351
|
@http_response.stubs(:parsed_response).returns("raw string body")
|
352
352
|
|
353
|
-
@response =
|
353
|
+
@response = SimpleAWS::Response.new @http_response
|
354
354
|
end
|
355
355
|
|
356
356
|
it "doesn't try to parse raw body data" do
|
@@ -362,7 +362,7 @@ describe AWS::Response do
|
|
362
362
|
@response.some_value
|
363
363
|
}.must_raise NoMethodError
|
364
364
|
|
365
|
-
error.message.must_match /
|
365
|
+
error.message.must_match /SimpleAWS::Response/
|
366
366
|
end
|
367
367
|
|
368
368
|
end
|
@@ -381,7 +381,7 @@ describe AWS::Response do
|
|
381
381
|
}
|
382
382
|
@http_response.stubs(:parsed_response).returns(response_hash)
|
383
383
|
|
384
|
-
response =
|
384
|
+
response = SimpleAWS::Response.new @http_response
|
385
385
|
|
386
386
|
response.request_id.must_equal "1234-Request-Id"
|
387
387
|
end
|
@@ -398,7 +398,7 @@ describe AWS::Response do
|
|
398
398
|
}
|
399
399
|
@http_response.stubs(:parsed_response).returns(response_hash)
|
400
400
|
|
401
|
-
response =
|
401
|
+
response = SimpleAWS::Response.new @http_response
|
402
402
|
|
403
403
|
response.request_id.must_equal "1234-Request-Id"
|
404
404
|
end
|
@@ -412,7 +412,7 @@ describe AWS::Response do
|
|
412
412
|
}
|
413
413
|
@http_response.stubs(:parsed_response).returns(response_hash)
|
414
414
|
|
415
|
-
response =
|
415
|
+
response = SimpleAWS::Response.new @http_response
|
416
416
|
|
417
417
|
response.request_id.must_be_nil
|
418
418
|
end
|
@@ -1,11 +1,11 @@
|
|
1
1
|
require 'test_helper'
|
2
|
-
require '
|
2
|
+
require 'simple_aws/core/util'
|
3
3
|
|
4
|
-
describe
|
4
|
+
describe SimpleAWS::Util do
|
5
5
|
|
6
6
|
describe "#build_xml_from" do
|
7
7
|
it "takes a hash and builds XML" do
|
8
|
-
response =
|
8
|
+
response = SimpleAWS::Util.build_xml_from :RootNode => { :InnerNode => "Value" }
|
9
9
|
|
10
10
|
response.must_equal <<END
|
11
11
|
<?xml version="1.0" encoding="UTF-8"?>
|
@@ -16,7 +16,7 @@ END
|
|
16
16
|
end
|
17
17
|
|
18
18
|
it "will add namespace to the root node" do
|
19
|
-
response =
|
19
|
+
response = SimpleAWS::Util.build_xml_from(
|
20
20
|
{:RootNode => { :InnerNode => "Value" }},
|
21
21
|
"http://cloudfront.amazonaws.com/doc/2010-11-01/"
|
22
22
|
)
|
@@ -30,7 +30,7 @@ END
|
|
30
30
|
end
|
31
31
|
|
32
32
|
it "works with arrays of items" do
|
33
|
-
response =
|
33
|
+
response = SimpleAWS::Util.build_xml_from(
|
34
34
|
{:RootNode => { :InnerNode => ["Value1", "Value2", "Value3"] }}
|
35
35
|
)
|
36
36
|
|
@@ -45,7 +45,7 @@ END
|
|
45
45
|
end
|
46
46
|
|
47
47
|
it "works at any nestedness of hashes" do
|
48
|
-
response =
|
48
|
+
response = SimpleAWS::Util.build_xml_from(
|
49
49
|
:RootNode => {
|
50
50
|
:InnerNode => [
|
51
51
|
{:Child => "Value1"},
|
@@ -68,7 +68,7 @@ END
|
|
68
68
|
end
|
69
69
|
|
70
70
|
it "auto-strings all leaf nodes" do
|
71
|
-
response =
|
71
|
+
response = SimpleAWS::Util.build_xml_from(
|
72
72
|
:RootNode => { :BoolVal => true, :Number => 12, :BadBool => false }
|
73
73
|
)
|
74
74
|
|
@@ -1,10 +1,10 @@
|
|
1
1
|
require 'test_helper'
|
2
|
-
require '
|
2
|
+
require 'simple_aws/ec2'
|
3
3
|
|
4
|
-
describe
|
4
|
+
describe SimpleAWS::EC2 do
|
5
5
|
|
6
6
|
before do
|
7
|
-
@api =
|
7
|
+
@api = SimpleAWS::EC2.new "key", "secret"
|
8
8
|
end
|
9
9
|
|
10
10
|
it "points to the endpoint" do
|
@@ -18,7 +18,7 @@ describe AWS::EC2 do
|
|
18
18
|
describe "API calls" do
|
19
19
|
|
20
20
|
it "builds and signs calls with ActionParam rules" do
|
21
|
-
|
21
|
+
SimpleAWS::Connection.any_instance.expects(:call).with do |request|
|
22
22
|
params = request.params
|
23
23
|
params.wont_be_nil
|
24
24
|
|
@@ -28,7 +28,7 @@ describe AWS::EC2 do
|
|
28
28
|
true
|
29
29
|
end
|
30
30
|
|
31
|
-
obj =
|
31
|
+
obj = SimpleAWS::EC2.new "key", "secret"
|
32
32
|
obj.describe_instances
|
33
33
|
end
|
34
34
|
|
@@ -1,10 +1,10 @@
|
|
1
1
|
require 'test_helper'
|
2
|
-
require '
|
2
|
+
require 'simple_aws/elasti_cache'
|
3
3
|
|
4
|
-
describe
|
4
|
+
describe SimpleAWS::ElastiCache do
|
5
5
|
|
6
6
|
before do
|
7
|
-
@api =
|
7
|
+
@api = SimpleAWS::ElastiCache.new "key", "secret"
|
8
8
|
end
|
9
9
|
|
10
10
|
it "points to the endpoint, default to us-east-1" do
|
@@ -18,7 +18,7 @@ describe AWS::ElastiCache do
|
|
18
18
|
describe "API calls" do
|
19
19
|
|
20
20
|
it "builds and signs calls with ActionParam rules" do
|
21
|
-
|
21
|
+
SimpleAWS::Connection.any_instance.expects(:call).with do |request|
|
22
22
|
params = request.params
|
23
23
|
params.wont_be_nil
|
24
24
|
|
@@ -28,7 +28,7 @@ describe AWS::ElastiCache do
|
|
28
28
|
true
|
29
29
|
end
|
30
30
|
|
31
|
-
obj =
|
31
|
+
obj = SimpleAWS::ElastiCache.new "key", "secret"
|
32
32
|
obj.describe_events
|
33
33
|
end
|
34
34
|
|
@@ -1,10 +1,10 @@
|
|
1
1
|
require 'test_helper'
|
2
|
-
require '
|
2
|
+
require 'simple_aws/elastic_beanstalk'
|
3
3
|
|
4
|
-
describe
|
4
|
+
describe SimpleAWS::ElasticBeanstalk do
|
5
5
|
|
6
6
|
before do
|
7
|
-
@api =
|
7
|
+
@api = SimpleAWS::ElasticBeanstalk.new "key", "secret"
|
8
8
|
end
|
9
9
|
|
10
10
|
it "points to endpoint, default to us-east-1" do
|
@@ -18,7 +18,7 @@ describe AWS::ElasticBeanstalk do
|
|
18
18
|
describe "API calls" do
|
19
19
|
|
20
20
|
it "builds and signs calls with ActionParam rules" do
|
21
|
-
|
21
|
+
SimpleAWS::Connection.any_instance.expects(:call).with do |request|
|
22
22
|
params = request.params
|
23
23
|
params.wont_be_nil
|
24
24
|
|
@@ -28,7 +28,7 @@ describe AWS::ElasticBeanstalk do
|
|
28
28
|
true
|
29
29
|
end
|
30
30
|
|
31
|
-
obj =
|
31
|
+
obj = SimpleAWS::ElasticBeanstalk.new "key", "secret"
|
32
32
|
obj.describe_applications
|
33
33
|
end
|
34
34
|
|
@@ -1,10 +1,10 @@
|
|
1
1
|
require 'test_helper'
|
2
|
-
require '
|
2
|
+
require 'simple_aws/elb'
|
3
3
|
|
4
|
-
describe
|
4
|
+
describe SimpleAWS::ELB do
|
5
5
|
|
6
6
|
before do
|
7
|
-
@api =
|
7
|
+
@api = SimpleAWS::ELB.new "key", "secret"
|
8
8
|
end
|
9
9
|
|
10
10
|
it "points to the endpoint" do
|
@@ -18,7 +18,7 @@ describe AWS::ELB do
|
|
18
18
|
describe "API calls" do
|
19
19
|
|
20
20
|
it "builds and signs calls with ActionParam rules" do
|
21
|
-
|
21
|
+
SimpleAWS::Connection.any_instance.expects(:call).with do |request|
|
22
22
|
params = request.params
|
23
23
|
params.wont_be_nil
|
24
24
|
|
@@ -28,7 +28,7 @@ describe AWS::ELB do
|
|
28
28
|
true
|
29
29
|
end
|
30
30
|
|
31
|
-
obj =
|
31
|
+
obj = SimpleAWS::ELB.new "key", "secret"
|
32
32
|
obj.describe_load_balancers
|
33
33
|
end
|
34
34
|
|
@@ -1,10 +1,10 @@
|
|
1
1
|
require 'test_helper'
|
2
|
-
require '
|
2
|
+
require 'simple_aws/iam'
|
3
3
|
|
4
|
-
describe
|
4
|
+
describe SimpleAWS::IAM do
|
5
5
|
|
6
6
|
before do
|
7
|
-
@api =
|
7
|
+
@api = SimpleAWS::IAM.new "key", "secret"
|
8
8
|
end
|
9
9
|
|
10
10
|
it "points to the endpoint" do
|
@@ -18,7 +18,7 @@ describe AWS::IAM do
|
|
18
18
|
describe "API calls" do
|
19
19
|
|
20
20
|
it "builds and signs calls with ActionParam rules" do
|
21
|
-
|
21
|
+
SimpleAWS::Connection.any_instance.expects(:call).with do |request|
|
22
22
|
params = request.params
|
23
23
|
params.wont_be_nil
|
24
24
|
|
@@ -28,7 +28,7 @@ describe AWS::IAM do
|
|
28
28
|
true
|
29
29
|
end
|
30
30
|
|
31
|
-
obj =
|
31
|
+
obj = SimpleAWS::IAM.new "key", "secret"
|
32
32
|
obj.get_group
|
33
33
|
end
|
34
34
|
|
@@ -1,15 +1,15 @@
|
|
1
1
|
require 'test_helper'
|
2
|
-
require '
|
2
|
+
require 'simple_aws/import_export'
|
3
3
|
|
4
|
-
describe
|
4
|
+
describe SimpleAWS::ImportExport do
|
5
5
|
|
6
6
|
before do
|
7
|
-
@api =
|
7
|
+
@api = SimpleAWS::ImportExport.new "key", "secret"
|
8
8
|
end
|
9
9
|
|
10
10
|
it "does not support region selection" do
|
11
11
|
lambda {
|
12
|
-
|
12
|
+
SimpleAWS::ImportExport.new "key", "secret", "us-east-1"
|
13
13
|
}.must_raise ArgumentError
|
14
14
|
end
|
15
15
|
|
@@ -24,7 +24,7 @@ describe AWS::ImportExport do
|
|
24
24
|
describe "API calls" do
|
25
25
|
|
26
26
|
it "builds and signs calls with ActionParam rules" do
|
27
|
-
|
27
|
+
SimpleAWS::Connection.any_instance.expects(:call).with do |request|
|
28
28
|
params = request.params
|
29
29
|
params.wont_be_nil
|
30
30
|
|
@@ -34,7 +34,7 @@ describe AWS::ImportExport do
|
|
34
34
|
true
|
35
35
|
end
|
36
36
|
|
37
|
-
obj =
|
37
|
+
obj = SimpleAWS::ImportExport.new "key", "secret"
|
38
38
|
obj.list_jobs
|
39
39
|
end
|
40
40
|
|
@@ -1,10 +1,10 @@
|
|
1
1
|
require 'test_helper'
|
2
|
-
require '
|
2
|
+
require 'simple_aws/map_reduce'
|
3
3
|
|
4
|
-
describe
|
4
|
+
describe SimpleAWS::MapReduce do
|
5
5
|
|
6
6
|
before do
|
7
|
-
@api =
|
7
|
+
@api = SimpleAWS::MapReduce.new "key", "secret"
|
8
8
|
end
|
9
9
|
|
10
10
|
it "points to the endpoint" do
|
@@ -18,7 +18,7 @@ describe AWS::MapReduce do
|
|
18
18
|
describe "API calls" do
|
19
19
|
|
20
20
|
it "builds and signs calls with ActionParam rules" do
|
21
|
-
|
21
|
+
SimpleAWS::Connection.any_instance.expects(:call).with do |request|
|
22
22
|
params = request.params
|
23
23
|
params.wont_be_nil
|
24
24
|
|
@@ -28,7 +28,7 @@ describe AWS::MapReduce do
|
|
28
28
|
true
|
29
29
|
end
|
30
30
|
|
31
|
-
obj =
|
31
|
+
obj = SimpleAWS::MapReduce.new "key", "secret"
|
32
32
|
obj.get_group
|
33
33
|
end
|
34
34
|
|
@@ -1,10 +1,10 @@
|
|
1
1
|
require 'test_helper'
|
2
|
-
require '
|
2
|
+
require 'simple_aws/mechanical_turk'
|
3
3
|
|
4
|
-
describe
|
4
|
+
describe SimpleAWS::MechanicalTurk do
|
5
5
|
|
6
6
|
before do
|
7
|
-
@api =
|
7
|
+
@api = SimpleAWS::MechanicalTurk.new "key", "secret"
|
8
8
|
end
|
9
9
|
|
10
10
|
it "points to the endpoint" do
|
@@ -16,14 +16,14 @@ describe AWS::MechanicalTurk do
|
|
16
16
|
end
|
17
17
|
|
18
18
|
it "can be told to work in sandbox mode" do
|
19
|
-
api =
|
19
|
+
api = SimpleAWS::MechanicalTurk.new "key", "secret", true
|
20
20
|
api.uri.must_equal "https://mechanicalturk.sandbox.amazonaws.com"
|
21
21
|
end
|
22
22
|
|
23
23
|
describe "API calls" do
|
24
24
|
|
25
25
|
it "builds and signs calls with Operation and Service" do
|
26
|
-
|
26
|
+
SimpleAWS::Connection.any_instance.expects(:call).with do |request|
|
27
27
|
params = request.params
|
28
28
|
params.wont_be_nil
|
29
29
|
|
@@ -36,7 +36,7 @@ describe AWS::MechanicalTurk do
|
|
36
36
|
true
|
37
37
|
end
|
38
38
|
|
39
|
-
obj =
|
39
|
+
obj = SimpleAWS::MechanicalTurk.new "key", "secret"
|
40
40
|
obj.SearchHITs
|
41
41
|
end
|
42
42
|
|
@@ -1,10 +1,10 @@
|
|
1
1
|
require 'test_helper'
|
2
|
-
require '
|
2
|
+
require 'simple_aws/rds'
|
3
3
|
|
4
|
-
describe
|
4
|
+
describe SimpleAWS::RDS do
|
5
5
|
|
6
6
|
before do
|
7
|
-
@api =
|
7
|
+
@api = SimpleAWS::RDS.new "key", "secret"
|
8
8
|
end
|
9
9
|
|
10
10
|
it "points to the endpoint" do
|
@@ -18,7 +18,7 @@ describe AWS::RDS do
|
|
18
18
|
describe "API calls" do
|
19
19
|
|
20
20
|
it "builds and signs calls with ActionParam rules" do
|
21
|
-
|
21
|
+
SimpleAWS::Connection.any_instance.expects(:call).with do |request|
|
22
22
|
params = request.params
|
23
23
|
params.wont_be_nil
|
24
24
|
|
@@ -28,7 +28,7 @@ describe AWS::RDS do
|
|
28
28
|
true
|
29
29
|
end
|
30
30
|
|
31
|
-
obj =
|
31
|
+
obj = SimpleAWS::RDS.new "key", "secret"
|
32
32
|
obj.describe_events
|
33
33
|
end
|
34
34
|
|
@@ -1,10 +1,10 @@
|
|
1
1
|
require 'test_helper'
|
2
|
-
require '
|
2
|
+
require 'simple_aws/s3'
|
3
3
|
|
4
|
-
describe
|
4
|
+
describe SimpleAWS::S3 do
|
5
5
|
|
6
6
|
before do
|
7
|
-
@api =
|
7
|
+
@api = SimpleAWS::S3.new "key", "secret"
|
8
8
|
end
|
9
9
|
|
10
10
|
it "points to the endpoint" do
|
@@ -12,7 +12,7 @@ describe AWS::S3 do
|
|
12
12
|
end
|
13
13
|
|
14
14
|
it "properly builds region endpoints" do
|
15
|
-
api =
|
15
|
+
api = SimpleAWS::S3.new "key", "secret", "us-west-1"
|
16
16
|
api.uri.must_equal "https://s3-us-west-1.amazonaws.com"
|
17
17
|
end
|
18
18
|
|
@@ -60,7 +60,7 @@ describe AWS::S3 do
|
|
60
60
|
|
61
61
|
[:get, :put, :delete, :head].each do |method|
|
62
62
|
it "supports the #{method} HTTP method" do
|
63
|
-
|
63
|
+
SimpleAWS::Connection.any_instance.expects(:call).with do |request|
|
64
64
|
request.method.must_equal method
|
65
65
|
request.host.must_equal "https://s3.amazonaws.com"
|
66
66
|
request.path.must_equal "/"
|
@@ -72,7 +72,7 @@ describe AWS::S3 do
|
|
72
72
|
end
|
73
73
|
|
74
74
|
it "rebuilds the path if :bucket given" do
|
75
|
-
|
75
|
+
SimpleAWS::Connection.any_instance.expects(:call).with do |request|
|
76
76
|
request.path.must_equal "/bucket-name/"
|
77
77
|
true
|
78
78
|
end
|
@@ -81,7 +81,7 @@ describe AWS::S3 do
|
|
81
81
|
end
|
82
82
|
|
83
83
|
it "auto-fixes path names if not preceeded by a /" do
|
84
|
-
|
84
|
+
SimpleAWS::Connection.any_instance.expects(:call).with do |request|
|
85
85
|
request.path.must_equal "/bucket-name/object_name/that_thing.jpg"
|
86
86
|
true
|
87
87
|
end
|
@@ -90,7 +90,7 @@ describe AWS::S3 do
|
|
90
90
|
end
|
91
91
|
|
92
92
|
it "takes parameters" do
|
93
|
-
|
93
|
+
SimpleAWS::Connection.any_instance.expects(:call).with do |request|
|
94
94
|
request.params["Parameter1"].must_equal "Value2"
|
95
95
|
true
|
96
96
|
end
|
@@ -99,7 +99,7 @@ describe AWS::S3 do
|
|
99
99
|
end
|
100
100
|
|
101
101
|
it "handles the special response- parameters" do
|
102
|
-
|
102
|
+
SimpleAWS::Connection.any_instance.expects(:call).with do |request|
|
103
103
|
request.path.must_equal "/?response-content-type=application/xml"
|
104
104
|
request.params["response-content-type"].must_be_nil
|
105
105
|
true
|
@@ -109,7 +109,7 @@ describe AWS::S3 do
|
|
109
109
|
end
|
110
110
|
|
111
111
|
it "takes extra headers" do
|
112
|
-
|
112
|
+
SimpleAWS::Connection.any_instance.expects(:call).with do |request|
|
113
113
|
request.headers["Header14"].must_equal "Out to Lunch"
|
114
114
|
true
|
115
115
|
end
|
@@ -118,7 +118,7 @@ describe AWS::S3 do
|
|
118
118
|
end
|
119
119
|
|
120
120
|
it "takes a raw body" do
|
121
|
-
|
121
|
+
SimpleAWS::Connection.any_instance.expects(:call).with do |request|
|
122
122
|
request.body.must_equal "This is a body of text"
|
123
123
|
true
|
124
124
|
end
|
@@ -129,7 +129,7 @@ describe AWS::S3 do
|
|
129
129
|
it "adds appropriate headers if the body has a file in it" do
|
130
130
|
file = File.new("Gemfile")
|
131
131
|
|
132
|
-
|
132
|
+
SimpleAWS::Connection.any_instance.expects(:call).with do |request|
|
133
133
|
request.body.must_equal file
|
134
134
|
|
135
135
|
request.headers["Content-Length"].must_equal File.size(file).to_s
|
@@ -142,7 +142,7 @@ describe AWS::S3 do
|
|
142
142
|
end
|
143
143
|
|
144
144
|
it "uses previously set content type if given" do
|
145
|
-
|
145
|
+
SimpleAWS::Connection.any_instance.expects(:call).with do |request|
|
146
146
|
request.headers["Content-Type"].must_equal(
|
147
147
|
"application/pdf"
|
148
148
|
)
|
@@ -154,7 +154,7 @@ describe AWS::S3 do
|
|
154
154
|
end
|
155
155
|
|
156
156
|
it "signs the given request according to Version 3 rules" do
|
157
|
-
|
157
|
+
SimpleAWS::Connection.any_instance.expects(:call).with do |request|
|
158
158
|
header = request.headers["Authorization"]
|
159
159
|
parts = header.split(":")
|
160
160
|
|
@@ -1,15 +1,15 @@
|
|
1
1
|
require 'test_helper'
|
2
|
-
require '
|
2
|
+
require 'simple_aws/ses'
|
3
3
|
|
4
|
-
describe
|
4
|
+
describe SimpleAWS::SES do
|
5
5
|
|
6
6
|
before do
|
7
|
-
@api =
|
7
|
+
@api = SimpleAWS::SES.new "key", "secret"
|
8
8
|
end
|
9
9
|
|
10
10
|
it "only works on one endpoint" do
|
11
11
|
lambda {
|
12
|
-
|
12
|
+
SimpleAWS::SES.new "key", "secret", "us-west-1"
|
13
13
|
}.must_raise ArgumentError
|
14
14
|
end
|
15
15
|
|
@@ -24,7 +24,7 @@ describe AWS::SES do
|
|
24
24
|
describe "API calls" do
|
25
25
|
|
26
26
|
it "builds and signs calls with Signature Version 3" do
|
27
|
-
|
27
|
+
SimpleAWS::Connection.any_instance.expects(:call).with do |request|
|
28
28
|
params = request.params
|
29
29
|
params.wont_be_nil
|
30
30
|
|
@@ -34,7 +34,7 @@ describe AWS::SES do
|
|
34
34
|
true
|
35
35
|
end
|
36
36
|
|
37
|
-
obj =
|
37
|
+
obj = SimpleAWS::SES.new "key", "secret"
|
38
38
|
obj.send_email
|
39
39
|
end
|
40
40
|
|