rapidshare-ext 0.0.6 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,30 +1,53 @@
1
- # encoding: utf-8
2
1
  require 'digest/md5'
3
- require File.expand_path(File.dirname(__FILE__) + "/../test_helper")
2
+ require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
4
3
 
5
4
  class RapidshareExtTest < Test::Unit::TestCase
6
5
 
7
6
  def setup
8
7
  FakeWeb.allow_net_connect = true
9
8
  @rs = Rapidshare::API.new :cookie => ENV['RAPIDSHARE_COOKIE']
9
+
10
+ account = @rs.get_account_details
11
+
12
+ # Check the account is the actually we wanted, because it will be erased in the next step
13
+ assert_equal ENV['RAPIDSHARE_USERNAME'], account[:username]
14
+ assert_equal ENV['RAPIDSHARE_EMAIL'], account[:email]
15
+ assert_equal ENV['RAPIDSHARE_ACCOUNT_ID'], account[:accountid]
16
+
10
17
  @rs.erase_all_data!
11
18
 
12
- @download_dir = File.expand_path(File.dirname(__FILE__) + "/../../tmp")
13
- File.delete "#@download_dir/file1.txt" if File.exist? "#@download_dir/file1.txt"
14
- File.delete "#@download_dir/file2.txt" if File.exist? "#@download_dir/file2.txt"
15
- File.delete "#@download_dir/upload_file_1.txt" if File.exist? "#@download_dir/upload_file_1.txt"
19
+ @download_dir = File.expand_path(File.dirname(__FILE__) + '/../../tmp')
20
+ %w{file1.txt file2.txt file3.txt upload_file_1.txt}.each do |filename|
21
+ File.delete "#@download_dir/#{filename}" if File.exist? "#@download_dir/#{filename}"
22
+ end
16
23
 
17
- @upload_file_1 = File.expand_path(File.dirname(__FILE__) + "/../fixtures/files/upload1.txt")
24
+ @upload_file_1 = File.expand_path(File.dirname(__FILE__) + '/../fixtures/files/upload1.txt')
18
25
  @upload_file_1_md5 = Digest::MD5.hexdigest(File.read(@upload_file_1))
19
26
  @upload_file_1_size = File.size @upload_file_1
20
27
 
21
- @upload_file_2 = File.expand_path(File.dirname(__FILE__) + "/../fixtures/files/upload2.txt")
28
+ @upload_file_2 = File.expand_path(File.dirname(__FILE__) + '/../fixtures/files/upload2.txt')
22
29
  @upload_file_2_md5 = Digest::MD5.hexdigest(File.read(@upload_file_2))
23
30
  @upload_file_2_size = File.size @upload_file_2
31
+
32
+ @upload_file_3 = File.expand_path(File.dirname(__FILE__) + '/../fixtures/files/upload3.txt')
33
+ @upload_file_3_md5 = Digest::MD5.hexdigest(File.read(@upload_file_3))
34
+ @upload_file_3_size = 102598 # 100 Kb
24
35
  end
25
36
 
26
- context "Api" do
27
- should "upload file" do
37
+ context 'Api' do
38
+
39
+ should 'initialize by login and password' do
40
+ rs = Rapidshare::API.new :login => ENV['RAPIDSHARE_USERNAME'],
41
+ :password => ENV['RAPIDSHARE_PASSWORD']
42
+ assert_equal ENV['RAPIDSHARE_COOKIE'], rs.cookie
43
+
44
+ account = rs.get_account_details
45
+ assert_equal ENV['RAPIDSHARE_USERNAME'], account[:username]
46
+ assert_equal ENV['RAPIDSHARE_EMAIL'], account[:email]
47
+ assert_equal ENV['RAPIDSHARE_ACCOUNT_ID'], account[:accountid]
48
+ end
49
+
50
+ should 'upload file' do
28
51
  upload_assertion = ->(resp, size_local, digest_local, remote_filename) do
