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
@@ -0,0 +1,43 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://myhost.com:2087/json-api/cpanel?app=htaccess&cpanel_jsonapi_apiversion=2&cpanel_jsonapi_func=get_required_strength&cpanel_jsonapi_module=PasswdStrength&cpanel_jsonapi_user=lumberg
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Authorization:
11
+ - WHM root:iscool
12
+ User-Agent:
13
+ - Faraday v0.8.8
14
+ Accept-Encoding:
15
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
16
+ Accept:
17
+ - '*/*'
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ Server:
24
+ - cpsrvd/11.36.2.3
25
+ X-Keep-Alive-Count:
26
+ - '1'
27
+ Connection:
28
+ - Keep-Alive
29
+ Keep-Alive:
30
+ - timeout=70, max=200
31
+ Date:
32
+ - Wed, 09 Oct 2013 15:07:09 GMT
33
+ Content-Type:
34
+ - text/plain; charset="utf-8"
35
+ Content-Length:
36
+ - '137'
37
+ body:
38
+ encoding: UTF-8
39
+ string: |
40
+ {"cpanelresult":{"data":[{"strength":70}],"module":"PasswdStrength","func":"get_required_strength","preevent":{"result":1},"postevent":{"result":1},"event":{"result":1},"apiversion":2}}
41
+ http_version:
42
+ recorded_at: Wed, 09 Oct 2013 15:07:09 GMT
43
+ recorded_with: VCR 2.4.0
@@ -0,0 +1,83 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://myhost.com:2087/json-api/cpanel?cpanel_jsonapi_apiversion=2&cpanel_jsonapi_func=get_password_strength&cpanel_jsonapi_module=PasswdStrength&cpanel_jsonapi_user=lumberg&password=weakness
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Authorization:
11
+ - WHM root:iscool
12
+ User-Agent:
13
+ - Faraday v0.8.8
14
+ Accept-Encoding:
15
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
16
+ Accept:
17
+ - '*/*'
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ Server:
24
+ - cpsrvd/11.36.2.3
25
+ X-Keep-Alive-Count:
26
+ - '1'
27
+ Connection:
28
+ - Keep-Alive
29
+ Keep-Alive:
30
+ - timeout=70, max=200
31
+ Date:
32
+ - Wed, 09 Oct 2013 15:07:08 GMT
33
+ Content-Type:
34
+ - text/plain; charset="utf-8"
35
+ Content-Length:
36
+ - '138'
37
+ body:
38
+ encoding: UTF-8
39
+ string: |
40
+ {"cpanelresult":{"event":{"result":1},"postevent":{"result":1},"module":"PasswdStrength","data":[{"strength":"24"}],"func":"get_password_strength","apiversion":2,"preevent":{"result":1}}}
41
+ http_version:
42
+ recorded_at: Wed, 09 Oct 2013 15:07:08 GMT
43
+ - request:
44
+ method: get
45
+ uri: https://myhost.com:2087/json-api/cpanel?cpanel_jsonapi_apiversion=2&cpanel_jsonapi_func=get_password_strength&cpanel_jsonapi_module=PasswdStrength&cpanel_jsonapi_user=lumberg&password=0zUIcv-0
46
+ body:
47
+ encoding: US-ASCII
48
+ string: ''
49
+ headers:
50
+ Authorization:
51
+ - WHM root:iscool
52
+ User-Agent:
53
+ - Faraday v0.8.8
54
+ Accept-Encoding:
55
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
56
+ Accept:
57
+ - '*/*'
58
+ response:
59
+ status:
60
+ code: 200
61
+ message: OK
62
+ headers:
63
+ Server:
64
+ - cpsrvd/11.36.2.3
65
+ X-Keep-Alive-Count:
66
+ - '1'
67
+ Connection:
68
+ - Keep-Alive
69
+ Keep-Alive:
70
+ - timeout=70, max=200
71
+ Date:
72
+ - Wed, 09 Oct 2013 15:07:09 GMT
73
+ Content-Type:
74
+ - text/plain; charset="utf-8"
75
+ Content-Length:
76
+ - '137'
77
+ body:
78
+ encoding: UTF-8
79
+ string: |
80
+ {"cpanelresult":{"event":{"result":1},"postevent":{"result":1},"func":"get_password_strength","module":"PasswdStrength","apiversion":2,"preevent":{"result":1},"data":[{"strength":"82"}]}}
81
+ http_version:
82
+ recorded_at: Wed, 09 Oct 2013 15:07:09 GMT
83
+ recorded_with: VCR 2.4.0
@@ -4,16 +4,16 @@ require 'lumberg/whm'
4
4
  module Lumberg
