lumberg 1.0.1 → 2.0.0.pre4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.travis.yml +8 -7
- data/LICENSE +1 -1
- data/README.md +130 -23
- data/Rakefile +3 -1
- data/lib/lumberg/config.rb +19 -0
- data/lib/lumberg/cpanel/addon_domain.rb +50 -0
- data/lib/lumberg/cpanel/backups.rb +16 -0
- data/lib/lumberg/cpanel/base.rb +56 -0
- data/lib/lumberg/cpanel/box_trapper.rb +18 -0
- data/lib/lumberg/cpanel/branding.rb +89 -0
- data/lib/lumberg/cpanel/contact.rb +38 -0
- data/lib/lumberg/cpanel/cron.rb +89 -0
- data/lib/lumberg/cpanel/dns_lookup.rb +23 -0
- data/lib/lumberg/cpanel/domain_keys.rb +37 -0
- data/lib/lumberg/cpanel/domain_lookup.rb +71 -0
- data/lib/lumberg/cpanel/email.rb +491 -0
- data/lib/lumberg/cpanel/file_manager.rb +146 -0
- data/lib/lumberg/cpanel/gpg.rb +36 -0
- data/lib/lumberg/cpanel/locale.rb +15 -0
- data/lib/lumberg/cpanel/mime.rb +34 -0
- data/lib/lumberg/cpanel/mysql.rb +66 -0
- data/lib/lumberg/cpanel/net.rb +28 -0
- data/lib/lumberg/cpanel/park.rb +58 -0
- data/lib/lumberg/cpanel/password.rb +52 -0
- data/lib/lumberg/cpanel/random_data.rb +25 -0
- data/lib/lumberg/cpanel/redirect.rb +44 -0
- data/lib/lumberg/cpanel/ssl.rb +206 -0
- data/lib/lumberg/cpanel/sub_domain.rb +61 -0
- data/lib/lumberg/cpanel/support.rb +29 -0
- data/lib/lumberg/cpanel/zone_edit.rb +134 -0
- data/lib/lumberg/cpanel.rb +29 -0
- data/lib/lumberg/format_whm.rb +125 -0
- data/lib/lumberg/version.rb +1 -1
- data/lib/lumberg/whm/account.rb +28 -105
- data/lib/lumberg/whm/base.rb +3 -7
- data/lib/lumberg/whm/cert.rb +76 -0
- data/lib/lumberg/whm/dns.rb +49 -77
- data/lib/lumberg/whm/reseller.rb +24 -117
- data/lib/lumberg/whm/server.rb +111 -230
- data/lib/lumberg/whm.rb +2 -1
- data/lib/lumberg.rb +34 -8
- data/lumberg.gemspec +7 -4
- data/spec/config_spec.rb +28 -0
- data/spec/cpanel/addon_domain_spec.rb +84 -0
- data/spec/cpanel/backups_spec.rb +22 -0
- data/spec/cpanel/base_spec.rb +128 -0
- data/spec/cpanel/box_trapper_spec.rb +22 -0
- data/spec/cpanel/branding_spec.rb +46 -0
- data/spec/cpanel/contact_spec.rb +50 -0
- data/spec/cpanel/cron_spec.rb +161 -0
- data/spec/cpanel/dns_lookup_spec.rb +22 -0
- data/spec/cpanel/domain_keys_spec.rb +46 -0
- data/spec/cpanel/domain_lookup_spec.rb +77 -0
- data/spec/cpanel/email_spec.rb +615 -0
- data/spec/cpanel/file_manager_spec.rb +73 -0
- data/spec/cpanel/gpg_spec.rb +48 -0
- data/spec/cpanel/locale_spec.rb +23 -0
- data/spec/cpanel/mime_spec.rb +0 -0
- data/spec/cpanel/mysql_spec.rb +0 -0
- data/spec/cpanel/net_spec.rb +30 -0
- data/spec/cpanel/park_spec.rb +94 -0
- data/spec/cpanel/password_spec.rb +35 -0
- data/spec/cpanel/random_data_spec.rb +24 -0
- data/spec/cpanel/redirect_spec.rb +0 -0
- data/spec/cpanel/ssl_spec.rb +148 -0
- data/spec/cpanel/sub_domain_spec.rb +72 -0
- data/spec/cpanel/support_spec.rb +38 -0
- data/spec/cpanel/zone_edit_spec.rb +0 -0
- data/spec/sample_certs/cpanel.crt +28 -0
- data/spec/sample_certs/cpanel.key +28 -0
- data/spec/sample_certs/main.crt +27 -0
- data/spec/sample_certs/sample.crt +26 -0
- data/spec/sample_certs/sample.key +27 -0
- data/spec/spec_helper.rb +9 -3
- data/spec/support/cpanel_matchers.rb +17 -0
- data/spec/vcr_cassettes/cpanel/addon_domain/add.yml +77 -0
- data/spec/vcr_cassettes/cpanel/addon_domain/list.yml +77 -0
- data/spec/vcr_cassettes/cpanel/addon_domain/remove.yml +77 -0
- data/spec/vcr_cassettes/cpanel/backups/list.yml +40 -0
- data/spec/vcr_cassettes/cpanel/box_trapper/list.yml +40 -0
- data/spec/vcr_cassettes/cpanel/branding/list_icons.yml +40 -0
- data/spec/vcr_cassettes/cpanel/branding/list_image_types.yml +40 -0
- data/spec/vcr_cassettes/cpanel/branding/list_object_types.yml +40 -0
- data/spec/vcr_cassettes/cpanel/branding/list_pkgs.yml +40 -0
- data/spec/vcr_cassettes/cpanel/branding/list_sprites.yml +40 -0
- data/spec/vcr_cassettes/cpanel/contact/show.yml +40 -0
- data/spec/vcr_cassettes/cpanel/contact/update.yml +40 -0
- data/spec/vcr_cassettes/cpanel/cron/add.yml +77 -0
- data/spec/vcr_cassettes/cpanel/cron/edit.yml +114 -0
- data/spec/vcr_cassettes/cpanel/cron/email.yml +77 -0
- data/spec/vcr_cassettes/cpanel/cron/list.yml +77 -0
- data/spec/vcr_cassettes/cpanel/cron/remove.yml +151 -0
- data/spec/vcr_cassettes/cpanel/cron/set_email.yml +77 -0
- data/spec/vcr_cassettes/cpanel/dns_lookup/name_to_ip.yml +40 -0
- data/spec/vcr_cassettes/cpanel/domain_keys/add.yml +40 -0
- data/spec/vcr_cassettes/cpanel/domain_keys/available.yml +40 -0
- data/spec/vcr_cassettes/cpanel/domain_keys/installed.yml +40 -0
- data/spec/vcr_cassettes/cpanel/domain_keys/remove.yml +40 -0
- data/spec/vcr_cassettes/cpanel/domain_lookup/count.yml +40 -0
- data/spec/vcr_cassettes/cpanel/domain_lookup/docroot.yml +40 -0
- data/spec/vcr_cassettes/cpanel/domain_lookup/docroots.yml +40 -0
- data/spec/vcr_cassettes/cpanel/domain_lookup/document_root.yml +40 -0
- data/spec/vcr_cassettes/cpanel/domain_lookup/document_roots.yml +40 -0
- data/spec/vcr_cassettes/cpanel/domain_lookup/list.yml +40 -0
- data/spec/vcr_cassettes/cpanel/email/acceptable_encodings.yml +40 -0
- data/spec/vcr_cassettes/cpanel/email/accounts.yml +188 -0
- data/spec/vcr_cassettes/cpanel/email/add_account.yml +77 -0
- data/spec/vcr_cassettes/cpanel/email/add_filter.yml +77 -0
- data/spec/vcr_cassettes/cpanel/email/add_forwarder.yml +77 -0
- data/spec/vcr_cassettes/cpanel/email/add_mailing_list.yml +73 -0
- data/spec/vcr_cassettes/cpanel/email/add_mx.yml +40 -0
- data/spec/vcr_cassettes/cpanel/email/change_mx.yml +40 -0
- data/spec/vcr_cassettes/cpanel/email/check_local_delivery_local.yml +77 -0
- data/spec/vcr_cassettes/cpanel/email/check_local_delivery_remote.yml +77 -0
- data/spec/vcr_cassettes/cpanel/email/default_address.yml +40 -0
- data/spec/vcr_cassettes/cpanel/email/delete_mx.yml +40 -0
- data/spec/vcr_cassettes/cpanel/email/disk_usage.yml +77 -0
- data/spec/vcr_cassettes/cpanel/email/domains.yml +40 -0
- data/spec/vcr_cassettes/cpanel/email/domains_with_aliases.yml +77 -0
- data/spec/vcr_cassettes/cpanel/email/edit_quota.yml +112 -0
- data/spec/vcr_cassettes/cpanel/email/filters.yml +114 -0
- data/spec/vcr_cassettes/cpanel/email/forwarders.yml +77 -0
- data/spec/vcr_cassettes/cpanel/email/mail_dir.yml +77 -0
- data/spec/vcr_cassettes/cpanel/email/mail_dirs.yml +77 -0
- data/spec/vcr_cassettes/cpanel/email/mailing_lists.yml +73 -0
- data/spec/vcr_cassettes/cpanel/email/main_discard.yml +40 -0
- data/spec/vcr_cassettes/cpanel/email/mx.yml +40 -0
- data/spec/vcr_cassettes/cpanel/email/remove.yml +77 -0
- data/spec/vcr_cassettes/cpanel/email/set_mail_delivery_local.yml +77 -0
- data/spec/vcr_cassettes/cpanel/email/set_mail_delivery_remote.yml +77 -0
- data/spec/vcr_cassettes/cpanel/email/set_mx_type.yml +40 -0
- data/spec/vcr_cassettes/cpanel/file_manager/disk_usage.yml +38 -0
- data/spec/vcr_cassettes/cpanel/file_manager/list.yml +38 -0
- data/spec/vcr_cassettes/cpanel/file_manager/operate.yml +77 -0
- data/spec/vcr_cassettes/cpanel/file_manager/show.yml +40 -0
- data/spec/vcr_cassettes/cpanel/file_manager/stat.yml +38 -0
- data/spec/vcr_cassettes/cpanel/gpg/count.yml +40 -0
- data/spec/vcr_cassettes/cpanel/gpg/count_private.yml +40 -0
- data/spec/vcr_cassettes/cpanel/gpg/list.yml +40 -0
- data/spec/vcr_cassettes/cpanel/gpg/list_private.yml +40 -0
- data/spec/vcr_cassettes/cpanel/locale/show.yml +40 -0
- data/spec/vcr_cassettes/cpanel/net/query_hostname.yml +40 -0
- data/spec/vcr_cassettes/cpanel/net/traceroute.yml +40 -0
- data/spec/vcr_cassettes/cpanel/park/add.yml +77 -0
- data/spec/vcr_cassettes/cpanel/park/list.yml +77 -0
- data/spec/vcr_cassettes/cpanel/park/list_addon_domains.yml +77 -0
- data/spec/vcr_cassettes/cpanel/park/remove.yml +77 -0
- data/spec/vcr_cassettes/cpanel/password/digest_authentication.yml +77 -0
- data/spec/vcr_cassettes/cpanel/password/modify.yml +77 -0
- data/spec/vcr_cassettes/cpanel/random_data/show.yml +40 -0
- data/spec/vcr_cassettes/cpanel/ssl/fetchcabundle.yml +40 -0
- data/spec/vcr_cassettes/cpanel/ssl/gencrt.yml +43 -0
- data/spec/vcr_cassettes/cpanel/ssl/gencsr.yml +43 -0
- data/spec/vcr_cassettes/cpanel/ssl/genkey.yml +40 -0
- data/spec/vcr_cassettes/cpanel/ssl/installssl.yml +40 -0
- data/spec/vcr_cassettes/cpanel/ssl/listcrts.yml +40 -0
- data/spec/vcr_cassettes/cpanel/ssl/listcsrs.yml +40 -0
- data/spec/vcr_cassettes/cpanel/ssl/listkeys.yml +40 -0
- data/spec/vcr_cassettes/cpanel/ssl/listsslitems.yml +40 -0
- data/spec/vcr_cassettes/cpanel/ssl/showcrt.yml +38 -0
- data/spec/vcr_cassettes/cpanel/ssl/showcsr.yml +38 -0
- data/spec/vcr_cassettes/cpanel/ssl/showkey.yml +38 -0
- data/spec/vcr_cassettes/cpanel/ssl/uploadcrt.yml +40 -0
- data/spec/vcr_cassettes/cpanel/sub_domain/add.yml +77 -0
- data/spec/vcr_cassettes/cpanel/sub_domain/list.yml +77 -0
- data/spec/vcr_cassettes/cpanel/sub_domain/remove.yml +77 -0
- data/spec/vcr_cassettes/cpanel/support/contactable.yml +40 -0
- data/spec/vcr_cassettes/whm/account/accountsummary.yml +41 -29
- data/spec/vcr_cassettes/whm/account/changepackage.yml +73 -43
- data/spec/vcr_cassettes/whm/account/createacct.yml +101 -31
- data/spec/vcr_cassettes/whm/account/domainuserdata.yml +43 -29
- data/spec/vcr_cassettes/whm/account/editquota.yml +78 -57
- data/spec/vcr_cassettes/whm/account/limitbw.yml +79 -57
- data/spec/vcr_cassettes/whm/account/listaccts.yml +195 -100
- data/spec/vcr_cassettes/whm/account/listsuspended.yml +41 -29
- data/spec/vcr_cassettes/whm/account/modifyacct.yml +61 -42
- data/spec/vcr_cassettes/whm/account/myprivs.yml +41 -29
- data/spec/vcr_cassettes/whm/account/passwd.yml +44 -29
- data/spec/vcr_cassettes/whm/account/removeacct.yml +134 -57
- data/spec/vcr_cassettes/whm/account/restoreaccount.yml +310 -135
- data/spec/vcr_cassettes/whm/account/setsiteip.yml +166 -127
- data/spec/vcr_cassettes/whm/account/suspend.yml +75 -43
- data/spec/vcr_cassettes/whm/account/unsuspend.yml +46 -29
- data/spec/vcr_cassettes/whm/cert/fetchsslinfo.yml +38 -0
- data/spec/vcr_cassettes/whm/cert/generatessl.yml +94 -0
- data/spec/vcr_cassettes/whm/cert/installssl.yml +38 -0
- data/spec/vcr_cassettes/whm/cert/listcrts.yml +38 -0
- data/spec/vcr_cassettes/whm/dns/adddns.yml +61 -43
- data/spec/vcr_cassettes/whm/dns/addzonerecord.yml +42 -29
- data/spec/vcr_cassettes/whm/dns/dumpzone.yml +44 -29
- data/spec/vcr_cassettes/whm/dns/editzonerecord.yml +61 -43
- data/spec/vcr_cassettes/whm/dns/getzonerecord.yml +60 -43
- data/spec/vcr_cassettes/whm/dns/killdns.yml +42 -29
- data/spec/vcr_cassettes/whm/dns/listmxs.yml +23 -15
- data/spec/vcr_cassettes/whm/dns/listzones.yml +22 -15
- data/spec/vcr_cassettes/whm/dns/lookupnsip.yml +40 -29
- data/spec/vcr_cassettes/whm/dns/removezonerecord.yml +61 -43
- data/spec/vcr_cassettes/whm/dns/resetzone.yml +42 -29
- data/spec/vcr_cassettes/whm/dns/resolvedomainname.yml +40 -29
- data/spec/vcr_cassettes/whm/dns/savemxs.yml +23 -15
- data/spec/vcr_cassettes/whm/reseller/acctcounts.yml +41 -29
- data/spec/vcr_cassettes/whm/reseller/listacls.yml +22 -15
- data/spec/vcr_cassettes/whm/reseller/listresellers.yml +22 -15
- data/spec/vcr_cassettes/whm/reseller/resellerstats.yml +42 -29
- data/spec/vcr_cassettes/whm/reseller/saveacllist.yml +76 -57
- data/spec/vcr_cassettes/whm/reseller/setacls.yml +40 -29
- data/spec/vcr_cassettes/whm/reseller/setresellerips.yml +42 -28
- data/spec/vcr_cassettes/whm/reseller/setresellerlimits.yml +41 -29
- data/spec/vcr_cassettes/whm/reseller/setresellermainip.yml +59 -43
- data/spec/vcr_cassettes/whm/reseller/setresellernameservers.yml +58 -43
- data/spec/vcr_cassettes/whm/reseller/setresellerpackagelimit.yml +61 -43
- data/spec/vcr_cassettes/whm/reseller/setupreseller.yml +41 -29
- data/spec/vcr_cassettes/whm/reseller/suspendreseller.yml +75 -44
- data/spec/vcr_cassettes/whm/reseller/terminatereseller.yml +83 -46
- data/spec/vcr_cassettes/whm/reseller/unsetupreseller.yml +41 -29
- data/spec/vcr_cassettes/whm/reseller/unsuspendreseller.yml +46 -29
- data/spec/vcr_cassettes/whm/server/addip.yml +24 -15
- data/spec/vcr_cassettes/whm/server/applist.yml +22 -15
- data/spec/vcr_cassettes/whm/server/delip.yml +23 -15
- data/spec/vcr_cassettes/whm/server/gethostname.yml +22 -15
- data/spec/vcr_cassettes/whm/server/getlanglist.yml +22 -15
- data/spec/vcr_cassettes/whm/server/gettweaksetting.yml +44 -0
- data/spec/vcr_cassettes/whm/server/listips.yml +22 -15
- data/spec/vcr_cassettes/whm/server/loadavg.yml +26 -19
- data/spec/vcr_cassettes/whm/server/my_function.yml +59 -43
- data/spec/vcr_cassettes/whm/server/nvget.yml +22 -15
- data/spec/vcr_cassettes/whm/server/nvset.yml +22 -15
- data/spec/vcr_cassettes/whm/server/reboot.yml +22 -15
- data/spec/vcr_cassettes/whm/server/sethostname.yml +24 -15
- data/spec/vcr_cassettes/whm/server/setresolvers.yml +23 -15
- data/spec/vcr_cassettes/whm/server/settweaksetting.yml +44 -0
- data/spec/vcr_cassettes/whm/server/showbw.yml +22 -15
- data/spec/vcr_cassettes/whm/server/systemloadavg.yml +40 -29
- data/spec/vcr_cassettes/whm/server/themes.yml +38 -0
- data/spec/vcr_cassettes/whm/server/version.yml +22 -15
- data/spec/whm/account_spec.rb +40 -199
- data/spec/whm/base_spec.rb +0 -4
- data/spec/whm/cert_spec.rb +99 -0
- data/spec/whm/dns_spec.rb +5 -123
- data/spec/whm/reseller_spec.rb +11 -79
- data/spec/whm/server_spec.rb +85 -142
- metadata +367 -47
- data/.rvmrc +0 -49
- data/lib/lumberg/whm/args.rb +0 -113
- data/lib/net_http_hacked.rb +0 -42
- data/spec/vcr_cassettes/whm/server/response_type.yml +0 -85
- data/spec/whm/args_spec.rb +0 -179
data/spec/whm/dns_spec.rb
CHANGED
@@ -10,25 +10,6 @@ module Lumberg
|
|
10
10
|
end
|
11
11
|
|
12
12
|
describe "#addzone" do
|
13
|
-
it "requires a domain" do
|
14
|
-
@dns.stub(:perform_request)
|
15
|
-
requires_attr('domain') { @dns.add_zone }
|
16
|
-
end
|
17
|
-
|
18
|
-
it "requires an ip" do
|
19
|
-
requires_attr('ip') { @dns.add_zone(:domain => 'example.com') }
|
20
|
-
end
|
21
|
-
|
22
|
-
it "allows template" do
|
23
|
-
@dns.server.stub(:perform_request)
|
24
|
-
@dns.add_zone(:domain => 'example.com', :ip => '127.0.0.1', :template => 'something')
|
25
|
-
end
|
26
|
-
|
27
|
-
it "allows trueowner" do
|
28
|
-
@dns.server.stub(:perform_request)
|
29
|
-
@dns.add_zone(:domain => 'example.com', :ip => '127.0.0.1', :trueowner => 'something')
|
30
|
-
end
|
31
|
-
|
32
13
|
use_vcr_cassette "whm/dns/adddns"
|
33
14
|
|
34
15
|
it "creates a zone" do
|
@@ -45,14 +26,10 @@ module Lumberg
|
|
45
26
|
end
|
46
27
|
|
47
28
|
describe "#addzonerecord" do
|
48
|
-
it "requires a zone" do
|
49
|
-
requires_attr('zone') { @dns.add_zone_record }
|
50
|
-
end
|
51
|
-
|
52
29
|
use_vcr_cassette "whm/dns/addzonerecord"
|
53
30
|
|
54
31
|
it "adds a zone record" do
|
55
|
-
result = @dns.add_zone_record(:zone => 'example.com',
|
32
|
+
result = @dns.add_zone_record(:zone => 'example.com',
|
56
33
|
:name => 'example.com.',
|
57
34
|
:address => '192.1.2.3',
|
58
35
|
:type => 'A')
|
@@ -85,14 +62,6 @@ module Lumberg
|
|
85
62
|
describe "#getzonerecord" do
|
86
63
|
use_vcr_cassette "whm/dns/getzonerecord"
|
87
64
|
|
88
|
-
it "requires a domain" do
|
89
|
-
requires_attr('domain') { @dns.get_zone_record(:Line => 1) }
|
90
|
-
end
|
91
|
-
|
92
|
-
it "requires a Line" do
|
93
|
-
requires_attr('Line') { @dns.get_zone_record(:domain => "example.com") }
|
94
|
-
end
|
95
|
-
|
96
65
|
it "returns the zone" do
|
97
66
|
result = @dns.get_zone_record(:domain => "example.com", :Line => 1)
|
98
67
|
result[:success].should be_true
|
@@ -117,10 +86,6 @@ module Lumberg
|
|
117
86
|
describe "#dumpzone" do
|
118
87
|
use_vcr_cassette "whm/dns/dumpzone"
|
119
88
|
|
120
|
-
it "requires a domain" do
|
121
|
-
requires_attr('domain') { @dns.dump_zone }
|
122
|
-
end
|
123
|
-
|
124
89
|
it "dumps the zone" do
|
125
90
|
result = @dns.dump_zone(:domain => "example.com")
|
126
91
|
result[:success].should be_true
|
@@ -139,14 +104,6 @@ module Lumberg
|
|
139
104
|
describe "#resolvedomainname" do
|
140
105
|
use_vcr_cassette "whm/dns/resolvedomainname"
|
141
106
|
|
142
|
-
it "requires a domain" do
|
143
|
-
requires_attr('domain') { @dns.resolve_domain("api.version".to_sym => 1) }
|
144
|
-
end
|
145
|
-
|
146
|
-
it "requires the api version" do
|
147
|
-
requires_attr('api.version') { @dns.resolve_domain(:domain => "example.com") }
|
148
|
-
end
|
149
|
-
|
150
107
|
it "returns the ip address of the domain" do
|
151
108
|
result = @dns.resolve_domain(:domain => "example.com", "api.version".to_sym => 1)
|
152
109
|
result[:params][:ip].should == "192.1.2.3"
|
@@ -162,14 +119,6 @@ module Lumberg
|
|
162
119
|
describe "#editzonerecord" do
|
163
120
|
use_vcr_cassette "whm/dns/editzonerecord"
|
164
121
|
|
165
|
-
it "requires a domain" do
|
166
|
-
requires_attr('domain') { @dns.edit_zone_record(:Line => 1) }
|
167
|
-
end
|
168
|
-
|
169
|
-
it "requires a Line" do
|
170
|
-
requires_attr('Line') { @dns.edit_zone_record(:domain => "example.com") }
|
171
|
-
end
|
172
|
-
|
173
122
|
it "updates the zone record" do
|
174
123
|
result = @dns.edit_zone_record(:domain => "example.com", :Line => 1, :ttl => "86400")
|
175
124
|
result[:success].should be_true
|
@@ -192,10 +141,6 @@ module Lumberg
|
|
192
141
|
describe "#killdns" do
|
193
142
|
use_vcr_cassette "whm/dns/killdns"
|
194
143
|
|
195
|
-
it "requires a domain" do
|
196
|
-
requires_attr('domain') { @dns.kill_dns }
|
197
|
-
end
|
198
|
-
|
199
144
|
it "kills the dns" do
|
200
145
|
result = @dns.kill_dns(:domain => "example.com")
|
201
146
|
result[:success].should be_true
|
@@ -212,10 +157,6 @@ module Lumberg
|
|
212
157
|
describe "#lookupnsip" do
|
213
158
|
use_vcr_cassette "whm/dns/lookupnsip"
|
214
159
|
|
215
|
-
it "requires a nameserver" do
|
216
|
-
requires_attr('nameserver') { @dns.lookup_nameserver_ip }
|
217
|
-
end
|
218
|
-
|
219
160
|
it "returns the nameserver's ip" do
|
220
161
|
result = @dns.lookup_nameserver_ip(:nameserver => "example.com")
|
221
162
|
result[:params][:ip].should == "192.1.2.3"
|
@@ -230,14 +171,6 @@ module Lumberg
|
|
230
171
|
describe "#removezonerecord" do
|
231
172
|
use_vcr_cassette "whm/dns/removezonerecord"
|
232
173
|
|
233
|
-
it "requires a zone" do
|
234
|
-
requires_attr('zone') { @dns.remove_zone_record(:Line => 1) }
|
235
|
-
end
|
236
|
-
|
237
|
-
it "requires a Line" do
|
238
|
-
requires_attr('Line') { @dns.remove_zone_record(:zone => "example.com") }
|
239
|
-
end
|
240
|
-
|
241
174
|
it "removes the zone record" do
|
242
175
|
result = @dns.remove_zone_record(:zone => "example.com", :Line => 1)
|
243
176
|
result[:success].should be_true
|
@@ -260,14 +193,6 @@ module Lumberg
|
|
260
193
|
describe "#resetzone" do
|
261
194
|
use_vcr_cassette "whm/dns/resetzone"
|
262
195
|
|
263
|
-
it "requires a domain" do
|
264
|
-
requires_attr('domain') { @dns.reset_zone(:zone => "example.com") }
|
265
|
-
end
|
266
|
-
|
267
|
-
it "requires a zone" do
|
268
|
-
requires_attr('zone') { @dns.reset_zone(:domain => "example.com") }
|
269
|
-
end
|
270
|
-
|
271
196
|
it "resets the zone" do
|
272
197
|
result = @dns.reset_zone(:domain => "example.com", :zone => "example.com")
|
273
198
|
result[:success].should be_true
|
@@ -284,14 +209,6 @@ module Lumberg
|
|
284
209
|
describe "#listmxs" do
|
285
210
|
use_vcr_cassette "whm/dns/listmxs"
|
286
211
|
|
287
|
-
it "requires a domain" do
|
288
|
-
requires_attr('domain') { @dns.list_mxs("api.version".to_sym => 1) }
|
289
|
-
end
|
290
|
-
|
291
|
-
it "requires the api.version" do
|
292
|
-
requires_attr('api.version') { @dns.list_mxs(:domain => "example.com") }
|
293
|
-
end
|
294
|
-
|
295
212
|
it "returns a list of mxs" do
|
296
213
|
result = @dns.list_mxs(:domain => "example.com", "api.version".to_sym => 1)
|
297
214
|
result[:params][:record].should be_a_kind_of Array
|
@@ -304,46 +221,11 @@ module Lumberg
|
|
304
221
|
describe "#savemxs" do
|
305
222
|
use_vcr_cassette "whm/dns/savemxs"
|
306
223
|
|
307
|
-
it "requires the api.version" do
|
308
|
-
requires_attr('api.version') { @dns.save_mx(:domain => "example.com",
|
309
|
-
:name => "mail.example.com",
|
310
|
-
:exchange => "example.com",
|
311
|
-
:preference => 10) }
|
312
|
-
end
|
313
|
-
|
314
|
-
it "requires a domain" do
|
315
|
-
requires_attr('domain') { @dns.save_mx("api.version".to_sym => 1,
|
316
|
-
:name => "mail.example.com",
|
317
|
-
:exchange => "example.com",
|
318
|
-
:preference => 10) }
|
319
|
-
end
|
320
|
-
|
321
|
-
it "requires a name" do
|
322
|
-
requires_attr('name') { @dns.save_mx("api.version".to_sym => 1,
|
323
|
-
:domain => "example.com",
|
324
|
-
:exchange => "example.com",
|
325
|
-
:preference => 10) }
|
326
|
-
end
|
327
|
-
|
328
|
-
it "requires an exchange" do
|
329
|
-
requires_attr('exchange') { @dns.save_mx("api.version".to_sym => 1,
|
330
|
-
:domain => "example.com",
|
331
|
-
:name => "mail.example.com",
|
332
|
-
:preference => 10) }
|
333
|
-
end
|
334
|
-
|
335
|
-
it "requires a preference" do
|
336
|
-
requires_attr('preference') { @dns.save_mx("api.version".to_sym => 1,
|
337
|
-
:domain => "example.com",
|
338
|
-
:name => "mail.example.com",
|
339
|
-
:exchange => "example.com") }
|
340
|
-
end
|
341
|
-
|
342
224
|
it "saves the mx record" do
|
343
|
-
result = @dns.save_mx("api.version".to_sym => 1,
|
344
|
-
:domain => "example.com",
|
345
|
-
:name => "mail.example.com",
|
346
|
-
:exchange => "example.com",
|
225
|
+
result = @dns.save_mx("api.version".to_sym => 1,
|
226
|
+
:domain => "example.com",
|
227
|
+
:name => "mail.example.com",
|
228
|
+
:exchange => "example.com",
|
347
229
|
:preference => 10)
|
348
230
|
result[:message].should match(/Bind reloading on .*example.com/i)
|
349
231
|
end
|
data/spec/whm/reseller_spec.rb
CHANGED
@@ -11,10 +11,6 @@ module Lumberg
|
|
11
11
|
describe "#setup_reseller" do
|
12
12
|
use_vcr_cassette "whm/reseller/setupreseller"
|
13
13
|
|
14
|
-
it "requires username" do
|
15
|
-
requires_attr('username') { @reseller.create }
|
16
|
-
end
|
17
|
-
|
18
14
|
it "fails when the user doesn't exist" do
|
19
15
|
result = @reseller.create(:username => 'invalid')
|
20
16
|
result[:success].should be_false
|
@@ -41,15 +37,11 @@ module Lumberg
|
|
41
37
|
result[:params][:resellers].should have(2).resellers
|
42
38
|
result[:params][:resellers].should include('bob', 'ted')
|
43
39
|
end
|
44
|
-
end
|
40
|
+
end
|
45
41
|
|
46
42
|
describe "#setresellerips" do
|
47
43
|
use_vcr_cassette "whm/reseller/setresellerips"
|
48
44
|
|
49
|
-
it "requires a username" do
|
50
|
-
requires_attr('username') { @reseller.add_ips }
|
51
|
-
end
|
52
|
-
|
53
45
|
it "adds the ip address to the reseller account" do
|
54
46
|
result = @reseller.add_ips(:username => 'bob', :ips =>'192.1.2.3')
|
55
47
|
result[:message].should match(/Successfully configured IP addresses delegation to reseller/i)
|
@@ -64,12 +56,8 @@ module Lumberg
|
|
64
56
|
describe "#setresellerlimits" do
|
65
57
|
use_vcr_cassette "whm/reseller/setresellerlimits"
|
66
58
|
|
67
|
-
it "requires a username" do
|
68
|
-
requires_attr('username') { @reseller.set_limits }
|
69
|
-
end
|
70
|
-
|
71
59
|
it "sets the limits" do
|
72
|
-
result = @reseller.set_limits(:username => 'bob', :diskspace_limit => 1024, :enable_overselling => true,
|
60
|
+
result = @reseller.set_limits(:username => 'bob', :diskspace_limit => 1024, :enable_overselling => true,
|
73
61
|
:enable_overselling_diskspace => true)
|
74
62
|
result[:success].should be_true
|
75
63
|
result[:message].should match(/Successfully set reseller account .*limits/i)
|
@@ -79,10 +67,6 @@ module Lumberg
|
|
79
67
|
describe "#terminate" do
|
80
68
|
use_vcr_cassette "whm/reseller/terminatereseller"
|
81
69
|
|
82
|
-
it "requires a reseller" do
|
83
|
-
requires_attr('reseller') { @reseller.terminate }
|
84
|
-
end
|
85
|
-
|
86
70
|
it "terminates the reseller" do
|
87
71
|
result = @reseller.terminate(:reseller => 'terminat')
|
88
72
|
result[:success].should be_true
|
@@ -108,14 +92,6 @@ module Lumberg
|
|
108
92
|
describe "#setresellermainip" do
|
109
93
|
use_vcr_cassette "whm/reseller/setresellermainip"
|
110
94
|
|
111
|
-
it "requires a username" do
|
112
|
-
requires_attr('username') { @reseller.set_main_ip(:ip => '192.1.2.3') }
|
113
|
-
end
|
114
|
-
|
115
|
-
it "requires an ip" do
|
116
|
-
requires_attr('ip') { @reseller.set_main_ip(:username => 'bob') }
|
117
|
-
end
|
118
|
-
|
119
95
|
it "sets the main ip" do
|
120
96
|
result = @reseller.set_main_ip(:username => 'bob', :ip => '192.1.2.3')
|
121
97
|
result[:success].should be_true
|
@@ -138,18 +114,6 @@ module Lumberg
|
|
138
114
|
describe "#setresellerpackagelimit" do
|
139
115
|
use_vcr_cassette "whm/reseller/setresellerpackagelimit"
|
140
116
|
|
141
|
-
it "requires a username" do
|
142
|
-
requires_attr('username') { @reseller.set_package_limit(:no_limit => true, :package => 'gold') }
|
143
|
-
end
|
144
|
-
|
145
|
-
it "requires no_limit" do
|
146
|
-
requires_attr('no_limit') { @reseller.set_package_limit(:username => 'bob', :package => 'gold') }
|
147
|
-
end
|
148
|
-
|
149
|
-
it "requires package" do
|
150
|
-
requires_attr('package') { @reseller.set_package_limit(:username => 'bob', :no_limit => true) }
|
151
|
-
end
|
152
|
-
|
153
117
|
it "sets the package limit" do
|
154
118
|
result = @reseller.set_package_limit(:username => 'bob', :no_limit => false, :package => 'gold', :allowed => true)
|
155
119
|
result[:success].should be_true
|
@@ -161,15 +125,11 @@ module Lumberg
|
|
161
125
|
result[:success].should be_true
|
162
126
|
result[:message].should match(/Successfully set reseller package limit/i)
|
163
127
|
end
|
164
|
-
end
|
128
|
+
end
|
165
129
|
|
166
130
|
describe "#suspendreseller" do
|
167
131
|
use_vcr_cassette "whm/reseller/suspendreseller"
|
168
132
|
|
169
|
-
it "requires a username" do
|
170
|
-
requires_attr('username') { @reseller.suspend }
|
171
|
-
end
|
172
|
-
|
173
133
|
it "suspends the reseller" do
|
174
134
|
result = @reseller.suspend(:username => 'bob')
|
175
135
|
result[:success].should be_true
|
@@ -192,10 +152,6 @@ module Lumberg
|
|
192
152
|
describe "#unsuspendreseller" do
|
193
153
|
use_vcr_cassette "whm/reseller/unsuspendreseller"
|
194
154
|
|
195
|
-
it "requires a username" do
|
196
|
-
requires_attr('username') { @reseller.unsuspend }
|
197
|
-
end
|
198
|
-
|
199
155
|
it "should unsuspend the user" do
|
200
156
|
result = @reseller.unsuspend(:username => 'bob')
|
201
157
|
result[:success].should be_true
|
@@ -212,18 +168,14 @@ module Lumberg
|
|
212
168
|
describe "#acctcounts" do
|
213
169
|
use_vcr_cassette "whm/reseller/acctcounts"
|
214
170
|
|
215
|
-
it "requires a username" do
|
216
|
-
requires_attr('username') { @reseller.account_counts }
|
217
|
-
end
|
218
|
-
|
219
171
|
it "returns the account counts" do
|
220
172
|
result = @reseller.account_counts(:username => 'bob')
|
221
173
|
result[:success].should be_true
|
222
174
|
result[:message].should match(/Obtained reseller account counts/i)
|
223
|
-
result[:params][:account].should == "bob"
|
175
|
+
result[:params][:account].should == "bob"
|
224
176
|
result[:params][:suspended].to_i.should == 0
|
225
177
|
result[:params][:active].to_i.should == 0
|
226
|
-
result[:params][:limit].should == ""
|
178
|
+
result[:params][:limit].should == ""
|
227
179
|
end
|
228
180
|
|
229
181
|
it "returns an error when the user is invalid" do
|
@@ -236,22 +188,18 @@ module Lumberg
|
|
236
188
|
describe "#setresellernameservers" do
|
237
189
|
use_vcr_cassette "whm/reseller/setresellernameservers"
|
238
190
|
|
239
|
-
it "requires a username" do
|
240
|
-
requires_attr('username') { @reseller.set_nameservers }
|
241
|
-
end
|
242
|
-
|
243
191
|
it "sets the default nameservers" do
|
244
192
|
result = @reseller.set_nameservers(:username => 'bob')
|
245
193
|
result[:success].should be_true
|
246
194
|
result[:message].should match(/Set resellers nameservers/i)
|
247
195
|
end
|
248
|
-
|
196
|
+
|
249
197
|
it "sets the specified nameservers" do
|
250
198
|
result = @reseller.set_nameservers(:username => 'bob', :nameservers => 'ns1.example.com')
|
251
199
|
result[:success].should be_true
|
252
200
|
result[:message].should match(/Set resellers nameservers/i)
|
253
201
|
end
|
254
|
-
|
202
|
+
|
255
203
|
it "returns an error for an invalid username" do
|
256
204
|
result = @reseller.account_counts(:username => 'notexists')
|
257
205
|
result[:success].should be_false
|
@@ -262,16 +210,12 @@ module Lumberg
|
|
262
210
|
describe "#resellerstats" do
|
263
211
|
use_vcr_cassette "whm/reseller/resellerstats"
|
264
212
|
|
265
|
-
it "requires a reseller" do
|
266
|
-
requires_attr('reseller') { @reseller.stats }
|
267
|
-
end
|
268
|
-
|
269
213
|
it "returns the stats of the reseller" do
|
270
214
|
result = @reseller.stats(:reseller => 'bob')
|
271
215
|
result[:success].should be_true
|
272
216
|
result[:message].should match(/Fetched Reseller Data OK/i)
|
273
217
|
result[:params][:diskquota].to_i.should == 0
|
274
|
-
result[:params][:diskoverselling].to_i.should == 1
|
218
|
+
result[:params][:diskoverselling].to_i.should == 1
|
275
219
|
result[:params][:bandwidthlimit].to_i.should == 0
|
276
220
|
end
|
277
221
|
|
@@ -297,10 +241,6 @@ module Lumberg
|
|
297
241
|
describe "#saveacllist" do
|
298
242
|
use_vcr_cassette "whm/reseller/saveacllist"
|
299
243
|
|
300
|
-
it "requires an acllist name" do
|
301
|
-
requires_attr('acllist') { @reseller.save_acl_list }
|
302
|
-
end
|
303
|
-
|
304
244
|
it "creates a new reseller ACL list" do
|
305
245
|
result = @reseller.save_acl_list(:acllist => 'testacllist')
|
306
246
|
result[:success].should be_true
|
@@ -308,9 +248,9 @@ module Lumberg
|
|
308
248
|
end
|
309
249
|
|
310
250
|
it "creates a new reseller ACL list with optional settings" do
|
311
|
-
result = @reseller.save_acl_list(:acllist => 'testacllist',
|
251
|
+
result = @reseller.save_acl_list(:acllist => 'testacllist',
|
312
252
|
"acl-ssl".to_sym => true,
|
313
|
-
"acl-add-pkg".to_sym => true,
|
253
|
+
"acl-add-pkg".to_sym => true,
|
314
254
|
"acl-stats".to_sym => true)
|
315
255
|
result[:success].should be_true
|
316
256
|
result[:message].should match(/ACL List testacllist saved/i)
|
@@ -320,16 +260,12 @@ module Lumberg
|
|
320
260
|
describe "#setacls" do
|
321
261
|
use_vcr_cassette "whm/reseller/setacls"
|
322
262
|
|
323
|
-
it "requires a reseller" do
|
324
|
-
requires_attr('reseller') { @reseller.set_acls }
|
325
|
-
end
|
326
|
-
|
327
263
|
it "sets the ACL for the reseller" do
|
328
264
|
result = @reseller.set_acls(:reseller => 'bob', :acllist => 'testacllist')
|
329
265
|
result[:success].should be_true
|
330
266
|
result[:message].should match(/Reseller Acls Saved/i)
|
331
267
|
end
|
332
|
-
|
268
|
+
|
333
269
|
it "returns an error for an invalid reseller" do
|
334
270
|
result = @reseller.set_acls(:reseller => 'notexists')
|
335
271
|
result[:success].should be_false
|
@@ -340,10 +276,6 @@ module Lumberg
|
|
340
276
|
describe "#unsetupreseller" do
|
341
277
|
use_vcr_cassette "whm/reseller/unsetupreseller"
|
342
278
|
|
343
|
-
it "requires a username" do
|
344
|
-
requires_attr('username') { @reseller.unsetup }
|
345
|
-
end
|
346
|
-
|
347
279
|
it "removes the reseller status from the user" do
|
348
280
|
result = @reseller.unsetup(:username => 'bob')
|
349
281
|
result[:success].should be_true
|