cloudfiles 1.4.10 → 1.4.11

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.
@@ -4,7 +4,7 @@ require 'test_helper'
4
4
  class CloudfilesContainerTest < Test::Unit::TestCase
5
5
 
6
6
  def test_object_creation
7
- connection = mock(:storagehost => 'test.storage.example', :storagepath => '/dummy/path', :storageport => 443, :storagescheme => 'https', :cdnmgmthost => 'cdm.test.example', :cdnmgmtpath => '/dummy/path', :cdnmgmtport => 443, :cdnmgmtscheme => 'https')
7
+ connection = stub(:storagehost => 'test.storage.example', :storagepath => '/dummy/path', :storageport => 443, :storagescheme => 'https', :cdnmgmthost => 'cdm.test.example', :cdnmgmtpath => '/dummy/path', :cdnmgmtport => 443, :cdnmgmtscheme => 'https')
8
8
  response = {'x-container-bytes-used' => '42', 'x-container-object-count' => '5'}
9
9
  response.stubs(:code).returns('204')
10
10
  connection.stubs(:cfreq => response)
@@ -12,22 +12,22 @@ class CloudfilesContainerTest < Test::Unit::TestCase
12
12
  assert_equal @container.name, 'test_container'
13
13
  assert_equal @container.class, CloudFiles::Container
14
14
  assert_equal @container.public?, false
15
- assert_equal @container.cdn_url, false
16
- assert_equal @container.cdn_ttl, false
15
+ assert_equal @container.cdn_url, nil
16
+ assert_equal @container.cdn_ttl, nil
17
17
  end
18
18
 
19
19
  def test_object_creation_no_such_container
20
- connection = mock(:storagehost => 'test.storage.example', :storagepath => '/dummy/path', :storageport => 443, :storagescheme => 'https', :cdnmgmthost => 'cdm.test.example', :cdnmgmtpath => '/dummy/path', :cdnmgmtport => 443, :cdnmgmtscheme => 'https')
20
+ connection = stub(:storagehost => 'test.storage.example', :storagepath => '/dummy/path', :storageport => 443, :storagescheme => 'https', :cdnmgmthost => 'cdm.test.example', :cdnmgmtpath => '/dummy/path', :cdnmgmtport => 443, :cdnmgmtscheme => 'https')
21
21
  response = {'x-container-bytes-used' => '42', 'x-container-object-count' => '5'}
22
22
  response.stubs(:code).returns('999')
23
23
  connection.stubs(:cfreq => response)
24
- assert_raise(NoSuchContainerException) do
24
+ assert_raise(CloudFiles::Exception::NoSuchContainer) do
25
25
  @container = CloudFiles::Container.new(connection, 'test_container')
26
26
  end
27
27
  end
28
28
 
29
29
  def test_object_creation_with_cdn
30
- connection = mock(:storagehost => 'test.storage.example', :storagepath => '/dummy/path', :storageport => 443, :storagescheme => 'https', :cdnmgmthost => 'cdm.test.example', :cdnmgmtpath => '/dummy/path', :cdnmgmtport => 443, :cdnmgmtscheme => 'https')
30
+ connection = stub(:storagehost => 'test.storage.example', :storagepath => '/dummy/path', :storageport => 443, :storagescheme => 'https', :cdnmgmthost => 'cdm.test.example', :cdnmgmtpath => '/dummy/path', :cdnmgmtport => 443, :cdnmgmtscheme => 'https')
31
31
  response = {'x-container-bytes-used' => '42', 'x-container-object-count' => '5', 'x-cdn-enabled' => 'True', 'x-cdn-uri' => 'http://cdn.test.example/container', 'x-ttl' => '86400'}
32
32
  response.stubs(:code).returns('204')
33
33
  connection.stubs(:cfreq => response)
@@ -53,7 +53,7 @@ class CloudfilesContainerTest < Test::Unit::TestCase
53
53
 
54
54
  def test_make_private_fails
55
55
  build_net_http_object(:code => '999')
56
- assert_raises(NoSuchContainerException) do
56
+ assert_raises(CloudFiles::Exception::NoSuchContainer) do
57
57
  @container.make_private