5
5
  describe Whm::Account do
6
6
  before(:each) do
7
- @login = { :host => @whm_host, :hash => @whm_hash }
7
+ @login = { host: @whm_host, hash: @whm_hash }
8
8
  @server = Whm::Server.new(@login.dup)
9
- @account = Whm::Account.new(:server => @server.dup)
9
+ @account = Whm::Account.new(server: @server.dup)
10
10
  end
11
11
 
12
12
  describe "#create" do
13
13
  use_vcr_cassette "whm/account/createacct"
14
14
 
15
15
  it "creates the account with proper params" do
16
- result = @account.create(:username => 'valid', :password => 'hummingbird123', :domain => 'valid-thing.com')
16
+ result = @account.create(username: 'valid', password: 'hummingbird123', domain: 'valid-thing.com')
17
17
  result[:success].should be_true
18
18
  result[:message].should match(/Account Creation Ok/i)
19
19
  result[:params].should_not be_empty
@@ -25,7 +25,7 @@ module Lumberg
25
25
  end
26
26
 
27
27
  it "returns an error on duplicate accounts" do
28
- result = @account.create(:username => 'invalid', :password => 'hummingbird123', :domain => 'invalid-thing.com')
28
+ result = @account.create(username: 'invalid', password: 'hummingbird123', domain: 'invalid-thing.com')
29
29
  result[:success].should be(false)
30
30
  result[:message].should match(/username already exists/i)
31
31
  end
@@ -35,25 +35,25 @@ module Lumberg
35
35
  use_vcr_cassette "whm/account/removeacct"
36
36
 
37
37
  it "removes a user and keeps DNS by default" do
38
- result = @account.remove(:username => 'removeme')
38
+ result = @account.remove(username: 'removeme')
39
39
  result[:success].should be_true
40
40
  result[:params][:rawout].should match(/Removing DNS Entries/i)
41
41
  end
42
42
 
43
43
  it "removes a user and DNS when asked" do
44
- result = @account.remove(:username => 'removeme', :keepdns => false)
44
+ result = @account.remove(username: 'removeme', keepdns: false)
45
45
  result[:success].should be_true
46
46
  result[:params][:rawout].should match(/Removing DNS Entries/i)
47
47
  end
48
48
 
49
49
  it "removes a user but keep DNS" do
50
- result = @account.remove(:username => 'removeme', :keepdns => true)
50
+ result = @account.remove(username: 'removeme', keepdns: true)
51
51
  result[:success].should be_true
52
52
  result[:params][:rawout].should_not match(/Removing DNS Entries/i)
53
53
  end
54
54
 
55
55
  it "returns an error when the user doesn't exist" do
56
- result = @account.remove(:username => 'notreal')
56
+ result = @account.remove(username: 'notreal')
57
57
  result[:success].should be(false)
58
58
  result[:message].should match(/notreal does not exist/i)
59
59
  end
@@ -63,13 +63,13 @@ module Lumberg
63
63
  use_vcr_cassette "whm/account/passwd"
64
64
 
65
65
  it "changes the password" do
66
- result = @account.change_password(:username => 'changeme', :password => 'superpass')
66
+ result = @account.change_password(username: 'changeme', password: 'superpass')
67
67
  result[:success].should be_true
68
68
  result[:message].should match(/Password changed for user changeme/i)
69
69
  end
70
70
 
71
71
  it "isn't successful when the user doesn't exist" do
72
- result = @account.change_password(:username => 'dontchangeme', :password => 'superpass')
72
+ result = @account.change_password(username: 'dontchangeme', password: 'superpass')
73
73
  result[:success].should be(false)