29
52
  assert_instance_of Hash, resp
30
53
  assert_kind_of Integer, resp[:id]
@@ -37,8 +60,8 @@ class RapidshareExtTest < Test::Unit::TestCase
37
60
  assert_equal "https://rapidshare.com/files/#{resp[:id]}/#{URI::encode(remote_filename)}", resp[:url]
38
61
  end
39
62
 
40
- remote_filename = "upload_file_1.txt"
41
- remote_dir = "a/b/c"
63
+ remote_filename = 'upload_file_1.txt'
64
+ remote_dir = 'a/b/c'
42
65
  remote_path = "#{remote_dir}/#{remote_filename}"
43
66
 
44
67
  # Initial upload
@@ -75,140 +98,198 @@ class RapidshareExtTest < Test::Unit::TestCase
75
98
  upload_assertion.call response, @upload_file_2_size, @upload_file_2_md5, remote_filename
76
99
  end
77
100
 
78
- should "download file" do
79
- @rs.upload @upload_file_1, :to => "/a/b/c", :as => "upload_file_1.txt"
80
- assert_not_nil @rs.file_info("/a/b/c/upload_file_1.txt")
101
+ should 'download file' do
102
+ # Download file with denied access
103
+ instance = @rs.download 'https://rapidshare.com/files/829628035/HornyRhinos.jpg', :downloads_dir => @download_dir
104
+ assert_equal 'Access denied', instance.error
105
+
106
+ # Download invalid file
107
+ instance = @rs.download 'https://rapidshare.com/files/000000000/NonExistingFile.zip', :downloads_dir => @download_dir
108
+ assert_equal 'File not found', instance.error
81
109
 
82
- @rs.download "/a/b/c/upload_file_1.txt", :downloads_dir => @download_dir, :save_as => "file1.txt"
110
+ @rs.upload @upload_file_1, :to => '/a/b/c', :as => 'upload_file_1.txt'
111
+ assert_not_nil @rs.file_info('/a/b/c/upload_file_1.txt')
112
+
113
+ res = @rs.download '/a/b/c/upload_file_1.txt', :downloads_dir => @download_dir, :save_as => 'file1.txt'
114
+ assert_true res.downloaded?
115
+ assert_nil res.error
83
116
  assert_path_exist "#@download_dir/file1.txt"
84
117
  assert_equal @upload_file_1_size, File.size("#@download_dir/file1.txt")
85
118
  assert_equal @upload_file_1_md5, Digest::MD5.hexdigest(File.read("#@download_dir/file1.txt"))
86
119
 
87
120
  # Download with default :save_as
88
- @rs.download "/a/b/c/upload_file_1.txt", :downloads_dir => @download_dir
121
+ res = @rs.download '/a/b/c/upload_file_1.txt', :downloads_dir => @download_dir
122
+ assert_true res.downloaded?
123
+ assert_nil res.error
89
124
  assert_path_exist "#@download_dir/upload_file_1.txt"
90
125
  assert_equal @upload_file_1_size, File.size("#@download_dir/upload_file_1.txt")
91
126
  assert_equal @upload_file_1_md5, Digest::MD5.hexdigest(File.read("#@download_dir/upload_file_1.txt"))
92
127
 
93
128
  # Download by http url
94
- download_url = @rs.file_info("/a/b/c/upload_file_1.txt")[:url]
95
- @rs.download download_url, :downloads_dir => @download_dir, :save_as => "file2.txt"
129
+ download_url = @rs.file_info('/a/b/c/upload_file_1.txt')[:url]
130
+ res = @rs.download download_url, :downloads_dir => @download_dir, :save_as => 'file2.txt'
131
+ assert_true res.downloaded?
132
+ assert_nil res.error
96
133
  assert_path_exist "#@download_dir/file2.txt"
97
134
  assert_equal @upload_file_1_size, File.size("#@download_dir/file2.txt")
