s3 0.2.4 → 0.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,24 +5,22 @@ module S3
5
5
  # Implements algorithm defined by Amazon Web Services to sign
6
6
  # request with secret private credentials
7
7
  #
8
- # === See:
8
+ # === See
9
9
  # http://docs.amazonwebservices.com/AmazonS3/latest/index.html?RESTAuthentication.html
10
10
 
11
11
  class Signature
12
12
 
13
13
  # Generates signature for given parameters
14
14
  #
15
- # ==== Parameters:
16
- # +options+: a hash that contains options listed below
15
+ # ==== Options
16
+ # * <tt>:host</tt> - Hostname
17
+ # * <tt>:request</tt> - Net::HTTPRequest object with correct
18
+ # headers
19
+ # * <tt>:access_key_id</tt> - Access key id
20
+ # * <tt>:secret_access_key</tt> - Secret access key
17
21
  #
18
- # ==== Options:
19
- # +host+: hostname
20
- # +request+: Net::HTTPRequest object with correct headers
21
- # +access_key_id+: access key id
22
- # +secret_access_key+: secret access key
23
- #
24
- # ==== Returns:
25
- # Generated signature for given hostname and request
22
+ # ==== Returns
23
+ # Generated signature string for given hostname and request
26
24
  def self.generate(options)
27
25
  request = options[:request]
28
26
  host = options[:host]
@@ -56,16 +54,43 @@ module S3
56
54
  "AWS #{access_key_id}:#{signature}"
57
55
  end
58
56
 
57
+ # Generates temporary URL for given resource
58
+ #
59
+ # ==== Options
60
+ # * <tt>:bucket</tt> - Bucket in which the resource resides
61
+ # * <tt>:resource</tt> - Path to the resouce you want to create
62
+ # a teporary link to
63
+ # * <tt>:secret_access_key</tt> - Secret access key
64
+ # * <tt>:expires_on</tt> - Unix time stamp of when the resouce
65
+ # link will expire
66
+ def self.generate_temporary_url_signature(options)
67
+ bucket = options[:bucket]
68
+ resource = options[:resource]
69
+ secret_access_key = options[:secret_access_key]
70
+ expires = options[:expires_on]
71
+
72
+ string_to_sign = "GET\n\n\n#{expires}\n/#{bucket}/#{resource}";
73
+
74
+ digest = OpenSSL::Digest::Digest.new('sha1')
75
+ hmac = OpenSSL::HMAC.digest(digest, secret_access_key, string_to_sign)
76
+ base64 = Base64.encode64(hmac)
77
+ signature = base64.chomp
78
+
79
+ CGI.escape(signature)
80
+ end
81
+
59
82
  private
60
83
 
61
- # Helper method for extracting header fields from Net::HTTPRequest and
62
- # preparing them for singing in #generate method
84
+ # Helper method for extracting header fields from Net::HTTPRequest
85
+ # and preparing them for singing in #generate method
63
86
  #
64
- # ==== Parameters:
65
- # +request+: Net::HTTPRequest object with header fields filled in
87
+ # ==== Parameters
88
+ # * <tt>request</tt> - Net::HTTPRequest object with header fields
89
+ # filled in
66
90
  #
67
- # ==== Returns:
68
- # String containing interesting header fields in suitable order and form
91
+ # ==== Returns
92
+ # String containing interesting header fields in suitable order
93
+ # and form
69
94
  def self.canonicalized_amz_headers(request)
70
95
  headers = []
71
96
 
@@ -123,11 +148,12 @@ module S3
123
148
 
124
149
  # Helper methods for extracting caninocalized resource address
125
150
  #
126
- # ==== Parameters:
127
- # +host+: hostname
128
- # +request+: Net::HTTPRequest object with headers filealds filled in
151
+ # ==== Parameters
152
+ # * <tt>host</tt> - Hostname
153
+ # * <tt>request</tt> - Net::HTTPRequest object with header fields
154
+ # filled in
129
155
  #
130
- # ==== Returns:
156
+ # ==== Returns
131
157
  # String containing extracted canonicalized resource
132
158
  def self.canonicalized_resource(host, request)
133
159
  # 1. Start with the empty string ("").
@@ -1,4 +1,4 @@
1
- require 'test_helper'
1
+ require "test_helper"
2
2
 
3
3
  class BucketTest < Test::Unit::TestCase
4
4
  def setup