74
74
  result[:message].should match(/dontchangeme does not exist/i)
75
75
  end
@@ -79,7 +79,7 @@ module Lumberg
79
79
  use_vcr_cassette "whm/account/limitbw"
80
80
 
81
81
  it "sets the bandwidth limit" do
82
- result = @account.limit_bandwidth(:username => 'changeme', :bwlimit => 99999)
82
+ result = @account.limit_bandwidth(username: 'changeme', bwlimit: 99999)
83
83
  result[:success].should be_true
84
84
  result[:message].should match(/Bandwidth Limit for changeme set to 99999/i)
85
85
  result[:params][:bwlimit][:bwlimitenable].should equal(false)
@@ -88,7 +88,7 @@ module Lumberg
88
88
 
89
89
  it "isn't successful when the user doesn't exist" do
90
90
  expect {
91
- @account.limit_bandwidth(:username => 'notexists', :bwlimit => 99999)
91
+ @account.limit_bandwidth(username: 'notexists', bwlimit: 99999)
92
92
  }.to raise_error(WhmInvalidUser, /User notexists does not exist/i)
93
93
  end
94
94
  end
@@ -104,7 +104,7 @@ module Lumberg
104
104
  end
105
105
 
106
106
  it "returns data for the account" do
107
- result = @account.list(:searchtype => 'user', :search => 'changeme')
107
+ result = @account.list(searchtype: 'user', search: 'changeme')
108
108
  result[:success].should be_true
109
109
  account = result[:params][:acct].first
110
110
  account[:email].should == "*unknown*"
@@ -115,19 +115,19 @@ module Lumberg
115
115
  end
116
116
 
117
117
  it "lists accounts that match a regex search for the user" do
118
- result = @account.list(:searchtype => 'user', :search => 'changeme')
118
+ result = @account.list(searchtype: 'user', search: 'changeme')
119
119
  result[:success].should be_true
120
120
  result[:params][:acct].should have(1).account
121
121
  end
122
122
 
123
123
  it "lists accounts that match a regex search for the ip" do
124
- result = @account.list(:searchtype => 'ip', :search => '192\..*?\.1\.20')
124
+ result = @account.list(searchtype: 'ip', search: '192\..*?\.1\.20')
125
125
  result[:success].should be_true
126
126
  result[:params][:acct].should have(6).accounts
127
127
  end
128
128
 
129
129
  it "lists accounts that match a regex search for the domain" do
130
- result = @account.list(:searchtype => 'domain', :search => 'ch.*?e.com')
130
+ result = @account.list(searchtype: 'domain', search: 'ch.*?e.com')
131
131
  result[:success].should be_true
132
132
  result[:params][:acct].should have(1).account
133
133
  end
@@ -137,39 +137,39 @@ module Lumberg
137
137
  use_vcr_cassette "whm/account/modifyacct"
138
138
 
139
139
  it "allows domain modification" do
140
- result = @account.modify(:username => 'changeme', :domain => 'example.com')
140
+ result = @account.modify(username: 'changeme', domain: 'example.com')
141
141
  result[:success].should be_true
142
142
  result[:params][:newcfg][:cpuser][:DOMAIN].should == 'example.com'
143
143
  end
144
144
 
145
145
  it "returns an error for an invalid user" do
146
- result = @account.modify(:username => 'notexists')
146
+ result = @account.modify(username: 'notexists')
147
147
  result[:success].should_not be_true
148
148
  result[:message].should match(/Unable to fetch the cPanel user file for notexists/)
149
149
  end
150
150
 
151
151
  it "returns the bandwidth limit" do
152
- result = @account.modify(:username => 'changeme')
152
+ result = @account.modify(username: 'changeme')
153
153
  result[:params][:newcfg][:cpuser][:BWLIMIT].should == "unlimited"
154
154
  end
155
155
 
156
156
  it "returns the primary contact email" do
157
- result = @account.modify(:username => 'changeme')
157
+ result = @account.modify(username: 'changeme')
158
158
  result[:params][:newcfg][:cpuser][:CONTACTEMAIL].should == "user@address.com"
159
159
  end
160
160
 
161
161
  it "returns the secondary contact email" do
