lumberg 2.0.0.pre4 → 2.0.0.pre5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (79) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +49 -49
  3. data/lib/lumberg/cpanel.rb +2 -0
  4. data/lib/lumberg/cpanel/addon_domain.rb +3 -3
  5. data/lib/lumberg/cpanel/backups.rb +1 -1
  6. data/lib/lumberg/cpanel/base.rb +5 -5
  7. data/lib/lumberg/cpanel/box_trapper.rb +1 -1
  8. data/lib/lumberg/cpanel/branding.rb +5 -5
  9. data/lib/lumberg/cpanel/contact.rb +2 -2
  10. data/lib/lumberg/cpanel/cron.rb +6 -6
  11. data/lib/lumberg/cpanel/dns_lookup.rb +1 -1
  12. data/lib/lumberg/cpanel/domain_keys.rb +4 -4
  13. data/lib/lumberg/cpanel/domain_lookup.rb +4 -4
  14. data/lib/lumberg/cpanel/email.rb +40 -40
  15. data/lib/lumberg/cpanel/file_manager.rb +5 -5
  16. data/lib/lumberg/cpanel/ftp.rb +101 -0
  17. data/lib/lumberg/cpanel/gpg.rb +4 -4
  18. data/lib/lumberg/cpanel/locale.rb +1 -1
  19. data/lib/lumberg/cpanel/mime.rb +2 -2
  20. data/lib/lumberg/cpanel/mysql.rb +6 -6
  21. data/lib/lumberg/cpanel/net.rb +2 -2
  22. data/lib/lumberg/cpanel/park.rb +4 -4
  23. data/lib/lumberg/cpanel/password.rb +2 -2
  24. data/lib/lumberg/cpanel/password_strength.rb +63 -0
  25. data/lib/lumberg/cpanel/random_data.rb +1 -1
  26. data/lib/lumberg/cpanel/redirect.rb +2 -2
  27. data/lib/lumberg/cpanel/ssl.rb +23 -23
  28. data/lib/lumberg/cpanel/sub_domain.rb +4 -4
  29. data/lib/lumberg/cpanel/support.rb +2 -2
  30. data/lib/lumberg/cpanel/zone_edit.rb +8 -8
  31. data/lib/lumberg/format_whm.rb +7 -7
  32. data/lib/lumberg/version.rb +1 -1
  33. data/lib/lumberg/whm/account.rb +5 -5
  34. data/lib/lumberg/whm/cert.rb +1 -1
  35. data/lib/lumberg/whm/dns.rb +6 -6
  36. data/lib/lumberg/whm/reseller.rb +5 -5
  37. data/lib/lumberg/whm/server.rb +26 -26
  38. data/spec/cpanel/addon_domain_spec.rb +13 -13
  39. data/spec/cpanel/backups_spec.rb +3 -3
  40. data/spec/cpanel/base_spec.rb +19 -19
  41. data/spec/cpanel/box_trapper_spec.rb +3 -3
  42. data/spec/cpanel/branding_spec.rb +3 -3
  43. data/spec/cpanel/contact_spec.rb +6 -6
  44. data/spec/cpanel/cron_spec.rb +51 -51
  45. data/spec/cpanel/dns_lookup_spec.rb +4 -4
  46. data/spec/cpanel/domain_keys_spec.rb +3 -3
  47. data/spec/cpanel/domain_lookup_spec.rb +5 -5
  48. data/spec/cpanel/email_spec.rb +116 -116
  49. data/spec/cpanel/file_manager_spec.rb +11 -11
  50. data/spec/cpanel/ftp_spec.rb +71 -0
  51. data/spec/cpanel/gpg_spec.rb +3 -3
  52. data/spec/cpanel/locale_spec.rb +3 -3
  53. data/spec/cpanel/net_spec.rb +4 -4
  54. data/spec/cpanel/park_spec.rb +7 -7
  55. data/spec/cpanel/password_spec.rb +5 -5
  56. data/spec/cpanel/password_strength_spec.rb +50 -0
  57. data/spec/cpanel/random_data_spec.rb +4 -4
  58. data/spec/cpanel/ssl_spec.rb +27 -27
  59. data/spec/cpanel/sub_domain_spec.rb +8 -8
  60. data/spec/cpanel/support_spec.rb +4 -4
  61. data/spec/spec_helper.rb +1 -1
  62. data/spec/vcr_cassettes/cpanel/ftp/addftp.yml +43 -0
  63. data/spec/vcr_cassettes/cpanel/ftp/delftp.yml +43 -0
  64. data/spec/vcr_cassettes/cpanel/ftp/listftp.yml +43 -0
  65. data/spec/vcr_cassettes/cpanel/ftp/listftpsessions.yml +43 -0
  66. data/spec/vcr_cassettes/cpanel/ftp/listftpwithdisk.yml +95 -0
  67. data/spec/vcr_cassettes/cpanel/ftp/passwd.yml +43 -0
  68. data/spec/vcr_cassettes/cpanel/ftp/setquota.yml +43 -0
  69. data/spec/vcr_cassettes/cpanel/password_strength/all_required_strengths.yml +43 -0
  70. data/spec/vcr_cassettes/cpanel/password_strength/required_strength.yml +43 -0
  71. data/spec/vcr_cassettes/cpanel/password_strength/strength.yml +83 -0
  72. data/spec/whm/account_spec.rb +69 -69
  73. data/spec/whm/base_spec.rb +3 -3
  74. data/spec/whm/cert_spec.rb +24 -24
  75. data/spec/whm/dns_spec.rb +36 -36
  76. data/spec/whm/reseller_spec.rb +36 -36
  77. data/spec/whm/server_spec.rb +22 -22
  78. data/spec/whm/whm_spec.rb +8 -8
  79. metadata +29 -2