98
135
  assert_equal @upload_file_1_md5, Digest::MD5.hexdigest(File.read("#@download_dir/file2.txt"))
136
+
137
+ @rs.upload @upload_file_3, :to => '/a/b/c', :as => 'upload_3.txt'
138
+ assert_not_nil @rs.file_info('/a/b/c/upload_3.txt')
139
+
140
+ # Download file with a flow control
141
+ file = '/a/b/c/upload_3.txt'
142
+ https_url = @rs.file_info(file)[:url]
143
+ expected_metrics = [
144
+ [0, 0, @upload_file_3_size, 0],
145
+ [16384, 16384, @upload_file_3_size, 15.97],
146
+ [16384, 32768, @upload_file_3_size, 31.94],
147
+ [16384, 49152, @upload_file_3_size, 47.91],
148
+ [16384, 65536, @upload_file_3_size, 63.88],
149
+ [16384, 81920, @upload_file_3_size, 79.85],
150
+ [16384, 98304, @upload_file_3_size, 95.81],
151
+ [4294, 102598, @upload_file_3_size, 100.00],
152
+ ]
153
+
154
+ # Download through HTTPS
155
+ metrics = []
156
+ res = @rs.download https_url, :downloads_dir => @download_dir, :save_as => 'file3.txt' \
157
+ do |chunk_size, downloaded, total, progress|
158
+ metrics << [chunk_size, downloaded, total, progress]
159
+ end
160
+
161
+ assert_equal expected_metrics, metrics
162
+ assert_true res.downloaded?
163
+ assert_nil res.error
164
+ assert_equal @upload_file_3_size, File.size("#@download_dir/file3.txt")
165
+ assert_equal @upload_file_3_md5, Digest::MD5.hexdigest(File.read("#@download_dir/file3.txt"))
166
+
167
+ # Download through HTTP
168
+ metrics = []
169
+ http_url = https_url.gsub /^https/, 'http'
170
+ res = @rs.download http_url, :downloads_dir => @download_dir, :save_as => 'file3.txt' \
171
+ do |chunk_size, downloaded, total, progress|
172
+ metrics << [chunk_size, downloaded, total, progress]
173
+ end
174
+
175
+ assert_equal expected_metrics, metrics
176
+ assert_true res.downloaded?
177
+ assert_nil res.error
178
+ assert_equal @upload_file_3_size, File.size("#@download_dir/file3.txt")
179
+ assert_equal @upload_file_3_md5, Digest::MD5.hexdigest(File.read("#@download_dir/file3.txt"))
99
180
  end
100
181
 
101
- should "rename file" do
102
- @rs.upload @upload_file_1, :to => "/a/b/c", :as => "upload_file_1.txt"
103
- assert_not_nil @rs.file_info("/a/b/c/upload_file_1.txt")
182
+ should 'rename file' do
183
+ @rs.upload @upload_file_1, :to => '/a/b/c', :as => 'upload_file_1.txt'
184
+ assert_not_nil @rs.file_info('/a/b/c/upload_file_1.txt')
104
185
 
105
- @rs.rename_file "/a/b/c/upload_file_1.txt", "file_2.txt"
106
- info = @rs.file_info "/a/b/c/file_2.txt"
186
+ @rs.rename_file '/a/b/c/upload_file_1.txt', 'file_2.txt'
187
+ info = @rs.file_info '/a/b/c/file_2.txt'
107
188
 
108
189
  assert_not_nil info
109
- assert_equal info[:filename], "file_2.txt"
110
- assert_equal info[:realfolder].to_i, @rs.folder_id("/a/b/c")
190
+ assert_equal info[:filename], 'file_2.txt'
191
+ assert_equal info[:realfolder].to_i, @rs.folder_id('/a/b/c')
111
192
  assert_equal info[:size].to_i, @upload_file_1_size
112
193
  assert_equal info[:md5hex].downcase, @upload_file_1_md5
113
194
  end
114
195
 