@@ -6,49 +6,54 @@ class BucketTest < Test::Unit::TestCase
6
6
  @bucket_path = S3::Bucket.send(:new, nil, "Data_Bucket")
7
7
  @bucket = @bucket_vhost
8
8
 
9
- @response_location = Net::HTTPOK.new("1.1", "200", "OK")
10
- stub(@response_location).body { @bucket_location_body }
11
9
  @bucket_location = "EU"
12
10
  @bucket_location_body = <<-EOLocation
13
11
  <?xml version="1.0" encoding="UTF-8"?>\n<LocationConstraint xmlns="http://s3.amazonaws.com/doc/2006-03-01/">EU</LocationConstraint>
14
12
  EOLocation
15
13
 
16
- @reponse_owned_by_you = Net::HTTPConflict.new("1.1", "409", "Conflict")
17
- stub(@reponse_owned_by_you).body { @bucket_owned_by_you_body }
14
+ @response_location = Net::HTTPOK.new("1.1", "200", "OK")
15
+ @response_location.stubs(:body).returns(@bucket_location_body)
16
+
18
17
  @bucket_owned_by_you_body = <<-EOOwnedByYou
19
18
  <?xml version="1.0" encoding="UTF-8"?>\n<Error> <Code>BucketAlreadyOwnedByYou</Code> <Message>Your previous request to create the named bucket succeeded and you already own it.</Message> <BucketName>bucket</BucketName> <RequestId>117D08EA0EC6E860</RequestId> <HostId>4VpMSvmJ+G5+DLtVox6O5cZNgdPlYcjCu3l0n4HjDe01vPxxuk5eTAtcAkUynRyV</HostId> </Error>
20
19
  EOOwnedByYou
21
20
 
22
- @reponse_already_exists = Net::HTTPConflict.new("1.1", "409", "Conflict")
23
- stub(@response_already_exists).body { @bucket_already_exists_body }
21
+ @reponse_owned_by_you = Net::HTTPConflict.new("1.1", "409", "Conflict")
22
+ @reponse_owned_by_you.stubs(:body).returns(@bucket_owned_by_you_body)
23
+
24
24
  @bucket_already_exists_body = <<-EOAlreadyExists
25
25
  <?xml version="1.0" encoding="UTF-8"?>\n<Error> <Code>BucketAlreadyExists</Code> <Message>The requested bucket name is not available. The bucket namespace is shared by all users of the system. Please select a different name and try again.</Message> <BucketName>bucket</BucketName> <RequestId>4C154D32807C92BD</RequestId> <HostId>/xyHQgXcUXTZQhoO+NUBzbaxbFrIhKlyuaRHFnmcId0bMePvY9Zwg+dyk2LYE4g5</HostId> </Error>
26
26
  EOAlreadyExists
27
27
 
28
+ @reponse_already_exists = Net::HTTPConflict.new("1.1", "409", "Conflict")
29
+ @response_already_exists.stubs(:body).returns(@bucket_already_exists_body)
30
+
28
31
  @objects_list_empty = []
29
32
  @objects_list = [
30
33
  S3::Object.send(:new, @bucket, :key => "obj1"),
31
34
  S3::Object.send(:new, @bucket, :key => "obj2")
32
35
  ]
33
36
 
34
- @response_objects_list_empty = Net::HTTPOK.new("1.1", "200", "OK")
35
- stub(@response_objects_list_empty).body { @response_objects_list_empty_body }
36
37
  @response_objects_list_empty_body = <<-EOEmpty
37
38
  <?xml version="1.0" encoding="UTF-8"?>\n<ListBucketResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/"> <Name>bucket</Name> <Prefix></Prefix> <Marker></Marker> <MaxKeys>1000</MaxKeys> <IsTruncated>false</IsTruncated> </ListBucketResult>
38
39
  EOEmpty
39
40
 
40
- @response_objects_list = Net::HTTPOK.new("1.1", "200", "OK")
41
- stub(@response_objects_list).body { @response_objects_list_body }
41
+ @response_objects_list_empty = Net::HTTPOK.new("1.1", "200", "OK")
42
+ @response_objects_list_empty.stubs(:body).returns(@response_objects_list_empty_body)
43
+
42
44
  @response_objects_list_body = <<-EOObjects
