lumberg 2.0.0.pre4 → 2.0.0.pre5
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.
- checksums.yaml +4 -4
- data/README.md +49 -49
- data/lib/lumberg/cpanel.rb +2 -0
- data/lib/lumberg/cpanel/addon_domain.rb +3 -3
- data/lib/lumberg/cpanel/backups.rb +1 -1
- data/lib/lumberg/cpanel/base.rb +5 -5
- data/lib/lumberg/cpanel/box_trapper.rb +1 -1
- data/lib/lumberg/cpanel/branding.rb +5 -5
- data/lib/lumberg/cpanel/contact.rb +2 -2
- data/lib/lumberg/cpanel/cron.rb +6 -6
- data/lib/lumberg/cpanel/dns_lookup.rb +1 -1
- data/lib/lumberg/cpanel/domain_keys.rb +4 -4
- data/lib/lumberg/cpanel/domain_lookup.rb +4 -4
- data/lib/lumberg/cpanel/email.rb +40 -40
- data/lib/lumberg/cpanel/file_manager.rb +5 -5
- data/lib/lumberg/cpanel/ftp.rb +101 -0
- data/lib/lumberg/cpanel/gpg.rb +4 -4
- data/lib/lumberg/cpanel/locale.rb +1 -1
- data/lib/lumberg/cpanel/mime.rb +2 -2
- data/lib/lumberg/cpanel/mysql.rb +6 -6
- data/lib/lumberg/cpanel/net.rb +2 -2
- data/lib/lumberg/cpanel/park.rb +4 -4
- data/lib/lumberg/cpanel/password.rb +2 -2
- data/lib/lumberg/cpanel/password_strength.rb +63 -0
- data/lib/lumberg/cpanel/random_data.rb +1 -1
- data/lib/lumberg/cpanel/redirect.rb +2 -2
- data/lib/lumberg/cpanel/ssl.rb +23 -23
- data/lib/lumberg/cpanel/sub_domain.rb +4 -4
- data/lib/lumberg/cpanel/support.rb +2 -2
- data/lib/lumberg/cpanel/zone_edit.rb +8 -8
- data/lib/lumberg/format_whm.rb +7 -7
- data/lib/lumberg/version.rb +1 -1
- data/lib/lumberg/whm/account.rb +5 -5
- data/lib/lumberg/whm/cert.rb +1 -1
- data/lib/lumberg/whm/dns.rb +6 -6
- data/lib/lumberg/whm/reseller.rb +5 -5
- data/lib/lumberg/whm/server.rb +26 -26
- data/spec/cpanel/addon_domain_spec.rb +13 -13
- data/spec/cpanel/backups_spec.rb +3 -3
- data/spec/cpanel/base_spec.rb +19 -19
- data/spec/cpanel/box_trapper_spec.rb +3 -3
- data/spec/cpanel/branding_spec.rb +3 -3
- data/spec/cpanel/contact_spec.rb +6 -6
- data/spec/cpanel/cron_spec.rb +51 -51
- data/spec/cpanel/dns_lookup_spec.rb +4 -4
- data/spec/cpanel/domain_keys_spec.rb +3 -3
- data/spec/cpanel/domain_lookup_spec.rb +5 -5
- data/spec/cpanel/email_spec.rb +116 -116
- data/spec/cpanel/file_manager_spec.rb +11 -11
- data/spec/cpanel/ftp_spec.rb +71 -0
- data/spec/cpanel/gpg_spec.rb +3 -3
- data/spec/cpanel/locale_spec.rb +3 -3
- data/spec/cpanel/net_spec.rb +4 -4
- data/spec/cpanel/park_spec.rb +7 -7
- data/spec/cpanel/password_spec.rb +5 -5
- data/spec/cpanel/password_strength_spec.rb +50 -0
- data/spec/cpanel/random_data_spec.rb +4 -4
- data/spec/cpanel/ssl_spec.rb +27 -27
- data/spec/cpanel/sub_domain_spec.rb +8 -8
- data/spec/cpanel/support_spec.rb +4 -4
- data/spec/spec_helper.rb +1 -1
- data/spec/vcr_cassettes/cpanel/ftp/addftp.yml +43 -0
- data/spec/vcr_cassettes/cpanel/ftp/delftp.yml +43 -0
- data/spec/vcr_cassettes/cpanel/ftp/listftp.yml +43 -0
- data/spec/vcr_cassettes/cpanel/ftp/listftpsessions.yml +43 -0
- data/spec/vcr_cassettes/cpanel/ftp/listftpwithdisk.yml +95 -0
- data/spec/vcr_cassettes/cpanel/ftp/passwd.yml +43 -0
- data/spec/vcr_cassettes/cpanel/ftp/setquota.yml +43 -0
- data/spec/vcr_cassettes/cpanel/password_strength/all_required_strengths.yml +43 -0
- data/spec/vcr_cassettes/cpanel/password_strength/required_strength.yml +43 -0
- data/spec/vcr_cassettes/cpanel/password_strength/strength.yml +83 -0
- data/spec/whm/account_spec.rb +69 -69
- data/spec/whm/base_spec.rb +3 -3
- data/spec/whm/cert_spec.rb +24 -24
- data/spec/whm/dns_spec.rb +36 -36
- data/spec/whm/reseller_spec.rb +36 -36
- data/spec/whm/server_spec.rb +22 -22
- data/spec/whm/whm_spec.rb +8 -8
- metadata +29 -2
data/spec/whm/base_spec.rb
CHANGED
@@ -4,9 +4,9 @@ require 'lumberg/whm'
|
|
4
4
|
module Lumberg
|
5
5
|
describe Whm::Base do
|
6
6
|
before(:each) do
|
7
|
-
@login = { :
|
7
|
+
@login = { host: @whm_host, hash: @whm_hash }
|
8
8
|
@server = Whm::Server.new(@login.dup)
|
9
|
-
@base = Whm::Base.new(:
|
9
|
+
@base = Whm::Base.new(server: @server)
|
10
10
|
end
|
11
11
|
|
12
12
|
describe "#initialize" do
|
@@ -15,7 +15,7 @@ module Lumberg
|
|
15
15
|
end
|
16
16
|
|
17
17
|
it "allows a server hash to be passed in" do
|
18
|
-
base = Whm::Base.new(:
|
18
|
+
base = Whm::Base.new(server: @login)
|
19
19
|
base.server.should be_a(Whm::Server)
|
20
20
|
end
|
21
21
|
end
|
data/spec/whm/cert_spec.rb
CHANGED
@@ -7,9 +7,9 @@ SELF_KEY = File.read('./spec/sample_certs/sample.key')
|
|
7
7
|
module Lumberg
|
8
8
|
describe Whm::Cert do
|
9
9
|
before(:each) do
|
10
|
-
@login = { :
|
10
|
+
@login = { host: @whm_host, hash: @whm_hash }
|
11
11
|
@server = Whm::Server.new(@login.dup)
|
12
|
-
@cert = Whm::Cert.new(:
|
12
|
+
@cert = Whm::Cert.new(server: @server.dup)
|
13
13
|
end
|
14
14
|
|
15
15
|
describe "#listcrts" do
|
@@ -26,7 +26,7 @@ module Lumberg
|
|
26
26
|
use_vcr_cassette "whm/cert/fetchsslinfo"
|
27
27
|
|
28
28
|
it "displays the SSL certificate, private key, and CA bundle/intermediate certificate associated with a specified domain" do
|
29
|
-
result = @cert.fetchsslinfo(:
|
29
|
+
result = @cert.fetchsslinfo(domain: "myhost.com", crtdata: CERT)
|
30
30
|
result[:success].should be_true
|
31
31
|
result[:message].should match("ok")
|
32
32
|
result[:params][:crt].should match(/.*BEGIN CERTIFICATE.*/)
|
@@ -40,16 +40,16 @@ module Lumberg
|
|
40
40
|
context "generating a new CSR" do
|
41
41
|
subject do
|
42
42
|
@cert.generatessl(
|
43
|
-
:
|
44
|
-
:
|
45
|
-
:
|
46
|
-
:
|
47
|
-
:
|
48
|
-
:
|
49
|
-
:
|
50
|
-
:
|
51
|
-
:
|
52
|
-
:
|
43
|
+
city: "houston",
|
44
|
+
host: "myhost.com",
|
45
|
+
country: "US",
|
46
|
+
state: "TX",
|
47
|
+
company: "Company",
|
48
|
+
company_division: "Dept",
|
49
|
+
email: "test@myhost.com",
|
50
|
+
pass: "abc123",
|
51
|
+
xemail: "",
|
52
|
+
noemail: 1
|
53
53
|
)
|
54
54
|
end
|
55
55
|
|
@@ -64,16 +64,16 @@ module Lumberg
|
|
64
64
|
context "generating a new CSR with an ampersand in company name" do
|
65
65
|
subject do
|
66
66
|
@cert.generatessl(
|
67
|
-
:
|
68
|
-
:
|
69
|
-
:
|
70
|
-
:
|
71
|
-
:
|
72
|
-
:
|
73
|
-
:
|
74
|
-
:
|
75
|
-
:
|
76
|
-
:
|
67
|
+
city: "houston",
|
68
|
+
host: "myhost.com",
|
69
|
+
country: "US",
|
70
|
+
state: "TX",
|
71
|
+
company: "Foo & Bar",
|
72
|
+
company_division: "Dept",
|
73
|
+
email: "test@myhost.com",
|
74
|
+
pass: "abc123",
|
75
|
+
xemail: "",
|
76
|
+
noemail: 1
|
77
77
|
)
|
78
78
|
end
|
79
79
|
|
@@ -90,7 +90,7 @@ module Lumberg
|
|
90
90
|
use_vcr_cassette "whm/cert/installssl"
|
91
91
|
|
92
92
|
it "installs a certificate" do
|
93
|
-
result = @cert.installssl(:
|
93
|
+
result = @cert.installssl(domain: 'check.com', user: "nobody", cert: SELF_CERT, key: SELF_KEY, ip: '192.1.2.3')
|
94
94
|
result[:success].should be_true
|
95
95
|
result[:message].should match(/Certificate successfully installed/)
|
96
96
|
end
|
data/spec/whm/dns_spec.rb
CHANGED
@@ -4,22 +4,22 @@ require 'lumberg/whm'
|
|
4
4
|
module Lumberg
|
5
5
|
describe Whm::Dns do
|
6
6
|
before(:each) do
|
7
|
-
@login = { :
|
7
|
+
@login = { host: @whm_host, hash: @whm_hash }
|
8
8
|
@server = Whm::Server.new(@login.dup)
|
9
|
-
@dns = Whm::Dns.new(:
|
9
|
+
@dns = Whm::Dns.new(server: @server.dup)
|
10
10
|
end
|
11
11
|
|
12
12
|
describe "#addzone" do
|
13
13
|
use_vcr_cassette "whm/dns/adddns"
|
14
14
|
|
15
15
|
it "creates a zone" do
|
16
|
-
result = @dns.add_zone(:
|
16
|
+
result = @dns.add_zone(domain: 'example.com', ip: '192.1.2.3')
|
17
17
|
result[:success].should be_true
|
18
18
|
result[:message].should match(/added example\.com .*user root.*/i)
|
19
19
|
end
|
20
20
|
|
21
21
|
it "creates a zone under a user" do
|
22
|
-
result = @dns.add_zone(:
|
22
|
+
result = @dns.add_zone(domain: 'example.com', ip: '192.1.2.3', trueowner: 'something')
|
23
23
|
result[:success].should be_true
|
24
24
|
result[:message].should match(/added example\.com .*user something.*/i)
|
25
25
|
end
|
@@ -29,19 +29,19 @@ module Lumberg
|
|
29
29
|
use_vcr_cassette "whm/dns/addzonerecord"
|
30
30
|
|
31
31
|
it "adds a zone record" do
|
32
|
-
result = @dns.add_zone_record(:
|
33
|
-
:
|
34
|
-
:
|
35
|
-
:
|
32
|
+
result = @dns.add_zone_record(zone: 'example.com',
|
33
|
+
name: 'example.com.',
|
34
|
+
address: '192.1.2.3',
|
35
|
+
type: 'A')
|
36
36
|
result[:success].should be_true
|
37
37
|
result[:message].should match(/Bind reloading on .*example.com/i)
|
38
38
|
end
|
39
39
|
|
40
40
|
it "adds a zone record reverse" do
|
41
|
-
result = @dns.add_zone_record(:
|
42
|
-
:
|
43
|
-
:
|
44
|
-
:
|
41
|
+
result = @dns.add_zone_record(zone: 'example.com',
|
42
|
+
name: '1',
|
43
|
+
ptdrname: 'example.com',
|
44
|
+
type: 'PTR')
|
45
45
|
result[:success].should be_true
|
46
46
|
result[:message].should match(/Bind reloading on .*example.com/i)
|
47
47
|
end
|
@@ -63,7 +63,7 @@ module Lumberg
|
|
63
63
|
use_vcr_cassette "whm/dns/getzonerecord"
|
64
64
|
|
65
65
|
it "returns the zone" do
|
66
|
-
result = @dns.get_zone_record(:
|
66
|
+
result = @dns.get_zone_record(domain: "example.com", Line: 1)
|
67
67
|
result[:success].should be_true
|
68
68
|
result[:message].should match(/Record obtained/i)
|
69
69
|
result[:params][:record][:Line].should == 1
|
@@ -71,13 +71,13 @@ module Lumberg
|
|
71
71
|
end
|
72
72
|
|
73
73
|
it "returns an error when the domain was not found" do
|
74
|
-
result = @dns.get_zone_record(:
|
74
|
+
result = @dns.get_zone_record(domain: "notexists.com", Line: 1)
|
75
75
|
result[:success].should_not be_true
|
76
76
|
result[:message].should match(/Zone does not exist/i)
|
77
77
|
end
|
78
78
|
|
79
79
|
it "returns an error for a line with no data" do
|
80
|
-
result = @dns.get_zone_record(:
|
80
|
+
result = @dns.get_zone_record(domain: "example.com", Line: 20)
|
81
81
|
result[:success].should be_false
|
82
82
|
result[:message].should match(/No record available on selected line/i)
|
83
83
|
end
|
@@ -87,7 +87,7 @@ module Lumberg
|
|
87
87
|
use_vcr_cassette "whm/dns/dumpzone"
|
88
88
|
|
89
89
|
it "dumps the zone" do
|
90
|
-
result = @dns.dump_zone(:
|
90
|
+
result = @dns.dump_zone(domain: "example.com")
|
91
91
|
result[:success].should be_true
|
92
92
|
result[:message].should match(/Zone Serialized/i)
|
93
93
|
result[:params][:record][0][:raw].should match(/; cPanel first:11\.25\.0-STABLE_44718 latest:11\.28\.64-STABLE_51024 Cpanel::ZoneFile::VERSION:1\.3 mtime:1299509628/i)
|
@@ -95,7 +95,7 @@ module Lumberg
|
|
95
95
|
end
|
96
96
|
|
97
97
|
it "returns an error when the domain is not found" do
|
98
|
-
result = @dns.dump_zone(:
|
98
|
+
result = @dns.dump_zone(domain: "notexists.com")
|
99
99
|
result[:success].should be_false
|
100
100
|
result[:message].should match(/Zone does not exist/i)
|
101
101
|
end
|
@@ -105,12 +105,12 @@ module Lumberg
|
|
105
105
|
use_vcr_cassette "whm/dns/resolvedomainname"
|
106
106
|
|
107
107
|
it "returns the ip address of the domain" do
|
108
|
-
result = @dns.resolve_domain(:
|
108
|
+
result = @dns.resolve_domain(domain: "example.com", "api.version".to_sym => 1)
|
109
109
|
result[:params][:ip].should == "192.1.2.3"
|
110
110
|
end
|
111
111
|
|
112
112
|
it "returns an error when the ip address cannot be determined" do
|
113
|
-
result = @dns.resolve_domain(:
|
113
|
+
result = @dns.resolve_domain(domain: "notexists.com", "api.version".to_sym => 1)
|
114
114
|
result[:params][:ip].should be_nil
|
115
115
|
result[:message].should match(/Unable to resolve domain name/i)
|
116
116
|
end
|
@@ -120,19 +120,19 @@ module Lumberg
|
|
120
120
|
use_vcr_cassette "whm/dns/editzonerecord"
|
121
121
|
|
122
122
|
it "updates the zone record" do
|
123
|
-
result = @dns.edit_zone_record(:
|
123
|
+
result = @dns.edit_zone_record(domain: "example.com", Line: 1, ttl: "86400")
|
124
124
|
result[:success].should be_true
|
125
125
|
result[:message].should match(/Bind reloading on .* using rndc zone.*example.com/i)
|
126
126
|
end
|
127
127
|
|
128
128
|
it "returns an error for an unknown domain or invalid Line" do
|
129
|
-
result = @dns.edit_zone_record(:
|
129
|
+
result = @dns.edit_zone_record(domain: "notexists.com", Line: 1, ttl: "86400")
|
130
130
|
result[:success].should be_false
|
131
131
|
result[:message].should match(/Failed to serialize record/i)
|
132
132
|
end
|
133
133
|
|
134
134
|
it "returns an error for an invalid Line" do
|
135
|
-
result = @dns.edit_zone_record(:
|
135
|
+
result = @dns.edit_zone_record(domain: "example.com", Line: 200, ttl: "86400")
|
136
136
|
result[:success].should be_false
|
137
137
|
result[:message].should match(/Failed to serialize record/i)
|
138
138
|
end
|
@@ -142,13 +142,13 @@ module Lumberg
|
|
142
142
|
use_vcr_cassette "whm/dns/killdns"
|
143
143
|
|
144
144
|
it "kills the dns" do
|
145
|
-
result = @dns.kill_dns(:
|
145
|
+
result = @dns.kill_dns(domain: "example.com")
|
146
146
|
result[:success].should be_true
|
147
147
|
result[:message].should match(/Zones Removed/i)
|
148
148
|
end
|
149
149
|
|
150
150
|
it "returns an error when the domain does not exist" do
|
151
|
-
result = @dns.kill_dns(:
|
151
|
+
result = @dns.kill_dns(domain: "notexists.com")
|
152
152
|
result[:success].should be_false
|
153
153
|
result[:message].should match(/Unable to remove zone that does not exist/i)
|
154
154
|
end
|
@@ -158,12 +158,12 @@ module Lumberg
|
|
158
158
|
use_vcr_cassette "whm/dns/lookupnsip"
|
159
159
|
|
160
160
|
it "returns the nameserver's ip" do
|
161
|
-
result = @dns.lookup_nameserver_ip(:
|
161
|
+
result = @dns.lookup_nameserver_ip(nameserver: "example.com")
|
162
162
|
result[:params][:ip].should == "192.1.2.3"
|
163
163
|
end
|
164
164
|
|
165
165
|
it "returns null if the ip cannot be determined" do
|
166
|
-
result = @dns.lookup_nameserver_ip(:
|
166
|
+
result = @dns.lookup_nameserver_ip(nameserver: "notexists.com")
|
167
167
|
result[:params][:ip].should be_nil
|
168
168
|
end
|
169
169
|
end
|
@@ -172,19 +172,19 @@ module Lumberg
|
|
172
172
|
use_vcr_cassette "whm/dns/removezonerecord"
|
173
173
|
|
174
174
|
it "removes the zone record" do
|
175
|
-
result = @dns.remove_zone_record(:
|
175
|
+
result = @dns.remove_zone_record(zone: "example.com", Line: 1)
|
176
176
|
result[:success].should be_true
|
177
177
|
result[:message].should match(/Bind reloading on .*example.com/i)
|
178
178
|
end
|
179
179
|
|
180
180
|
it "returns an error for an unknown zone " do
|
181
|
-
result = @dns.remove_zone_record(:
|
181
|
+
result = @dns.remove_zone_record(zone: "notexists.com", Line: 1)
|
182
182
|
result[:success].should be_false
|
183
183
|
result[:message].should match(/Unable to find a record on specified line/i)
|
184
184
|
end
|
185
185
|
|
186
186
|
it "returns an error for an invalid line" do
|
187
|
-
result = @dns.remove_zone_record(:
|
187
|
+
result = @dns.remove_zone_record(zone: "example.com", Line: 200)
|
188
188
|
result[:success].should be_false
|
189
189
|
result[:message].should match(/Unable to find a record on specified line/i)
|
190
190
|
end
|
@@ -194,13 +194,13 @@ module Lumberg
|
|
194
194
|
use_vcr_cassette "whm/dns/resetzone"
|
195
195
|
|
196
196
|
it "resets the zone" do
|
197
|
-
result = @dns.reset_zone(:
|
197
|
+
result = @dns.reset_zone(domain: "example.com", zone: "example.com")
|
198
198
|
result[:success].should be_true
|
199
199
|
result[:message].should match(/Bind reloading on .*example.com/i)
|
200
200
|
end
|
201
201
|
|
202
202
|
it "returns an error for an unknown domain" do
|
203
|
-
result = @dns.reset_zone(:
|
203
|
+
result = @dns.reset_zone(domain: "notexists.com", zone: "notexists.com")
|
204
204
|
result[:success].should be_false
|
205
205
|
result[:message].should match(/Unable to determine the IP address for notexists.com/i)
|
206
206
|
end
|
@@ -210,7 +210,7 @@ module Lumberg
|
|
210
210
|
use_vcr_cassette "whm/dns/listmxs"
|
211
211
|
|
212
212
|
it "returns a list of mxs" do
|
213
|
-
result = @dns.list_mxs(:
|
213
|
+
result = @dns.list_mxs(domain: "example.com", "api.version".to_sym => 1)
|
214
214
|
result[:params][:record].should be_a_kind_of Array
|
215
215
|
result[:params][:record].size.should == 1
|
216
216
|
result[:params][:record].first[:exchange].should == "example.com"
|
@@ -223,10 +223,10 @@ module Lumberg
|
|
223
223
|
|
224
224
|
it "saves the mx record" do
|
225
225
|
result = @dns.save_mx("api.version".to_sym => 1,
|
226
|
-
:
|
227
|
-
:
|
228
|
-
:
|
229
|
-
:
|
226
|
+
domain: "example.com",
|
227
|
+
name: "mail.example.com",
|
228
|
+
exchange: "example.com",
|
229
|
+
preference: 10)
|
230
230
|
result[:message].should match(/Bind reloading on .*example.com/i)
|
231
231
|
end
|
232
232
|
end
|
data/spec/whm/reseller_spec.rb
CHANGED
@@ -3,28 +3,28 @@ require 'spec_helper'
|
|
3
3
|
module Lumberg
|
4
4
|
describe Whm::Reseller do
|
5
5
|
before(:each) do
|
6
|
-
@login = { :
|
6
|
+
@login = { host: @whm_host, hash: @whm_hash }
|
7
7
|
@whm = Whm::Server.new(@login.dup)
|
8
|
-
@reseller = Whm::Reseller.new(:
|
8
|
+
@reseller = Whm::Reseller.new(server: @whm)
|
9
9
|
end
|
10
10
|
|
11
11
|
describe "#setup_reseller" do
|
12
12
|
use_vcr_cassette "whm/reseller/setupreseller"
|
13
13
|
|
14
14
|
it "fails when the user doesn't exist" do
|
15
|
-
result = @reseller.create(:
|
15
|
+
result = @reseller.create(username: 'invalid')
|
16
16
|
result[:success].should be_false
|
17
17
|
result[:message].should match(/does not exist/i)
|
18
18
|
end
|
19
19
|
|
20
20
|
it "creates a reseller" do
|
21
|
-
result = @reseller.create(:
|
21
|
+
result = @reseller.create(username: 'bob')
|
22
22
|
result[:success].should be_true
|
23
23
|
end
|
24
24
|
|
25
25
|
it "accepts makeowner option" do
|
26
|
-
@reseller.server.should_receive(:perform_request).with('setupreseller', hash_including(:
|
27
|
-
@reseller.create(:
|
26
|
+
@reseller.server.should_receive(:perform_request).with('setupreseller', hash_including(makeowner: true))
|
27
|
+
@reseller.create(username: 'bob', makeowner: true)
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
@@ -43,12 +43,12 @@ module Lumberg
|
|
43
43
|
use_vcr_cassette "whm/reseller/setresellerips"
|
44
44
|
|
45
45
|
it "adds the ip address to the reseller account" do
|
46
|
-
result = @reseller.add_ips(:
|
46
|
+
result = @reseller.add_ips(username: 'bob', ips:'192.1.2.3')
|
47
47
|
result[:message].should match(/Successfully configured IP addresses delegation to reseller/i)
|
48
48
|
end
|
49
49
|
|
50
50
|
it "returns an error for invalid ip addresses" do
|
51
|
-
result = @reseller.add_ips(:
|
51
|
+
result = @reseller.add_ips(username: 'bob', ips:'1.2.3.4')
|
52
52
|
result[:message].should match(/The list of supplied IP addresses contains inappropriate values/i)
|
53
53
|
end
|
54
54
|
end
|
@@ -57,8 +57,8 @@ module Lumberg
|
|
57
57
|
use_vcr_cassette "whm/reseller/setresellerlimits"
|
58
58
|
|
59
59
|
it "sets the limits" do
|
60
|
-
result = @reseller.set_limits(:
|
61
|
-
:
|
60
|
+
result = @reseller.set_limits(username: 'bob', diskspace_limit: 1024, enable_overselling: true,
|
61
|
+
enable_overselling_diskspace: true)
|
62
62
|
result[:success].should be_true
|
63
63
|
result[:message].should match(/Successfully set reseller account .*limits/i)
|
64
64
|
end
|
@@ -68,21 +68,21 @@ module Lumberg
|
|
68
68
|
use_vcr_cassette "whm/reseller/terminatereseller"
|
69
69
|
|
70
70
|
it "terminates the reseller" do
|
71
|
-
result = @reseller.terminate(:
|
71
|
+
result = @reseller.terminate(reseller: 'terminat')
|
72
72
|
result[:success].should be_true
|
73
73
|
result[:message].should match(/account terminations complete/i)
|
74
74
|
result[:params][:accts].should be_empty
|
75
75
|
end
|
76
76
|
|
77
77
|
it "terminates the main account" do
|
78
|
-
result = @reseller.terminate(:
|
78
|
+
result = @reseller.terminate(reseller: 'terminat', terminatereseller: true)
|
79
79
|
result[:success].should be_true
|
80
80
|
result[:message].should match(/account terminations complete/i)
|
81
81
|
result[:params][:accts][:terminat][:rawout].should match(/Account Removal Complete/i)
|
82
82
|
end
|
83
83
|
|
84
84
|
it "errors on non-existaet user" do
|
85
|
-
result = @reseller.terminate(:
|
85
|
+
result = @reseller.terminate(reseller: 'what')
|
86
86
|
result[:success].should be_false
|
87
87
|
result[:message].should match(/does not exist/i)
|
88
88
|
end
|
@@ -93,19 +93,19 @@ module Lumberg
|
|
93
93
|
use_vcr_cassette "whm/reseller/setresellermainip"
|
94
94
|
|
95
95
|
it "sets the main ip" do
|
96
|
-
result = @reseller.set_main_ip(:
|
96
|
+
result = @reseller.set_main_ip(username: 'bob', ip: '192.1.2.3')
|
97
97
|
result[:success].should be_true
|
98
98
|
result[:message].should match(/Successfully set main IP address of the reseller/i)
|
99
99
|
end
|
100
100
|
|
101
101
|
it "returns an error when the IP is invalid" do
|
102
|
-
result = @reseller.set_main_ip(:
|
102
|
+
result = @reseller.set_main_ip(username: 'bob', ip: '10')
|
103
103
|
result[:success].should be_false
|
104
104
|
result[:message].should match(/Supplied IP address is invalid/)
|
105
105
|
end
|
106
106
|
|
107
107
|
it "returns an error when the user is invalid" do
|
108
|
-
result = @reseller.set_main_ip(:
|
108
|
+
result = @reseller.set_main_ip(username: 'notexists', ip: '192.1.2.3')
|
109
109
|
result[:success].should be_false
|
110
110
|
result[:message].should match(/Specified user is not a reseller/i)
|
111
111
|
end
|
@@ -115,13 +115,13 @@ module Lumberg
|
|
115
115
|
use_vcr_cassette "whm/reseller/setresellerpackagelimit"
|
116
116
|
|
117
117
|
it "sets the package limit" do
|
118
|
-
result = @reseller.set_package_limit(:
|
118
|
+
result = @reseller.set_package_limit(username: 'bob', no_limit: false, package: 'gold', allowed: true)
|
119
119
|
result[:success].should be_true
|
120
120
|
result[:message].should match(/Successfully set reseller package limit/i)
|
121
121
|
end
|
122
122
|
|
123
123
|
it "sets no limit" do
|
124
|
-
result = @reseller.set_package_limit(:
|
124
|
+
result = @reseller.set_package_limit(username: 'bob', no_limit: true, package: 'gold')
|
125
125
|
result[:success].should be_true
|
126
126
|
result[:message].should match(/Successfully set reseller package limit/i)
|
127
127
|
end
|
@@ -131,19 +131,19 @@ module Lumberg
|
|
131
131
|
use_vcr_cassette "whm/reseller/suspendreseller"
|
132
132
|
|
133
133
|
it "suspends the reseller" do
|
134
|
-
result = @reseller.suspend(:
|
134
|
+
result = @reseller.suspend(username: 'bob')
|
135
135
|
result[:success].should be_true
|
136
136
|
result[:message].should match(/Finished suspending reseller/i)
|
137
137
|
end
|
138
138
|
|
139
139
|
it "can take a reason" do
|
140
|
-
result = @reseller.suspend(:
|
140
|
+
result = @reseller.suspend(username: 'bob', reason: 'some reason')
|
141
141
|
result[:success].should be_true
|
142
142
|
result[:message].should match(/Finished suspending reseller/i)
|
143
143
|
end
|
144
144
|
|
145
145
|
it "returns an error when the user is invalid" do
|
146
|
-
result = @reseller.suspend(:
|
146
|
+
result = @reseller.suspend(username: 'notexists')
|
147
147
|
result[:success].should be_false
|
148
148
|
result[:message].should match(/Specified user is not a reseller/i)
|
149
149
|
end
|
@@ -153,13 +153,13 @@ module Lumberg
|
|
153
153
|
use_vcr_cassette "whm/reseller/unsuspendreseller"
|
154
154
|
|
155
155
|
it "should unsuspend the user" do
|
156
|
-
result = @reseller.unsuspend(:
|
156
|
+
result = @reseller.unsuspend(username: 'bob')
|
157
157
|
result[:success].should be_true
|
158
158
|
result[:message].should match(/Finished unsuspending reseller/i)
|
159
159
|
end
|
160
160
|
|
161
161
|
it "return an error when the user is invalid" do
|
162
|
-
result = @reseller.unsuspend(:
|
162
|
+
result = @reseller.unsuspend(username: 'notexists')
|
163
163
|
result[:success].should be_false
|
164
164
|
result[:message].should match(/Specified user is not a reseller/i)
|
165
165
|
end
|
@@ -169,7 +169,7 @@ module Lumberg
|
|
169
169
|
use_vcr_cassette "whm/reseller/acctcounts"
|
170
170
|
|
171
171
|
it "returns the account counts" do
|
172
|
-
result = @reseller.account_counts(:
|
172
|
+
result = @reseller.account_counts(username: 'bob')
|
173
173
|
result[:success].should be_true
|
174
174
|
result[:message].should match(/Obtained reseller account counts/i)
|
175
175
|
result[:params][:account].should == "bob"
|
@@ -179,7 +179,7 @@ module Lumberg
|
|
179
179
|
end
|
180
180
|
|
181
181
|
it "returns an error when the user is invalid" do
|
182
|
-
result = @reseller.account_counts(:
|
182
|
+
result = @reseller.account_counts(username: 'notexists')
|
183
183
|
result[:success].should be_false
|
184
184
|
result[:message].should match(/Specified user is not a reseller/i)
|
185
185
|
end
|
@@ -189,19 +189,19 @@ module Lumberg
|
|
189
189
|
use_vcr_cassette "whm/reseller/setresellernameservers"
|
190
190
|
|
191
191
|
it "sets the default nameservers" do
|
192
|
-
result = @reseller.set_nameservers(:
|
192
|
+
result = @reseller.set_nameservers(username: 'bob')
|
193
193
|
result[:success].should be_true
|
194
194
|
result[:message].should match(/Set resellers nameservers/i)
|
195
195
|
end
|
196
196
|
|
197
197
|
it "sets the specified nameservers" do
|
198
|
-
result = @reseller.set_nameservers(:
|
198
|
+
result = @reseller.set_nameservers(username: 'bob', nameservers: 'ns1.example.com')
|
199
199
|
result[:success].should be_true
|
200
200
|
result[:message].should match(/Set resellers nameservers/i)
|
201
201
|
end
|
202
202
|
|
203
203
|
it "returns an error for an invalid username" do
|
204
|
-
result = @reseller.account_counts(:
|
204
|
+
result = @reseller.account_counts(username: 'notexists')
|
205
205
|
result[:success].should be_false
|
206
206
|
result[:message].should match(/Specified user is not a reseller/i)
|
207
207
|
end
|
@@ -211,7 +211,7 @@ module Lumberg
|
|
211
211
|
use_vcr_cassette "whm/reseller/resellerstats"
|
212
212
|
|
213
213
|
it "returns the stats of the reseller" do
|
214
|
-
result = @reseller.stats(:
|
214
|
+
result = @reseller.stats(reseller: 'bob')
|
215
215
|
result[:success].should be_true
|
216
216
|
result[:message].should match(/Fetched Reseller Data OK/i)
|
217
217
|
result[:params][:diskquota].to_i.should == 0
|
@@ -220,7 +220,7 @@ module Lumberg
|
|
220
220
|
end
|
221
221
|
|
222
222
|
it "returns an error for an invalid reseller" do
|
223
|
-
result = @reseller.stats(:
|
223
|
+
result = @reseller.stats(reseller: 'notexists')
|
224
224
|
result[:success].should be_false
|
225
225
|
result[:message].should match(/Reseller Does Not Exist/i)
|
226
226
|
end
|
@@ -242,13 +242,13 @@ module Lumberg
|
|
242
242
|
use_vcr_cassette "whm/reseller/saveacllist"
|
243
243
|
|
244
244
|
it "creates a new reseller ACL list" do
|
245
|
-
result = @reseller.save_acl_list(:
|
245
|
+
result = @reseller.save_acl_list(acllist: 'testacllist')
|
246
246
|
result[:success].should be_true
|
247
247
|
result[:message].should match(/ACL List testacllist saved/i)
|
248
248
|
end
|
249
249
|
|
250
250
|
it "creates a new reseller ACL list with optional settings" do
|
251
|
-
result = @reseller.save_acl_list(:
|
251
|
+
result = @reseller.save_acl_list(acllist: 'testacllist',
|
252
252
|
"acl-ssl".to_sym => true,
|
253
253
|
"acl-add-pkg".to_sym => true,
|
254
254
|
"acl-stats".to_sym => true)
|
@@ -261,13 +261,13 @@ module Lumberg
|
|
261
261
|
use_vcr_cassette "whm/reseller/setacls"
|
262
262
|
|
263
263
|
it "sets the ACL for the reseller" do
|
264
|
-
result = @reseller.set_acls(:
|
264
|
+
result = @reseller.set_acls(reseller: 'bob', acllist: 'testacllist')
|
265
265
|
result[:success].should be_true
|
266
266
|
result[:message].should match(/Reseller Acls Saved/i)
|
267
267
|
end
|
268
268
|
|
269
269
|
it "returns an error for an invalid reseller" do
|
270
|
-
result = @reseller.set_acls(:
|
270
|
+
result = @reseller.set_acls(reseller: 'notexists')
|
271
271
|
result[:success].should be_false
|
272
272
|
result[:message].should match(/Not a reseller/i)
|
273
273
|
end
|
@@ -277,12 +277,12 @@ module Lumberg
|
|
277
277
|
use_vcr_cassette "whm/reseller/unsetupreseller"
|
278
278
|
|
279
279
|
it "removes the reseller status from the user" do
|
280
|
-
result = @reseller.unsetup(:
|
280
|
+
result = @reseller.unsetup(username: 'bob')
|
281
281
|
result[:success].should be_true
|
282
282
|
end
|
283
283
|
|
284
284
|
it "returns an error if the user does not exist" do
|
285
|
-
result = @reseller.unsetup(:
|
285
|
+
result = @reseller.unsetup(username: 'notexists')
|
286
286
|
result[:success].should be_false
|
287
287
|
result[:message].should match(/called for a user that does not exist/i)
|
288
288
|
end
|