162
- result = @account.modify(:username => 'changeme')
162
+ result = @account.modify(username: 'changeme')
163
163
  result[:params][:newcfg][:cpuser][:CONTACTEMAIL2].should == "user2@address.com"
164
164
  end
165
165
 
166
166
  it "returns the main domain" do
167
- result = @account.modify(:username => 'changeme')
167
+ result = @account.modify(username: 'changeme')
168
168
  result[:params][:newcfg][:cpuser][:DOMAIN].should == "example.com"
169
169
  end
170
170
 
171
171
  it "returns whether or not the domain has CGI access" do
172
- result = @account.modify(:username => 'changeme')
172
+ result = @account.modify(username: 'changeme')
173
173
  result[:params][:newcfg][:cpuser][:HASCGI].should be_true
174
174
  end
175
175
  end
@@ -178,19 +178,19 @@ module Lumberg
178
178
  use_vcr_cassette "whm/account/editquota"
179
179
 
180
180
  it "returns an error for an invalid user" do
181
- result = @account.edit_quota(:username => 'notexists', :quota => 500)
181
+ result = @account.edit_quota(username: 'notexists', quota: 500)
182
182
  result[:success].should_not be_true
183
183
  result[:message].should match(/Invalid User\. Cannot set quota\./i)
184
184
  end
185
185
 
186
186
  it "changes the user's disk space usage quota" do
187
- result = @account.edit_quota(:username => 'changeme', :quota => 500)
187
+ result = @account.edit_quota(username: 'changeme', quota: 500)
188
188
  result[:success].should be_true
189
189
  result[:message].should match(/Set quota for user./i)
190
190
  end
191
191
 
192
192
  it "returns an error if a negative usage quota is passed" do
193
- result = @account.edit_quota(:username => 'changeme', :quota => -1)
193
+ result = @account.edit_quota(username: 'changeme', quota: -1)
194
194
  result[:success].should_not be_true
195
195
  result[:message].should match(/Failed to set quota for user\./i)
196
196
  end
@@ -200,13 +200,13 @@ module Lumberg
200
200
  use_vcr_cassette "whm/account/accountsummary"
201
201
 
202
202
  it "returns an error for invalid users" do
203
- result = @account.summary(:username => 'notexists')
203
+ result = @account.summary(username: 'notexists')
204
204
  result[:success].should_not be_true
205
205
  result[:message].should match(/does not exist/i)
206
206
  end
207
207
 
208
208
  it "returns a summary" do
209
- result = @account.summary(:username => 'summary')
209
+ result = @account.summary(username: 'summary')
210
210
  result[:success].should be_true
211
211
  result[:message].should match(/ok/i)
212
212
  end
@@ -216,20 +216,20 @@ module Lumberg
216
216
  use_vcr_cassette "whm/account/suspend"
217
217
 
218
218
  it "returns an error for invalid users" do
219
- result = @account.suspend(:username => 'notexists')
219
+ result = @account.suspend(username: 'notexists')
220
220
  result[:success].should_not be_true
221
221
  result[:message].should match(/does not exist/i)
222
222
  end
223
223
 
224
224
  it "suspends" do
225
- result = @account.suspend(:username => 'suspendme')
225
+ result = @account.suspend(username: 'suspendme')
226
226
  result[:success].should be_true
227
227
  result[:message].should match(/has been suspended/i)
228
228
  end
229
229
 
230
230
  it "suspends with a reason" do
231
- @account.server.should_receive(:perform_request).with('suspendacct', hash_including(:user => 'suspendme', :reason => 'abusive user'))
232
- @account.suspend(:username => 'suspendme', :reason => 'abusive user')
231
+ @account.server.should_receive(:perform_request).with('suspendacct', hash_including(user: 'suspendme', reason: 'abusive user'))
232
+ @account.suspend(username: 'suspendme', reason: 'abusive user')
233
233
  end
234
234
  end
235
235
 
@@ -237,13 +237,13 @@ module Lumberg
237
237
  use_vcr_cassette "whm/account/unsuspend"
238
238
 
239
239
  it "returns an error for invalid users" do