43
45
  <?xml version="1.0" encoding="UTF-8"?>\n<ListBucketResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/"> <Name>bucket</Name> <Prefix></Prefix> <Marker></Marker> <MaxKeys>1000</MaxKeys> <IsTruncated>false</IsTruncated> <Contents> <Key>obj1</Key> <LastModified>2009-07-03T10:17:33.000Z</LastModified> <ETag>&quot;99519cdf14c255e580e1b7bca85a458c&quot;</ETag> <Size>1729</Size> <Owner> <ID>df864aeb6f42be43f1d9e60aaabe3f15e245b035a4b79d1cfe36c4deaec67205</ID> <DisplayName>owner</DisplayName> </Owner> <StorageClass>STANDARD</StorageClass> </Contents> <Contents> <Key>obj2</Key> <LastModified>2009-07-03T11:17:33.000Z</LastModified> <ETag>&quot;99519cdf14c255e586e1b12bca85a458c&quot;</ETag> <Size>179</Size> <Owner> <ID>df864aeb6f42be43f1d9e60aaabe3f17e247b037a4b79d1cfe36c4deaec67205</ID> <DisplayName>owner</DisplayName> </Owner> <StorageClass>STANDARD</StorageClass> </Contents> </ListBucketResult>
44
46
  EOObjects
47
+
48
+ @response_objects_list = Net::HTTPOK.new("1.1", "200", "OK")
49
+ @response_objects_list.stubs(:body).returns(@response_objects_list_body)
45
50
  end
46
51
 
47
- def test_name_valid
52
+ test "name valid" do
48
53
  assert_raise ArgumentError do S3::Bucket.send(:new, nil, "") end # should not be valid with empty name
49
54
  assert_raise ArgumentError do S3::Bucket.send(:new, nil, "10.0.0.1") end # should not be valid with IP as name
50
55
  assert_raise ArgumentError do S3::Bucket.send(:new, nil, "as") end # should not be valid with name shorter than 3 characters
51
- assert_raise ArgumentError do S3::Bucket.send(:new, nil, "a"*256) end # should not be valid with name longer than 255 characters
56
+ assert_raise ArgumentError do S3::Bucket.send(:new, nil, "a" * 256) end # should not be valid with name longer than 255 characters
52
57
  assert_raise ArgumentError do S3::Bucket.send(:new, nil, ".asdf") end # should not allow special characters as first character
53
58
  assert_raise ArgumentError do S3::Bucket.send(:new, nil, "-asdf") end # should not allow special characters as first character
54
59
  assert_raise ArgumentError do S3::Bucket.send(:new, nil, "_asdf") end # should not allow special characters as first character
@@ -60,7 +65,7 @@ class BucketTest < Test::Unit::TestCase
60
65
  end
61
66
  end
62
67
 
63
- def test_path_prefix
68
+ test "path prefix" do
64
69
  expected = ""
65
70
  actual = @bucket_vhost.path_prefix
66
71
  assert_equal expected, actual
@@ -70,7 +75,7 @@ class BucketTest < Test::Unit::TestCase
70
75
  assert_equal expected, actual
71
76
  end
72
77
 
73
- def test_host
78
+ test "host" do
74
79
  expected = "Data-Bucket.s3.amazonaws.com"
75
80
  actual = @bucket_vhost.host
76
81
  assert_equal expected, actual
@@ -80,85 +85,85 @@ class BucketTest < Test::Unit::TestCase
80
85
  assert_equal expected, actual
81
86
  end
82
87
 
83
- def test_vhost
88
+ test "vhost" do
84
89
  assert @bucket_vhost.vhost?
85
90
  assert ! @bucket_path.vhost?
86
91
  end
87
92
 
88
- def test_exists
89
- mock(@bucket).retrieve { @bucket_vhost }
93
+ test "exists" do
94
+ @bucket.expects(:retrieve).returns(@bucket_vhost)
90
95
  assert @bucket.exists?
91
96
 
92
- mock(@bucket).retrieve { raise S3::Error::NoSuchBucket.new(nil, nil) }
97
+ @bucket.expects(:retrieve).raises(S3::Error::NoSuchBucket.new(nil, nil))
93
98
  assert ! @bucket.exists?
94
99
  end
95
100
 
96
- def test_location_and_parse_location
97
- mock(@bucket).bucket_request(:get, {:params=>{:location=>nil}}) { @response_location }
101
+ test "location and parse location" do
102
+ @bucket.expects(:bucket_request).with(:get, { :params => { :location => nil } }).returns(@response_location)
98
103
 