@@ -3,12 +3,12 @@ require "spec_helper"
3
3
  module Lumberg
4
4
  describe Cpanel::Email do
5
5
  let(:domain) { "lumberg-test.com" }
6
- let(:server) { Whm::Server.new(:host => @whm_host, :hash => @whm_hash) }
6
+ let(:server) { Whm::Server.new(host: @whm_host, hash: @whm_hash) }
7
7
  let(:api_username) { "lumberg" }
8
8
  let(:email) do
9
9
  described_class.new(
10
- :server => server,
11
- :api_username => api_username
10
+ server: server,
11
+ api_username: api_username
12
12
  )
13
13
  end
14
14
 
@@ -25,9 +25,9 @@ module Lumberg
25
25
 
26
26
  it "adds a mailing list" do
27
27
  email.add_mailing_list(
28
- :list => "add-test",
29
- :domain => domain,
30
- :password => "s3cr3t5"
28
+ list: "add-test",
29
+ domain: domain,
30
+ password: "s3cr3t5"
31
31
  )
32
32
 
33
33
  email.mailing_lists[:params][:data].find {|l|
@@ -41,9 +41,9 @@ module Lumberg
41
41
 
42
42
  before do
43
43
  email.add_mailing_list(
44
- :list => "test-list",
45
- :domain => domain,
46
- :password => "s3cr3t5"
44
+ list: "test-list",
45
+ domain: domain,
46
+ password: "s3cr3t5"
47
47
  )
48
48
  end
49
49
 
@@ -61,10 +61,10 @@ module Lumberg
61
61
 
62
62
  it "adds a forwarder" do
63
63
  email.add_forwarder(
64
- :domain => domain,
65
- :email => local,
66
- :fwdopt => :fwd,
67
- :fwdemail => "foo@bar.com"
64
+ domain: domain,
65
+ email: local,
66
+ fwdopt: :fwd,
67
+ fwdemail: "foo@bar.com"
68
68
  )
69
69
 
70
70
  email.forwarders[:params][:data].find {|f|
@@ -80,10 +80,10 @@ module Lumberg
80
80
 
81
81
  before do
82
82
  email.add_forwarder(
83
- :domain => domain,
84
- :email => local,
85
- :fwdopt => :fwd,
86
- :fwdemail => "foo@bar.com"
83
+ domain: domain,
84
+ email: local,
85
+ fwdopt: :fwd,
86
+ fwdemail: "foo@bar.com"
87
87
  )
88
88
  end
89
89
 
@@ -101,10 +101,10 @@ module Lumberg
101
101
 
102
102
  before do
103
103
  email.add_forwarder(
104
- :domain => domain,
105
- :email => local,
106
- :fwdopt => :fwd,
107
- :fwdemail => "foo@bar.com"
104
+ domain: domain,
105
+ email: local,
106
+ fwdopt: :fwd,
107
+ fwdemail: "foo@bar.com"
108
108
  )
109
109
  end
110
110
 
@@ -120,10 +120,10 @@ module Lumberg
120
120
 
121
121
  it "adds an email account" do
122
122
  email.add_account(
123
- :domain => domain,
124
- :email => local,
125
- :password => "magicpants",
126
- :quota => 0
123
+ domain: domain,
124
+ email: local,
125
+ password: "magicpants",
126
+ quota: 0
127
127
  )
128
128
 
129
129
  email.accounts[:params][:data].find {|a|
@@ -143,9 +143,9 @@ module Lumberg
143
143
  }[:_diskquota]
144
144
 
145
145
  email.edit_quota(
146
- :domain => domain,
147
- :email => local,
148
- :quota => 10
146
+ domain: domain,
147
+ email: local,
148
+ quota: 10
149
149
  )
150
150
 
151
151
  new_quota = email.accounts[:params][:data].find {|a|
@@ -163,8 +163,8 @@ module Lumberg
163
163
 
164
164
  it "removes an email account" do
165
165
  email.remove(
166
- :domain => domain,
167
- :email => "#{local}@#{domain}"
166
+ domain: domain,
167
+ email: "#{local}@#{domain}"
168
168
  )
169
169
 
170
170
  email.accounts[:params][:data].find {|a|
@@ -182,32 +182,32 @@ module Lumberg
182
182
 
183
183
  before(:each) do
184
184
  email.add_account(
185
- :domain => domain,
186
- :email => local,
187
- :password => "sauce",
188
- :quota => 0
185
+ domain: domain,
186
+ email: local,
187
+ password: "sauce",
188
+ quota: 0
189
189
  )
190
190
  end
191
191
 
192
192
  context ":style option is :with_disk" do
193
193
  it "uses Email::listpopswithdisk" do
194
194
  email.should_receive(:perform_request).with(
195
- hash_including(:api_function => "listpopswithdisk")
195
+ hash_including(api_function: "listpopswithdisk")
196
196
  )
197
197
 
198
- email.accounts(:style => :with_disk)
198
+ email.accounts(style: :with_disk)
199
199
  end
200
200
 
201
201
  it "is the default seting" do
202
202
  email.should_receive(:perform_request).with(
203
- hash_including(:api_function => "listpopswithdisk")
203
+ hash_including(api_function: "listpopswithdisk")
204
204
  )
205
205
 
206
206
  email.accounts
207
207
  end
208
208
 
209
209
  it "returns a list of email accounts" do
210
- data = email.accounts(:style => :with_disk)[:params][:data]
210
+ data = email.accounts(style: :with_disk)[:params][:data]
211
211
  data.any? {|d| d[:email] == email_address }.should be_true
212
212
  end
213
213
  end
@@ -215,14 +215,14 @@ module Lumberg
215
215
  context ":style option is :without_disk" do
216
216
  it "uses Email::listpops" do
217
217
  email.should_receive(:perform_request).with(
218
- hash_including(:api_function => "listpops")
218
+ hash_including(api_function: "listpops")
219
219
  )
220
220
 
221
- email.accounts(:style => :without_disk)
221
+ email.accounts(style: :without_disk)
222
222
  end
223
223
 
224
224
  it "returns a list of email accounts" do
225
- data = email.accounts(:style => :without_disk)[:params][:data]
225
+ data = email.accounts(style: :without_disk)[:params][:data]
226
226
  data.any? {|d| d[:email] == email_address }.should be_true
227
227
  end
228
228
  end
@@ -230,14 +230,14 @@ module Lumberg
230
230
  context ":style option is :with_image" do
231
231
  it "uses Email::listpopswithimage" do
232
232
  email.should_receive(:perform_request).with(
233
- hash_including(:api_function => "listpopswithimage")
233
+ hash_including(api_function: "listpopswithimage")
234
234
  )
235
235
 
236
- email.accounts(:style => :with_image)
236
+ email.accounts(style: :with_image)
237
237
  end
238
238
 
239
239
  it "returns a list of email accounts" do
240
- data = email.accounts(:style => :with_image)[:params][:data]
240
+ data = email.accounts(style: :with_image)[:params][:data]
241
241
  data.any? {|d| d[:email] == email_address }.should be_true
242
242
  end
243
243
  end
@@ -245,14 +245,14 @@ module Lumberg
245
245
  context ":style option is :single" do
246
246
  it "uses Email::listpopssingle" do
247
247
  email.should_receive(:perform_request).with(
248
- hash_including(:api_function => "listpopssingle")
248
+ hash_including(api_function: "listpopssingle")
249
249
  )
250
250
 
251
- email.accounts(:style => :single)
251
+ email.accounts(style: :single)
252
252
  end
253
253
 
254
254
  it "returns a list of email accounts" do
255
- data = email.accounts(:style => :single)[:params][:data]
255
+ data = email.accounts(style: :single)[:params][:data]
256
256
  data.any? {|d| d[:email] == email_address }.should be_true
257
257
  end
258
258
  end
@@ -273,9 +273,9 @@ module Lumberg
273
273
 
274
274
  it "adds an mx record" do
275
275
  email.add_mx(
276
- :domain => domain,
277
- :exchange => "mail.#{domain}",
278
- :preference => 2
276
+ domain: domain,
277
+ exchange: "mail.#{domain}",
278
+ preference: 2
279
279
  )[:params][:data][0][:status].should eq(1)
280
280
  end
281
281
  end
@@ -285,10 +285,10 @@ module Lumberg
285
285
 
286
286
  it "changes an existing mx record" do
287
287
  email.add_mx(
288
- :domain => domain,
289
- :exchange => "mail.#{domain}",
290
- :oldpreference => 2,
291
- :preference => 1
288
+ domain: domain,
289
+ exchange: "mail.#{domain}",
290
+ oldpreference: 2,
291
+ preference: 1
292
292
  )[:params][:data][0][:status].should eq(1)
293
293
  end
294
294
  end
@@ -308,9 +308,9 @@ module Lumberg
308
308
 
309
309
  it "delete an existing mx record" do
310
310
  email.delete_mx(
311
- :domain => domain,
312
- :exchange => "mail.#{domain}",
313
- :preference => 1
311
+ domain: domain,
312
+ exchange: "mail.#{domain}",
313
+ preference: 1
314
314
  )[:params][:data][0][:status].should eq(1)
315
315
  end
316
316
  end
@@ -320,15 +320,15 @@ module Lumberg
320
320
 
321
321
  it "sets an existing mx record to use remote" do
322
322
  email.set_mx_type(
323
- :domain => domain,
324
- :mxcheck => "remote"
323
+ domain: domain,
324
+ mxcheck: "remote"
325
325
  )[:params][:data][0][:detected].should == "remote"
326
326
  end
327
327
  end
328
328
 
329
329
  describe "#set_mail_delivery" do
330
330
  let(:detected) do
331
- email.mx(:domain => domain)[:params][:data][0][:detected]
331
+ email.mx(domain: domain)[:params][:data][0][:detected]
332
332
  end
333
333
 
334
334
  use_vcr_cassette("cpanel/email/set_mail_delivery")
@@ -338,8 +338,8 @@ module Lumberg
338
338
 
339
339
  it "sets remote mail delivery" do
340
340
  email.set_mail_delivery(
341
- :domain => domain,
342
- :delivery => :remote
341
+ domain: domain,
342
+ delivery: :remote
343
343
  )
344
344
 
345
345
  detected.should == "remote"
@@ -351,8 +351,8 @@ module Lumberg
351
351
 
352
352
  it "sets local mail delivery" do
353
353
  email.set_mail_delivery(
354
- :domain => domain,
355
- :delivery => :local
354
+ domain: domain,
355
+ delivery: :local
356
356
  )
357
357
 
358
358
  detected.should == "local"
@@ -366,14 +366,14 @@ module Lumberg
366
366
 
367
367
  before do
368
368
  email.set_mail_delivery(
369
- :domain => domain,
370
- :delivery => :local
369
+ domain: domain,
370
+ delivery: :local
371
371
  )
372
372
  end
373
373
 
374
374
  it "returns 1" do
375
375
  email.check_local_delivery(
376
- :domain => domain
376
+ domain: domain
377
377
  )[:params][:data][0][:alwaysaccept].should == 1
378
378
  end
379
379
  end
@@ -383,14 +383,14 @@ module Lumberg
383
383
 
384
384
  before do
385
385
  email.set_mail_delivery(
386
- :domain => domain,
387
- :delivery => :remote
386
+ domain: domain,
387
+ delivery: :remote
388
388
  )
389
389
  end
390
390
 
391
391
  it "returns 0" do
392
392
  email.check_local_delivery(
393
- :domain => domain
393
+ domain: domain
394
394
  )[:params][:data][0][:alwaysaccept].should == 0
395
395
  end
396
396
  end
@@ -404,22 +404,22 @@ module Lumberg
404
404
 
405
405
  before do
406
406
  email.add_account(
407
- :email => local,
408
- :domain => domain,
409
- :password => "abcdefg",
410
- :quota => 0
407
+ email: local,
408
+ domain: domain,
409
+ password: "abcdefg",
410
+ quota: 0
411
411
  )
412
412
  end
413
413
 
414
414
  it "adds an email filter" do
415
415
  result = email.add_filter(
416
- :account => "#{local}@#{domain}",
417
- :filtername => filter_name,
418
- :action1 => "fail",
419
- :match1 => "is",
420
- :opt1 => "and",
421
- :part1 => "$header_from:",
422
- :val1 => "hi"
416
+ account: "#{local}@#{domain}",
417
+ filtername: filter_name,
418
+ action1: "fail",
419
+ match1: "is",
420
+ opt1: "and",
421
+ part1: "$header_from:",
422
+ val1: "hi"
423
423
  )[:params][:data][0]
424
424
 
425
425
  result[:error].should == 0
@@ -436,38 +436,38 @@ module Lumberg
436
436
 
437
437
  before do
438
438
  email.add_account(
439
- :email => local,
440
- :domain => domain,
441
- :password => "abcdefg",
442
- :quota => 0
439
+ email: local,
440
+ domain: domain,
441
+ password: "abcdefg",
442
+ quota: 0
443
443
  )
444
444
 
445
445
  email.add_filter(
446
- :account => "#{local}@#{domain}",
447
- :filtername => filter_name,
448
- :action1 => "fail",
449
- :match1 => "is",
450
- :opt1 => "and",
451
- :part1 => "$header_from:",
452
- :val1 => "hi"
446
+ account: "#{local}@#{domain}",
447
+ filtername: filter_name,
448
+ action1: "fail",
449
+ match1: "is",
450
+ opt1: "and",
451
+ part1: "$header_from:",
452
+ val1: "hi"
453
453
  )
454
454
  end
455
455
 
456
456
  it "returns a list of email filters" do
457
457
  email.filters(
458
- :account => "#{local}@#{domain}"
458
+ account: "#{local}@#{domain}"
459
459
  )[:params][:data][0][:filtername].should == filter_name
460
460
  end
461
461
 
462
462
  context ":old_style option truthy" do
463
463
  it "uses deprecated Email::listfilters" do
464
464
  email.should_receive(:perform_request).with(
465
- hash_including(:api_function => "listfilters")
465
+ hash_including(api_function: "listfilters")
466
466
  )
467
467
 
468
468
  email.filters(
469
- :account => "#{local}@#{domain}",
470
- :old_style => true
469
+ account: "#{local}@#{domain}",
470
+ old_style: true
471
471
  )
472
472
  end
473
473
  end
@@ -475,18 +475,18 @@ module Lumberg
475
475
  context ":old_style option falsy" do
476
476
  it "uses Email::filterlist" do
477
477
  email.should_receive(:perform_request).with(
478
- hash_including(:api_function => "filterlist")
478
+ hash_including(api_function: "filterlist")
479
479
  )
480
480
 
481
481
  email.filters(
482
- :account => "#{local}@#{domain}",
483
- :old_style => false
482
+ account: "#{local}@#{domain}",
483
+ old_style: false
484
484
  )
485
485
  end
486
486
 
487
487
  it "is the default setting" do
488
488
  email.should_receive(:perform_request).with(
489
- hash_including(:api_function => "filterlist")
489
+ hash_including(api_function: "filterlist")
490
490
  )
491
491
 
492
492
  email.filters
@@ -525,17 +525,17 @@ module Lumberg
525
525
 
526
526
  before do
527
527
  email.add_account(
528
- :domain => domain,
529
- :email => local,
530
- :password => "s00pers3cr3t",
531
- :quota => 0
528
+ domain: domain,
529
+ email: local,
530
+ password: "s00pers3cr3t",
531
+ quota: 0
532
532
  )
533
533
  end
534
534
 
535
535
  it "gets disk usage information for an email account" do
536
536
  email.disk_usage(
537
- :domain => domain,
538
- :login => local
537
+ domain: domain,
538
+ login: local
539
539
  )[:params][:data].find {|d|
540
540
  d[:login] == local && d[:domain] == domain
541
541
  }.should_not be_nil
@@ -549,16 +549,16 @@ module Lumberg
549
549
 
550
550
  before do
551
551
  email.add_account(
552
- :domain => domain,
553
- :email => local,
554
- :password => "s00pers3cr3t",
555
- :quota => 0
552
+ domain: domain,
553
+ email: local,
554
+ password: "s00pers3cr3t",
555
+ quota: 0
556
556
  )
557
557
  end
558
558
 
559
559
  it "gets disk usage information for an email account" do
560
560
  email.mail_dir(
561
- :account => "#{local}@#{domain}"
561
+ account: "#{local}@#{domain}"
562
562
  )[:params][:data][0][:absdir].should match(
563
563
  /\/mail\/#{domain}\/#{local}/
564
564
  )
@@ -572,10 +572,10 @@ module Lumberg
572
572
 
573
573
  before do
574
574
  email.add_account(
575
- :domain => domain,
576
- :email => local,
577
- :password => "s00pers3cr3t",
578
- :quota => 0
575
+ domain: domain,
576
+ email: local,
577
+ password: "s00pers3cr3t",
578
+ quota: 0
579
579
  )
580
580
  end
581
581
 
@@ -591,7 +591,7 @@ module Lumberg
591
591
 
592
592
  it "gets default address info for a domain" do
593
593
  email.default_address(
594
- :domain => domain
594
+ domain: domain
595
595
  )[:params][:data][0][:domain].should == domain
596
596
  end
597
597
  end