240
- result = @account.unsuspend(:username => 'notexists')
240
+ result = @account.unsuspend(username: 'notexists')
241
241
  result[:success].should_not be_true
242
242
  result[:message].should match(/does not exist/i)
243
243
  end
244
244
 
245
245
  it "unsuspends" do
246
- result = @account.unsuspend(:username => 'asdfasdf')
246
+ result = @account.unsuspend(username: 'asdfasdf')
247
247
  result[:success].should be_true
248
248
  result[:message].should match(/unsuspending .* account/i)
249
249
  end
@@ -254,10 +254,10 @@ module Lumberg
254
254
 
255
255
  it "returns non-empty result" do
256
256
  # empty isn't a real param. VCR Hacks
257
- result = @account.list_suspended(:empty => true)
257
+ result = @account.list_suspended(empty: true)
258
258
  result[:success].should be_true
259
259
  result[:params][:accts].should_not be_empty
260
- result[:params][:accts].first.should include(:user => 'removeme')
260
+ result[:params][:accts].first.should include(user: 'removeme')
261
261
  end
262
262
 
263
263
  it "returns empty result" do
@@ -271,19 +271,19 @@ module Lumberg
271
271
  use_vcr_cassette "whm/account/changepackage"
272
272
 
273
273
  it "returns an error for an invalid user" do
274
- result = @account.change_package(:username => 'notexists', :pkg => 'default')
274
+ result = @account.change_package(username: 'notexists', pkg: 'default')
275
275
  result[:success].should_not be_true
276
276
  result[:message].should match(/user notexists does not exist/i)
277
277
  end
278
278
 
279
279
  it "fails if the package was not found" do
280
- result = @account.change_package(:username => 'changeme', :pkg => 'fakepackage')
280
+ result = @account.change_package(username: 'changeme', pkg: 'fakepackage')
281
281
  result[:success].should_not be_true
282
282
  result[:message].should match(/package does not exist/i)
283
283
  end
284
284
 
285
285
  it "changes the package" do
286
- result = @account.change_package(:username => 'changeme', :pkg => 'gold')
286
+ result = @account.change_package(username: 'changeme', pkg: 'gold')
287
287
  result[:success].should be_true
288
288
  result[:message].should match(/Account Upgrade\/Downgrade Complete for changeme/i)
289
289
  end
@@ -293,21 +293,21 @@ module Lumberg
293
293
  use_vcr_cassette 'whm/account/myprivs'
294
294
 
295
295
  it "has a result" do
296
- result = @account.privs(:username => 'privs')
296
+ result = @account.privs(username: 'privs')
297
297
  result[:success].should be_true
298
298
 
299
299
  params = result[:params]
300
300
  expected = {
301
- :kill_dns => false, :edit_dns => false, :edit_mx => false, :add_pkg => false,
302
- :suspend_acct => false, :add_pkg_shell => false, :viewglobalpackages => false,
303
- :resftp => false, :list_accts => false, :all => true, :passwd => false, :quota => false,
304
- :park_dns => false, :rearrange_accts => false, :allow_addoncreate => false, :demo => false,
305
- :news => false, :edit_account => false, :allow_unlimited_disk_pkgs => false, :allow_parkedcreate => false,
306
- :frontpage => false, :restart => false, :ssl_gencrt => false, :allow_unlimited_pkgs => false,
307
- :add_pkg_ip => false, :disallow_shell => false, :res_cart => false, :ssl_buy => false, :kill_acct => false,
308
- :allow_unlimited_bw_pkgs => false, :create_dns => false, :mailcheck => false, :clustering => false, :ssl => false,
309
- :edit_pkg => false, :locale_edit => false, :show_bandwidth => false, :upgrade_account => false, :thirdparty => false,
310
- :limit_bandwidth => false, :create_acct => false, :demo_setup => false, :stats => false}
301
+ kill_dns: false, edit_dns: false, edit_mx: false, add_pkg: false,
302
+ suspend_acct: false, add_pkg_shell: false, viewglobalpackages: false,
303
+ resftp: false, list_accts: false, all: true, passwd: false, quota: false,
304
+ park_dns: false, rearrange_accts: false, allow_addoncreate: false, demo: false,
305
+ news: false, edit_account: false, allow_unlimited_disk_pkgs: false, allow_parkedcreate: false,
306
+ frontpage: false, restart: false, ssl_gencrt: false, allow_unlimited_pkgs: false,
307
+ add_pkg_ip: false, disallow_shell: false, res_cart: false, ssl_buy: false, kill_acct: false,
308
+ allow_unlimited_bw_pkgs: false, create_dns: false, mailcheck: false, clustering: false, ssl: false,
309
+ edit_pkg: false, locale_edit: false, show_bandwidth: false, upgrade_account: false, thirdparty: false,
310
+ limit_bandwidth: false, create_acct: false, demo_setup: false, stats: false}
311
311
 