58
58
  end
59
59
  end
@@ -67,13 +67,13 @@ class CloudfilesContainerTest < Test::Unit::TestCase
67
67
 
68
68
  def test_make_public_fails
69
69
  build_net_http_object(:code => '999')
70
- assert_raises(NoSuchContainerException) do
70
+ assert_raises(CloudFiles::Exception::NoSuchContainer) do
71
71
  @container.make_public
72
72
  end
73
73
  end
74
74
 
75
75
  def test_empty_is_false
76
- connection = mock(:storagehost => 'test.storage.example', :storagepath => '/dummy/path', :storageport => 443, :storagescheme => 'https', :cdnmgmthost => 'cdm.test.example', :cdnmgmtpath => '/dummy/path', :cdnmgmtport => 443, :cdnmgmtscheme => 'https')
76
+ connection = stub(:storagehost => 'test.storage.example', :storagepath => '/dummy/path', :storageport => 443, :storagescheme => 'https', :cdnmgmthost => 'cdm.test.example', :cdnmgmtpath => '/dummy/path', :cdnmgmtport => 443, :cdnmgmtscheme => 'https')
77
77
  response = {'x-container-bytes-used' => '42', 'x-container-object-count' => '5'}
78
78
  response.stubs(:code).returns('204')
79
79
  connection.stubs(:cfreq => response)
@@ -82,7 +82,7 @@ class CloudfilesContainerTest < Test::Unit::TestCase
82
82
  end
83
83
 
84
84
  def test_empty_is_true
85
- connection = mock(:storagehost => 'test.storage.example', :storagepath => '/dummy/path', :storageport => 443, :storagescheme => 'https', :cdnmgmthost => 'cdm.test.example', :cdnmgmtpath => '/dummy/path', :cdnmgmtport => 443, :cdnmgmtscheme => 'https')
85
+ connection = stub(:storagehost => 'test.storage.example', :storagepath => '/dummy/path', :storageport => 443, :storagescheme => 'https', :cdnmgmthost => 'cdm.test.example', :cdnmgmtpath => '/dummy/path', :cdnmgmtport => 443, :cdnmgmtscheme => 'https')
86
86
  response = {'x-container-bytes-used' => '0', 'x-container-object-count' => '0'}
87
87
  response.stubs(:code).returns('204')
88
88
  connection.stubs(:cfreq => response)
@@ -91,7 +91,7 @@ class CloudfilesContainerTest < Test::Unit::TestCase
91
91
  end
92
92
 
93
93
  def test_log_retention_is_true
94
- connection = mock(:storagehost => 'test.storage.example', :storagepath => '/dummy/path', :storageport => 443, :storagescheme => 'https', :cdnmgmthost => 'cdm.test.example', :cdnmgmtpath => '/dummy/path', :cdnmgmtport => 443, :cdnmgmtscheme => 'https')
94
+ connection = stub(:storagehost => 'test.storage.example', :storagepath => '/dummy/path', :storageport => 443, :storagescheme => 'https', :cdnmgmthost => 'cdm.test.example', :cdnmgmtpath => '/dummy/path', :cdnmgmtport => 443, :cdnmgmtscheme => 'https')
95
95
  response = {'x-container-bytes-used' => '0', 'x-container-object-count' => '0', 'x-cdn-enabled' => 'True', 'x-log-retention' => 'True'}
96
96
  response.stubs(:code).returns('204')
97
97
  connection.stubs(:cfreq => response)
@@ -130,14 +130,14 @@ class CloudfilesContainerTest < Test::Unit::TestCase
130
130
 
131
131
  def test_delete_invalid_object_fails
132
132
  build_net_http_object(:code => '404')
133
- assert_raise(NoSuchObjectException) do
133
+ assert_raise(CloudFiles::Exception::NoSuchObject) do
134
134
  @container.delete_object('nonexistent_object')
135
135
  end
136
136
  end
137
137
 
138
138
  def test_delete_invalid_response_code_fails
139
139
  build_net_http_object(:code => '999')