99
104
  expected = @bucket_location
100
105
  actual = @bucket.location
101
106
  assert_equal expected, actual
102
107
 
103
- stub(@bucket).bucket_request(:get, {:params=>{:location=>nil}}) { flunk "should deliver from cached result" }
108
+ @bucket.stubs(:bucket_request).with(:get, { :params => { :location => nil } })
104
109
  actual = @bucket.location
105
110
  assert_equal expected, actual
106
111
  end
107
112
 
108
- def test_save
109
- mock(@bucket).bucket_request(:put, {:headers=>{}}) { }
113
+ test "save" do
114
+ @bucket.expects(:bucket_request).with(:put, { :headers => {} })
110
115
  assert @bucket.save
111
116
  # mock ensures that bucket_request was called
112
117
  end
113
118
 
114
- def test_save_failure_owned_by_you
115
- mock(@bucket).bucket_request(:put, {:headers=>{}}) { raise S3::Error::BucketAlreadyOwnedByYou.new(409, @response_owned_by_you) }
119
+ test "save failure owned by you" do
120
+ @bucket.expects(:bucket_request).with(:put, { :headers => {} }).raises(S3::Error::BucketAlreadyOwnedByYou.new(409, @response_owned_by_you))
116
121
  assert_raise S3::Error::BucketAlreadyOwnedByYou do
117
122
  @bucket.save
118
123
  end
119
124
 
120
- mock(@bucket).bucket_request(:put, {:headers=>{}}) { raise S3::Error::BucketAlreadyExists.new(409, @response_already_exists) }
125
+ @bucket.expects(:bucket_request).with(:put, { :headers => {} }).raises(S3::Error::BucketAlreadyExists.new(409, @response_already_exists))
121
126
  assert_raise S3::Error::BucketAlreadyExists do
122
127
  @bucket.save
123
128
  end
124
129
  end
125
130
 
126
- def test_objects
127
- mock(@bucket).list_bucket { @objects_list_empty }
131
+ test "objects" do
132
+ @bucket.expects(:list_bucket).returns(@objects_list_empty)
128
133
  expected = @objects_list_empty
129
134
  actual = @bucket.objects
130
135
  assert_equal expected, actual
131
136
 
132
- stub(@bucket).list_bucket { flunk "should load objects from cache" }
137
+ @bucket.stubs(:list_bucket)
133
138
  actual = @bucket.objects
134
139
  assert_equal expected, actual
135
140
 
136
- stub(@bucket).list_bucket { @objects_list }
141
+ @bucket.stubs(:list_bucket).returns(@objects_list)
137
142
 
138
143
  expected = @objects_list
139
144
  actual = @bucket.objects(true)
140
145
  assert_equal expected, actual
141
146
  end
142
147
 
143
- def test_list_bucket_and_parse_objects
144
- mock(@bucket).bucket_request(:get, :params => { :test=>true }) { @response_objects_list_empty }
148
+ test "list bucket and parse objects" do
149
+ @bucket.expects(:bucket_request).with(:get, :params => { :test=>true }).returns(@response_objects_list_empty)
145
150
  expected = @objects_list_empty
146
151
  actual = @bucket.objects.find_all(:test => true)
147
152
  assert_equal expected, actual
148
153
 
149
- mock(@bucket).bucket_request(:get, :params => { :test=>true }) { @response_objects_list }
154
+ @bucket.expects(:bucket_request).with(:get, :params => { :test => true }).returns(@response_objects_list)
150
155
  expected = @objects_list
151
156
  actual = @bucket.objects.find_all(:test => true)
152
157
  assert_equal expected, actual
153
158
  end
154
159
 
155
- def test_destroy
156
- mock(@bucket).bucket_request(:delete) { }
160
+ test "destroy" do
161
+ @bucket.expects(:bucket_request).with(:delete)
157
162
  assert @bucket.destroy
158
163
  end
159
164
 
160
- def test_objects_build
161
- stub(@bucket).bucket_request { flunk "should not connect to server" }
165
+ test "objects build" do
166
+ @bucket.stubs(:bucket_request)
162
167
 
163
168
  expected = "object_name"
164
169
  actual = @bucket.objects.build("object_name")
@@ -166,24 +171,24 @@ class BucketTest < Test::Unit::TestCase
166
171
  assert_equal expected, actual.key
167
172
  end
168
173
 