115
- should "move file" do
116
- @rs.upload @upload_file_1, :to => "/a/b/c", :as => "upload_file_1.txt"
117
- assert_not_nil @rs.file_info("/a/b/c/upload_file_1.txt")
196
+ should 'move file' do
197
+ @rs.upload @upload_file_1, :to => '/a/b/c', :as => 'upload_file_1.txt'
198
+ assert_not_nil @rs.file_info('/a/b/c/upload_file_1.txt')
118
199
 
119
- @rs.move_file "/a/b/c/upload_file_1.txt", :to => "/a/b"
120
- assert_nil @rs.file_info("/a/b/c/upload_file_1.txt")
200
+ @rs.move_file '/a/b/c/upload_file_1.txt', :to => '/a/b'
201
+ assert_nil @rs.file_info('/a/b/c/upload_file_1.txt')
121
202
 
122
- info = @rs.file_info "/a/b/upload_file_1.txt"
203
+ info = @rs.file_info '/a/b/upload_file_1.txt'
123
204
  assert_not_nil info
124
- assert_equal info[:filename], "upload_file_1.txt"
125
- assert_equal info[:realfolder].to_i, @rs.folder_id("/a/b")
205
+ assert_equal info[:filename], 'upload_file_1.txt'
206
+ assert_equal info[:realfolder].to_i, @rs.folder_id('/a/b')
126
207
  assert_equal info[:size].to_i, @upload_file_1_size
127
208
  assert_equal info[:md5hex].downcase, @upload_file_1_md5
128
209
  end
129
210
 
130
- should "delete file" do
131
- @rs.upload @upload_file_1, :to => "/a/b/c", :as => "upload_file_1.txt"
132
- assert_not_nil @rs.file_info("/a/b/c/upload_file_1.txt")
211
+ should 'delete file' do
212
+ @rs.upload @upload_file_1, :to => '/a/b/c', :as => 'upload_file_1.txt'
213
+ assert_not_nil @rs.file_info('/a/b/c/upload_file_1.txt')
133
214
 
134
- @rs.remove_file "/a/b/c/upload_file_1.txt"
135
- assert_nil @rs.file_info("/a/b/c/upload_file_1.txt")
215
+ @rs.remove_file '/a/b/c/upload_file_1.txt'
216
+ assert_nil @rs.file_info('/a/b/c/upload_file_1.txt')
136
217
  end
137
218
 
138
- should "folder id <=> path conversions" do
139
- @rs.add_folder "/a/b/c"
140
- id = @rs.folder_id("/a/b/c")
141
- assert_equal "/a/b/c", @rs.folder_path(id)
219
+ should 'folder id <=> path conversions' do
220
+ @rs.add_folder '/a/b/c'
221
+ id = @rs.folder_id('/a/b/c')
222
+ assert_equal '/a/b/c', @rs.folder_path(id)
142
223
  end
143
224
 
144
- should "create folder" do
145
- folder_id = @rs.add_folder "a/b/c"
225
+ should 'create folder' do
226
+ folder_id = @rs.add_folder 'a/b/c'
146
227
  assert_kind_of Integer, folder_id
147
228
  assert_not_equal 0, folder_id
148
229
  tree = @rs.folders_hierarchy
149
230
 
150
231
  assert_equal 3, tree.count
151
- assert_equal "/a/b/c", tree[folder_id][:path]
152
- assert_equal "/a/b", tree[tree[folder_id][:parent]][:path]
153
- assert_equal "/a", tree[tree[tree[folder_id][:parent]][:parent]][:path]
232
+ assert_equal '/a/b/c', tree[folder_id][:path]
233
+ assert_equal '/a/b', tree[tree[folder_id][:parent]][:path]
234
+ assert_equal '/a', tree[tree[tree[folder_id][:parent]][:parent]][:path]
154
235
  end
155
236
 