140
- assert_raise(InvalidResponseException) do
140
+ assert_raise(CloudFiles::Exception::InvalidResponse) do
141
141
  @container.delete_object('broken_object')
142
142
  end
143
143
  end
@@ -230,7 +230,7 @@ class CloudfilesContainerTest < Test::Unit::TestCase
230
230
 
231
231
  def test_fetch_object_detail_error
232
232
  build_net_http_object(:code => '999')
233
- assert_raise(InvalidResponseException) do
233
+ assert_raise(CloudFiles::Exception::InvalidResponse) do
234
234
  details = @container.objects_detail
235
235
  end
236
236
  end
@@ -244,6 +244,7 @@ class CloudfilesContainerTest < Test::Unit::TestCase
244
244
 
245
245
  def build_net_http_object(args={:code => '204' }, cfreq_expectations={})
246
246
  CloudFiles::Container.any_instance.stubs(:populate).returns(true)
247
+ CloudFiles::Container.any_instance.stubs(:metadata).returns({})
247
248
  connection = stub(:storagehost => 'test.storage.example', :storagepath => '/dummy/path', :storageport => 443, :storagescheme => 'https', :cdnmgmthost => 'cdm.test.example', :cdnmgmtpath => '/dummy/path', :cdnmgmtport => 443, :cdnmgmtscheme => 'https')
248
249
  args[:response] = {} unless args[:response]
249
250
  response = {'x-cdn-management-url' => 'http://cdn.example.com/path', 'x-storage-url' => 'http://cdn.example.com/storage', 'authtoken' => 'dummy_token', 'last-modified' => Time.now.to_s}.merge(args[:response])
@@ -21,7 +21,7 @@ class CloudfilesStorageObjectTest < Test::Unit::TestCase
21
21
  response.stubs(:code).returns('204')
22
22
  connection.stubs(:cfreq => response)
23
23
  container = CloudFiles::Container.new(connection, 'test_container')
24
- assert_raises SyntaxException do
24
+ assert_raises CloudFiles::Exception::Syntax do
25
25
  @object = CloudFiles::StorageObject.new(container, 'test_object?')
26
26
  end
27
27
  end
@@ -49,7 +49,7 @@ class CloudfilesStorageObjectTest < Test::Unit::TestCase
49
49
 
50
50
  def test_data_fails
51
51
  build_net_http_object(:code => '999', :body => 'This is bad data')
52
- assert_raise(NoSuchObjectException) do
52
+ assert_raise(CloudFiles::Exception::NoSuchObject) do
53
53
  @object.data
54
54
  end
55
55
  end
@@ -78,7 +78,7 @@ class CloudfilesStorageObjectTest < Test::Unit::TestCase
78
78
  def data_stream_fails
79
79
  build_net_http_object(:code => '999', :body => 'This is bad data')
80
80
  data = ""
81
- assert_raise(NoSuchObjectException) do
81
+ assert_raise(CloudFiles::Exception::NoSuchObject) do
82
82
  @object.data_stream { |chunk|
83
83
  data += chunk
84
84
  }
@@ -95,14 +95,14 @@ class CloudfilesStorageObjectTest < Test::Unit::TestCase
95
95
 
96
96
  def test_set_metadata_invalid_object
97
97
  build_net_http_object(:code => '404')
98
- assert_raise(NoSuchObjectException) do
98
+ assert_raise(CloudFiles::Exception::NoSuchObject) do
99
99
  @object.set_metadata({'Foo' =>'bar'})
100
100
  end
101
101
  end
102
102
 
103
103
  def test_set_metadata_fails
104
104
  build_net_http_object(:code => '999')
105
- assert_raise(InvalidResponseException) do
105
+ assert_raise(CloudFiles::Exception::InvalidResponse) do
106
106
  @object.set_metadata({'Foo' =>'bar'})
107
107
  end
108
108
  end
@@ -163,28 +163,28 @@ class CloudfilesStorageObjectTest < Test::Unit::TestCase
163
163
 
164
164
  def test_write_with_no_data_dies
165
165
  build_net_http_object