169
- def test_objects_find_first
174
+ test "objects find first" do
170
175
  assert_nothing_raised do
171
- stub.instance_of(S3::Object).retrieve { S3::Object.send(:new, nil, :key => "obj2") }
176
+ S3::Object.any_instance.stubs(:retrieve).returns(S3::Object.send(:new, nil, :key => "obj2"))
172
177
  expected = "obj2"
173
178
  actual = @bucket.objects.find_first("obj2")
174
179
  assert_equal "obj2", actual.key
175
180
  end
176
181
  end
177
182
 
178
- def test_objects_find_first_fail
183
+ test "objects find first fail" do
179
184
  assert_raise S3::Error::NoSuchKey do
180
- stub.instance_of(S3::Object).retrieve { raise S3::Error::NoSuchKey.new(404, nil) }
185
+ S3::Object.any_instance.stubs(:retrieve).raises(S3::Error::NoSuchKey.new(404, nil))
181
186
  @bucket.objects.find_first("obj3")
182
187
  end
183
188
  end
184
189
 
185
- def test_objects_find_all_on_empty_list
186
- stub(@bucket).list_bucket { @objects_list_empty }
190
+ test "objects find all on empty list" do
191
+ @bucket.stubs(:list_bucket).returns(@objects_list_empty)
187
192
  assert_nothing_raised do
188
193
  expected = @objects_list_empty
189
194
  actual = @bucket.objects.find_all
@@ -191,8 +196,8 @@ class BucketTest < Test::Unit::TestCase
191
196
  end
192
197
  end
193
198
 
194
- def test_objects_find_all
195
- stub(@bucket).list_bucket { @objects_list }
199
+ test "objects find all" do
200
+ @bucket.stubs(:list_bucket).returns(@objects_list)
196
201
  assert_nothing_raised do
197
202
  expected = @objects_list
198
203
  actual = @bucket.objects.find_all
@@ -200,13 +205,13 @@ class BucketTest < Test::Unit::TestCase
200
205
  end
201
206
  end
202
207
 
203
- def test_objects_reload
204
- stub(@bucket).list_bucket { @objects_list_empty }
208
+ test "objects reload" do
209
+ @bucket.stubs(:list_bucket).returns(@objects_list_empty)
205
210
  expected = @objects_list_empty
206
211
  actual = @bucket.objects
207
212
  assert_equal expected, actual
208
213
 
209
- stub(@bucket).list_bucket { @objects_list }
214
+ @bucket.stubs(:list_bucket).returns(@objects_list)
210
215
  expected = @objects_list_empty
211
216
  actual = @bucket.objects
212
217
  assert_equal expected, actual
@@ -218,14 +223,11 @@ class BucketTest < Test::Unit::TestCase
218
223
  assert_equal expected, actual
219
224
  end
220
225
 
221
- def test_objects_destroy_all
222
- @counter = 0
223
- stub(@bucket).list_bucket { @objects_list }
226
+ test "objects destroy all" do
227
+ @bucket.stubs(:list_bucket).returns(@objects_list)
224
228
  @bucket.objects.each do |obj|
225
- mock(obj).destroy { @counter += 1 }
229
+ obj.expects(:destroy)
226
230
  end
227
-
228
231
  @bucket.objects.destroy_all
229
- assert_equal @objects_list.length, @counter
230
232
  end
231
233
  end
@@ -9,11 +9,12 @@ class ConnectionTest < Test::Unit::TestCase
9
9
  @http_request = Net::HTTP.new("")
10
10
  @response_ok = Net::HTTPOK.new("1.1", "200", "OK")
11
11
  @response_not_found = Net::HTTPNotFound.new("1.1", "404", "Not Found")
12
- stub(@connection).http { @http_request }
13
- stub(@http_request).start { @response_ok }
12
+ @connection.stubs(:http).returns(@http_request)
13
+
14
+ @http_request.stubs(:start).returns(@response_ok)
14
15
  end
15
16
 
16
- def test_handle_response_not_modify_response_when_ok
17
+ test "handle response not modify response when ok" do
17
18
  assert_nothing_raised do