156
- should "move folder" do
157
- folder_id = @rs.add_folder "/a/b/c"
237
+ should 'move folder' do
238
+ folder_id = @rs.add_folder '/a/b/c'
158
239
  assert_kind_of Integer, folder_id
159
240
  assert_not_equal 0, folder_id
160
241
  tree = @rs.folders_hierarchy
161
242
 
162
243
  assert_equal 3, tree.count
163
- assert_equal "/a/b/c", tree[folder_id][:path]
164
- assert_equal "/a/b", tree[tree[folder_id][:parent]][:path]
165
- assert_equal "/a", tree[tree[tree[folder_id][:parent]][:parent]][:path]
244
+ assert_equal '/a/b/c', tree[folder_id][:path]
245
+ assert_equal '/a/b', tree[tree[folder_id][:parent]][:path]
246
+ assert_equal '/a', tree[tree[tree[folder_id][:parent]][:parent]][:path]
166
247
 
167
- @rs.move_folder "/a/b/c", :to => 'a'
248
+ @rs.move_folder '/a/b/c', :to => 'a'
168
249
 
169
250
  tree = @rs.reload!
170
251
 
171
252
  assert_equal 3, tree.count
172
- assert_equal "/a/c", tree[folder_id][:path]
173
- assert_equal @rs.folder_id("/a"), tree[folder_id][:parent]
253
+ assert_equal '/a/c', tree[folder_id][:path]
254
+ assert_equal @rs.folder_id('/a'), tree[folder_id][:parent]
174
255
  end
175
256
 
176
- should "remove folder" do
177
- folder_id = @rs.add_folder "a/b/c"
257
+ should 'remove folder' do
258
+ folder_id = @rs.add_folder 'a/b/c'
178
259
  assert_kind_of Integer, folder_id
179
260
  assert_not_equal 0, folder_id
180
261
  tree = @rs.folders_hierarchy
181
262
  assert_equal 3, tree.count
182
263
 
183
- @rs.remove_folder "/a/b/c"
264
+ @rs.remove_folder '/a/b/c'
184
265
 
185
266
  tree = @rs.folders_hierarchy!
186
267
  assert_equal 2, tree.count
187
268
 
188
269
 
189
- folder_id = @rs.add_folder "/a/b/c"
270
+ folder_id = @rs.add_folder '/a/b/c'
190
271
  assert_kind_of Integer, folder_id
191
272
  assert_not_equal 0, folder_id
192
273
  tree = @rs.folders_hierarchy!
193
274
  assert_equal 3, tree.count
194
275
 
195
- @rs.remove_folder "/a"
276
+ @rs.remove_folder '/a'
196
277
  tree = @rs.folders_hierarchy!
197
278
  assert_equal 0, tree.count
198
279
  end
199
280
 
200
281
 
201
- should "build folders tree" do
282
+ should 'build folders tree' do
202
283
  # Create folders
203
- folder_a_id = @rs.add_folder "/a"
284
+ folder_a_id = @rs.add_folder '/a'
204
285
  assert_kind_of Integer, folder_a_id
205
286
  assert_not_equal 0, folder_a_id
206
287
 
207
- folder_b_id = @rs.add_folder "/a/b"
288
+ folder_b_id = @rs.add_folder '/a/b'
208
289
  assert_kind_of Integer, folder_b_id
209
290
  assert_not_equal 0, folder_b_id
210
291
 
211
- folder_c_id = @rs.add_folder "/a/b/c"
292
+ folder_c_id = @rs.add_folder '/a/b/c'
212
293
  assert_kind_of Integer, folder_c_id
213
294
  assert_not_equal 0, folder_c_id
214
295
 
@@ -217,28 +298,28 @@ class RapidshareExtTest < Test::Unit::TestCase
217
298
  # Validate tree
218
299
  assert_equal 3, tree.count
219
300
 