166
- assert_raise(SyntaxException) do
166
+ assert_raise(CloudFiles::Exception::Syntax) do
167
167
  @object.write
168
168
  end
169
169
  end
170
170
 
171
171
  def test_write_with_invalid_content_length_dies
172
172
  build_net_http_object(:code => '412')
173
- assert_raise(InvalidResponseException) do
173
+ assert_raise(CloudFiles::Exception::InvalidResponse) do
174
174
  @object.write('Test Data')
175
175
  end
176
176
  end
177
177
 
178
178
  def test_write_with_mismatched_md5_dies
179
179
  build_net_http_object(:code => '422')
180
- assert_raise(MisMatchedChecksumException) do
180
+ assert_raise(CloudFiles::Exception::MisMatchedChecksum) do
181
181
  @object.write('Test Data')
182
182
  end
183
183
  end
184
184
 
185
185
  def test_write_with_invalid_response_dies
186
186
  build_net_http_object(:code => '999')
187
- assert_raise(InvalidResponseException) do
187
+ assert_raise(CloudFiles::Exception::InvalidResponse) do
188
188
  @object.write('Test Data')
189
189
  end
190
190
  end
@@ -192,6 +192,7 @@ class CloudfilesStorageObjectTest < Test::Unit::TestCase
192
192
  private
193
193
 
194
194
  def build_net_http_object(args={:code => '204' })
195
+ CloudFiles::Container.any_instance.stubs(:metadata).returns({})
195
196
  CloudFiles::Container.any_instance.stubs(:populate).returns(true)
196
197
  connection = stub(:storagehost => 'test.storage.example', :storagepath => '/dummy/path', :storageport => 443, :storagescheme => 'https', :cdnmgmthost => 'cdm.test.example', :cdnmgmtpath => '/dummy/path', :cdnmgmtport => 443, :cdnmgmtscheme => 'https')
197
198
  args[:response] = {} unless args[:response]
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloudfiles
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
5
- prerelease: false
4
+ hash: 17
5
+ prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 4
9
- - 10
10
- version: 1.4.10
9
+ - 11
10
+ version: 1.4.11
11
11
  platform: ruby
12
12
  authors:
13
13
  - H. Wade Minter
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2010-11-19 00:00:00 -05:00
19
+ date: 2011-02-05 00:00:00 -05:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
@@ -61,8 +61,9 @@ extra_rdoc_files:
61
61
  - TODO
62
62
  files:
63
63
  - .gitignore
64
+ - CHANGELOG
65
+ - CONTRIBUTORS
64
66
  - COPYING
65
- - Manifest
66
67
  - README.rdoc
67
68
  - Rakefile
68
69
  - TODO
@@ -72,6 +73,7 @@ files:
72
73
  - lib/cloudfiles/authentication.rb
73
74
  - lib/cloudfiles/connection.rb
74
75
  - lib/cloudfiles/container.rb
76
+ - lib/cloudfiles/exception.rb
75
77
  - lib/cloudfiles/storage_object.rb
76
78
  - test/cf-testunit.rb
77
79
  - test/cloudfiles_authentication_test.rb
@@ -109,7 +111,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
109
111
  requirements: []
110
112
 
111
113
  rubyforge_project:
112
- rubygems_version: 1.3.7
114
+ rubygems_version: 1.5.0
113
115
  signing_key:
114
116
  specification_version: 3
115
117
  summary: A Ruby API into Rackspace Cloud Files
data/Manifest DELETED
@@ -1,16 +0,0 @@
1
- cloudfiles.gemspec
2
- lib/cloudfiles/authentication.rb
3
- lib/cloudfiles/connection.rb
4
- lib/cloudfiles/container.rb
5
- lib/cloudfiles/storage_object.rb
6
- lib/cloudfiles.rb
7
- Manifest
8
- Rakefile
9
- README.rdoc
10
- test/cf-testunit.rb
11
- test/cloudfiles_authentication_test.rb
12
- test/cloudfiles_connection_test.rb
13
- test/cloudfiles_container_test.rb
14
- test/cloudfiles_storage_object_test.rb
15
- test/test_helper.rb
16
- TODO