312
312
  params.should include(expected)
313
313
  end
@@ -317,13 +317,13 @@ module Lumberg
317
317
  use_vcr_cassette "whm/account/domainuserdata"
318
318
 
319
319
  it "returns an error for an unknown domain" do
320
- result = @account.domain_user_data(:domain => 'notexists.com')
320
+ result = @account.domain_user_data(domain: 'notexists.com')
321
321
  result[:success].should_not be_true
322
322
  result[:message].should match(/Unable to determine account owner for domain\./i)
323
323
  end
324
324
 
325
325
  it "returns the correct data" do
326
- result = @account.domain_user_data(:domain => 'example.com')
326
+ result = @account.domain_user_data(domain: 'example.com')
327
327
  result[:success].should be_true
328
328
  result[:params][:documentroot].should == "/home/changeme/public_html"
329
329
  result[:params][:group].should == "changeme"
@@ -345,17 +345,17 @@ module Lumberg
345
345
  use_vcr_cassette "whm/account/setsiteip"
346
346
 
347
347
  it "accepts a username for the account to use" do
348
- result = @account.set_site_ip(:ip => '192.1.2.3', :username => 'changeme')
348
+ result = @account.set_site_ip(ip: '192.1.2.3', username: 'changeme')
349
349
  result[:success].should be_true
350
350
  end
351
351
 
352
352
  it "accepts a domain for the account to use" do
353
- result = @account.set_site_ip(:ip => '192.1.2.3', :domain => 'example.com')
353
+ result = @account.set_site_ip(ip: '192.1.2.3', domain: 'example.com')
354
354
  result[:success].should be_true
355
355
  end
356
356
 
357
357
  it "sets the site ip" do
358
- result = @account.set_site_ip(:ip => '192.1.2.3', :username => 'changeme')
358
+ result = @account.set_site_ip(ip: '192.1.2.3', username: 'changeme')
359
359
  result[:success].should be_true
360
360
  result[:message].should match(/OK/i)
361
361
  end
@@ -367,26 +367,26 @@ module Lumberg
367
367
 
368
368
  it "returns an error if it can't find the backup" do
369
369
  result = @account.restore_account("api.version".to_sym => 1,
370
- :username => 'notexists',
371
- :type => 'daily',
372
- :all => false,
373
- :ip => false,
374
- :mail => false,
375
- :mysql => false,
376
- :subs => false)
370
+ username: 'notexists',
371
+ type: 'daily',
372
+ all: false,
373
+ ip: false,
374
+ mail: false,
375
+ mysql: false,
376
+ subs: false)
377
377
  result[:params][:result].to_i.should == 0
378
378
  result[:params][:reason].should match(/Unable to find archive/i)
379
379
  end
380
380
 
381
381
  it "restores the account" do
382
382
  result = @account.restore_account("api.version".to_sym => 1,
383
- :username => 'changeme',
384
- :type => 'daily',
385
- :all => false,
386
- :ip => false,
387
- :mail => false,
388
- :mysql => false,
389
- :subs => false)
383
+ username: 'changeme',
384
+ type: 'daily',
385
+ all: false,
386
+ ip: false,
387
+ mail: false,
388
+ mysql: false,
389
+ subs: false)
390
390
  result[:params][:result].to_i.should == 1
391
391
  result[:params][:reason].should == "OK"
392
392
  result[:params][:output][:raw].should match(/Account Restore Complete/i)