220
- assert_equal "a", tree[folder_a_id][:name]
221
- assert_equal "/a", tree[folder_a_id][:path]
301
+ assert_equal 'a', tree[folder_a_id][:name]
302
+ assert_equal '/a', tree[folder_a_id][:path]
222
303
  assert_equal 0, tree[folder_a_id][:parent]
223
304
 
224
- assert_equal "b", tree[folder_b_id][:name]
225
- assert_equal "/a/b", tree[folder_b_id][:path]
305
+ assert_equal 'b', tree[folder_b_id][:name]
306
+ assert_equal '/a/b', tree[folder_b_id][:path]
226
307
  assert_equal folder_a_id, tree[folder_b_id][:parent]
227
308
 
228
- assert_equal "c", tree[folder_c_id][:name]
229
- assert_equal "/a/b/c", tree[folder_c_id][:path]
309
+ assert_equal 'c', tree[folder_c_id][:name]
310
+ assert_equal '/a/b/c', tree[folder_c_id][:path]
230
311
  assert_equal folder_b_id, tree[folder_c_id][:parent]
231
312
 
232
313
  # Validate subtree
233
314
  sub_tree = @rs.folders_hierarchy :from => '/a/b'
234
315
  assert_equal 1, sub_tree.count
235
- assert_equal "/c", sub_tree[folder_c_id][:path]
236
- assert_equal "c", sub_tree[folder_c_id][:name]
316
+ assert_equal '/c', sub_tree[folder_c_id][:path]
317
+ assert_equal 'c', sub_tree[folder_c_id][:name]
237
318
  assert_equal folder_b_id, sub_tree[folder_c_id][:parent]
238
319
  end
239
320
 
240
- should "erase all account data" do
241
- folder_id = @rs.add_folder "/a/b/c"
321
+ should 'erase all account data' do
322
+ folder_id = @rs.add_folder '/a/b/c'
242
323
  assert_kind_of Integer, folder_id
243
324
 
244
325
  folder_ids = @rs.folders_hierarchy.keys
@@ -251,17 +332,17 @@ class RapidshareExtTest < Test::Unit::TestCase
251
332
  assert_equal 0, folder_ids.count
252
333
  end
253
334
 
254
- should "move orphans" do
335
+ should 'move orphans' do
255
336
  # Create folders
256
- folder_a_id = @rs.add_folder "/a"
337
+ folder_a_id = @rs.add_folder '/a'
257
338
  assert_kind_of Integer, folder_a_id
258
339
  assert_not_equal 0, folder_a_id
259
340
 
260
- folder_b_id = @rs.add_folder "/a/b"
341
+ folder_b_id = @rs.add_folder '/a/b'
261
342
  assert_kind_of Integer, folder_b_id
262
343
  assert_not_equal 0, folder_b_id
263
344
 
264
- folder_c_id = @rs.add_folder "/a/b/c"
345
+ folder_c_id = @rs.add_folder '/a/b/c'
265
346
  assert_kind_of Integer, folder_c_id
266
347
  assert_not_equal 0, folder_c_id
267
348
 
@@ -275,7 +356,7 @@ class RapidshareExtTest < Test::Unit::TestCase
275
356
  assert_false @rs.orphan? folder_b_id
276
357
  assert_false @rs.orphan? folder_c_id
277
358
 
278
- # Delete just folder "/a" to accomplish tree inconsistency
359
+ # Delete just folder '/a' to accomplish tree inconsistency
279
360
  @rs.delrealfolder :realfolder => folder_a_id
280
361
  @rs.reload! :validate => false
281
362
 
@@ -290,26 +371,26 @@ class RapidshareExtTest < Test::Unit::TestCase
290
371
  assert_true @rs.orphan? folder_c_id
291
372
 
292
373
  # Move orphan folders to root folder
293
- @rs.move_orphans :to => "/"
374
+ @rs.move_orphans :to => '/'
294
375
 