18
19
  response = @connection.request(
19
20
  :get,
@@ -24,7 +25,7 @@ class ConnectionTest < Test::Unit::TestCase
24
25
  end
25
26
  end
26
27
 
27
- def test_handle_response_throws_exception_when_not_ok
28
+ test "handle response throws exception when error" do
28
29
  response_body = <<-EOFakeBody
29
30
  <?xml version=\"1.0\" encoding=\"UTF-8\"?>
30
31
  <Error>
@@ -33,8 +34,8 @@ class ConnectionTest < Test::Unit::TestCase
33
34
  </Error>
34
35
  EOFakeBody
35
36
 
36
- stub(@http_request).start { @response_not_found }
37
- stub(@response_not_found).body { response_body }
37
+ @http_request.stubs(:start).returns(@response_not_found)
38
+ @response_not_found.stubs(:body).returns(response_body)
38
39
 
39
40
  assert_raise S3::Error::NoSuchBucket do
40
41
  response = @connection.request(
@@ -45,9 +46,9 @@ class ConnectionTest < Test::Unit::TestCase
45
46
  end
46
47
  end
47
48
 
48
- def test_handle_response_throws_standard_exception_when_not_ok
49
- stub(@http_request).start { @response_not_found }
50
- stub(@response_not_found).body { nil }
49
+ test "handle response throws standard exception when error" do
50
+ @http_request.stubs(:start).returns(@response_not_found)
51
+ @response_not_found.stubs(:body)
51
52
  assert_raise S3::Error::ResponseError do
52
53
  response = @connection.request(
53
54
  :get,
@@ -56,7 +57,7 @@ class ConnectionTest < Test::Unit::TestCase
56
57
  )
57
58
  end
58
59
 
59
- stub(@response_not_found).body { "" }
60
+ @response_not_found.stubs(:body).returns("")
60
61
  assert_raise S3::Error::ResponseError do
61
62
  response = @connection.request(
62
63
  :get,
@@ -66,37 +67,37 @@ class ConnectionTest < Test::Unit::TestCase
66
67
  end
67
68
  end
68
69
 
69
- def test_parse_params_empty
70
+ test "parse params empty" do
70
71
  expected = ""
71
72
  actual = S3::Connection.parse_params({})
72
73
  assert_equal expected, actual
73
74
  end
74
75
 
75
- def test_parse_params_only_interesting_params
76
+ test "parse params only interesting params" do
76
77
  expected = ""
77
78
  actual = S3::Connection.parse_params(:param1 => "1", :maxkeys => "2")
78
79
  assert_equal expected, actual
79
80
  end
80
81
 
81
- def test_parse_params_remove_underscore
82
+ test "parse params remove underscore" do
82
83
  expected = "max-keys=100"
83
84
  actual = S3::Connection.parse_params(:max_keys => 100)
84
85
  assert_equal expected, actual
85
86
  end
86
87
 
87
- def test_parse_params_with_and_without_values
88
+ test "parse params with and without values" do
88
89
  expected = "max-keys=100&prefix"
89
90
  actual = S3::Connection.parse_params(:max_keys => 100, :prefix => nil)
90
91
  assert_equal expected, actual
91
92
  end
92
93
 
93
- def test_headers_headers_empty
94
+ test "headers empty" do
94
95
  expected = {}
95
96
  actual = S3::Connection.parse_headers({})
96
97
  assert_equal expected, actual
97
98
  end
98
99
 
99
- def test_parse_headers_only_interesting_headers
100
+ test "parse only interesting headers" do
100
101
  expected = {}
101
102
  actual = S3::Connection.parse_headers(
102
103
  :accept => "text/*, text/html, text/html;level=1, */*",
@@ -105,7 +106,7 @@ class ConnectionTest < Test::Unit::TestCase
105
106
  assert_equal expected, actual
106
107
  end
107
108
 
108
- def test_parse_headers_remove_underscore
109
+ test "parse headers remove underscore" do
109
110
  expected = {
110
111
  "content-type" => nil,
111
112
  "x-amz-acl" => nil,
@@ -129,7 +130,7 @@ class ConnectionTest < Test::Unit::TestCase
129
130
  assert_equal expected, actual
130
131
  end
131
132
 
132
- def test_parse_headers_with_values
133
+ test "parse headers with values" do
133
134
  expected = {
134
135
  "content-type" => "text/html",
135
136
  "x-amz-acl" => "public-read",
@@ -153,7 +154,7 @@ class ConnectionTest < Test::Unit::TestCase
153
154
  assert_equal expected, actual
154
155
  end
155
156
 
156
- def test_parse_headers_with_range
157
+ test "parse headers with range" do
157
158
  expected = {
158
159
  "range" => "bytes=0-100"
159
160
  }