295
376
  hierarchy_expected = {
296
- folder_c_id => {:name=>"c", :parent => folder_b_id, :path => "/b/c"},
297
- folder_b_id => {:name=>"b", :parent => 0, :path => "/b"},
377
+ folder_c_id => {:name=>'c', :parent => folder_b_id, :path => '/b/c'},
378
+ folder_b_id => {:name=>'b', :parent => 0, :path => '/b'},
298
379
  }
299
380
  assert_equal hierarchy_expected, @rs.folders_hierarchy!
300
381
  end
301
382
 
302
- should "delete orphans" do
383
+ should 'delete orphans' do
303
384
  # Create folders
304
- folder_a_id = @rs.add_folder "/a"
385
+ folder_a_id = @rs.add_folder '/a'
305
386
  assert_kind_of Integer, folder_a_id
306
387
  assert_not_equal 0, folder_a_id
307
388
 
308
- folder_b_id = @rs.add_folder "/a/b"
389
+ folder_b_id = @rs.add_folder '/a/b'
309
390
  assert_kind_of Integer, folder_b_id
310
391
  assert_not_equal 0, folder_b_id
311
392
 
312
- folder_c_id = @rs.add_folder "/a/b/c"
393
+ folder_c_id = @rs.add_folder '/a/b/c'
313
394
  assert_kind_of Integer, folder_c_id
314
395
  assert_not_equal 0, folder_c_id
315
396
 
@@ -323,30 +404,30 @@ class RapidshareExtTest < Test::Unit::TestCase
323
404
  assert_false @rs.orphan? folder_b_id
324
405
  assert_false @rs.orphan? folder_c_id
325
406
 
326
- # Delete just folder "/a" to accomplish tree inconsistency
407
+ # Delete just folder '/a' to accomplish tree inconsistency
327
408
  @rs.delrealfolder :realfolder => folder_a_id
328
409
  @rs.reload! :validate => false
329
410
 
330
411
  @rs.remove_orphans!
331
412
 
332
413
  hierarchy_expected = {
333
- folder_c_id => {:name=>"c", :parent => folder_b_id, :path => "/b/c"},
334
- folder_b_id => {:name=>"b", :parent => 0, :path => "/b"},
414
+ folder_c_id => {:name=>'c', :parent => folder_b_id, :path => '/b/c'},
415
+ folder_b_id => {:name=>'b', :parent => 0, :path => '/b'},
335
416
  }
336
417
  assert_equal ({}), @rs.folders_hierarchy!
337
418
  end
338
419
 
339
- should "work with invalid tree" do
420
+ should 'work with invalid tree' do
340
421
  # Create folders
341
- folder_a_id = @rs.add_folder "/a"
422
+ folder_a_id = @rs.add_folder '/a'
342
423
  assert_kind_of Integer, folder_a_id
343
424
  assert_not_equal 0, folder_a_id
344
425
 
345
- folder_b_id = @rs.add_folder "/a/b"
426
+ folder_b_id = @rs.add_folder '/a/b'
346
427
  assert_kind_of Integer, folder_b_id
347
428
  assert_not_equal 0, folder_b_id
348
429
 
349
- folder_c_id = @rs.add_folder "/a/b/c"
430
+ folder_c_id = @rs.add_folder '/a/b/c'
350
431
  assert_kind_of Integer, folder_c_id
351
432
  assert_not_equal 0, folder_c_id
352
433
 
@@ -360,7 +441,7 @@ class RapidshareExtTest < Test::Unit::TestCase
360
441
  assert_false @rs.orphan? folder_b_id
361
442
  assert_false @rs.orphan? folder_c_id
362
443
 
363
- # Delete just folder "/a" to accomplish tree inconsistency
444
+ # Delete just folder '/a' to accomplish tree inconsistency
364
445
  @rs.delrealfolder :realfolder => folder_a_id
365
446
 
366
447
  msg = "Directory tree consistency error. Parent folder ##{folder_a_id} for the folder \"/<undefined>/b\" [#{folder_b_id}] could not be found"