solusvm 1.2.1 → 1.3.0
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.
- data/.travis.yml +0 -5
- data/README.markdown +3 -3
- data/lib/solusvm.rb +0 -22
- data/lib/solusvm/base.rb +37 -8
- data/lib/solusvm/cli/base_cli.rb +10 -10
- data/lib/solusvm/cli/client_cli.rb +8 -9
- data/lib/solusvm/cli/general_cli.rb +2 -3
- data/lib/solusvm/cli/node_cli.rb +2 -3
- data/lib/solusvm/cli/reseller_cli.rb +37 -38
- data/lib/solusvm/cli/server_cli.rb +12 -13
- data/lib/solusvm/client.rb +6 -6
- data/lib/solusvm/general.rb +3 -3
- data/lib/solusvm/node.rb +16 -8
- data/lib/solusvm/reseller.rb +5 -5
- data/lib/solusvm/server.rb +44 -38
- data/lib/solusvm/version.rb +1 -1
- data/solusvm.gemspec +1 -0
- data/test/cli/test_client_cli.rb +13 -19
- data/test/cli/test_general_cli.rb +4 -7
- data/test/cli/test_node_cli.rb +7 -13
- data/test/cli/test_reseller_cli.rb +41 -46
- data/test/cli/test_server_cli.rb +35 -65
- data/test/solusvm/test_base.rb +18 -10
- data/test/solusvm/test_client.rb +11 -12
- data/test/solusvm/test_general.rb +2 -3
- data/test/solusvm/test_hash.rb +4 -4
- data/test/solusvm/test_node.rb +12 -7
- data/test/solusvm/test_reseller.rb +13 -14
- data/test/solusvm/test_server.rb +17 -9
- data/test/test_helper.rb +9 -5
- data/test/vcr_cassettes/base/successful.yml +24 -1
- data/test/vcr_cassettes/base/successful_instance_config.yml +28 -0
- data/test/vcr_cassettes/node/list_groups.yml +20 -0
- data/test/vcr_cassettes/server/add_ip.yml +15 -0
- data/test/vcr_cassettes/server/del_ip.yml +15 -0
- metadata +18 -5
- data/test/test_solusvm.rb +0 -12
data/lib/solusvm/node.rb
CHANGED
@@ -9,11 +9,19 @@ module Solusvm
|
|
9
9
|
# * +type+ - a valid virtualization type; e.g: [openvz|xen|xen hvm|kvm]
|
10
10
|
def list(type)
|
11
11
|
validate_server_type(type) do
|
12
|
-
perform_request(:
|
12
|
+
perform_request(action: 'listnodes', type: type)
|
13
13
|
parse_returned_params_as_list('nodes')
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
+
# Lists existing node groups
|
18
|
+
def list_groups
|
19
|
+
perform_request(action: 'listnodegroups')
|
20
|
+
|
21
|
+
# return list of node groups with numeric values excluded
|
22
|
+
returned_parameters['nodegroups'].to_s.split(',').map {|group| group.split('|')[1]}
|
23
|
+
end
|
24
|
+
|
17
25
|
# Lists existing nodes ids of a given type.
|
18
26
|
#
|
19
27
|
# Parameters:
|
@@ -21,36 +29,36 @@ module Solusvm
|
|
21
29
|
# * +type+ - a valid virtualization type; e.g: [openvz|xen|xen hvm|kvm]
|
22
30
|
def ids(type)
|
23
31
|
validate_server_type(type) do
|
24
|
-
perform_request(:
|
25
|
-
|
32
|
+
perform_request(action: 'node-idlist', type: type)
|
33
|
+
parse_returned_params_as_list('nodes')
|
26
34
|
end
|
27
35
|
end
|
28
36
|
|
29
37
|
# Retrieves statistics from a specific node.
|
30
38
|
def statistics(nodeid)
|
31
|
-
perform_request(:
|
39
|
+
perform_request(action: 'node-statistics', nodeid: nodeid)
|
32
40
|
returned_parameters
|
33
41
|
end
|
34
42
|
|
35
43
|
# Retrieves available xen resources from a specific node.
|
36
44
|
def xenresources(nodeid)
|
37
|
-
perform_request(:
|
45
|
+
perform_request(action: 'node-xenresources', nodeid: nodeid)
|
38
46
|
returned_parameters
|
39
47
|
end
|
40
48
|
|
41
49
|
# Retrieves a list of available IPs for a specific node.
|
42
50
|
def available_ips(nodeid)
|
43
|
-
perform_request(:
|
51
|
+
perform_request(action: 'node-iplist', nodeid: nodeid)
|
44
52
|
if statusmsg.match /no available ip/i
|
45
53
|
[]
|
46
54
|
else
|
47
|
-
|
55
|
+
parse_returned_params_as_list('ips')
|
48
56
|
end
|
49
57
|
end
|
50
58
|
|
51
59
|
# Lists virtual servers from a specific node.
|
52
60
|
def virtualservers(nodeid)
|
53
|
-
perform_request({:
|
61
|
+
perform_request({action: "node-virtualservers", nodeid: nodeid}, "virtualserver")
|
54
62
|
|
55
63
|
if returned_parameters["virtualservers"] && returned_parameters["virtualservers"]["virtualserver"]
|
56
64
|
returned_parameters["virtualservers"]["virtualserver"]
|
data/lib/solusvm/reseller.rb
CHANGED
@@ -27,7 +27,7 @@ module Solusvm
|
|
27
27
|
# * <tt>:xenhvm</tt> - y|n Allow building of xen hvm virtual servers (optional)
|
28
28
|
# * <tt>:kvm</tt> - y|n Allow building of kvmvirtual servers (optional)
|
29
29
|
def create(options ={})
|
30
|
-
perform_request(options.merge(:
|
30
|
+
perform_request(options.merge(action: 'reseller-create')) && returned_parameters
|
31
31
|
end
|
32
32
|
|
33
33
|
# Changes the available resources for a specific reseller.
|
@@ -49,22 +49,22 @@ module Solusvm
|
|
49
49
|
# * <tt>:xenhvm</tt> - y|n Allow building of xen hvm virtual servers (optional)
|
50
50
|
# * <tt>:kvm</tt> - y|n Allow building of kvmvirtual servers (optional)
|
51
51
|
def change_resources(username, options={})
|
52
|
-
perform_request(options.merge(:
|
52
|
+
perform_request(options.merge(action: 'reseller-modifyresources', username: username)) && returned_parameters
|
53
53
|
end
|
54
54
|
|
55
55
|
# Retrieves information from an existing reseller.
|
56
56
|
def info(username)
|
57
|
-
perform_request({:
|
57
|
+
perform_request({action: 'reseller-info', username: username}) && returned_parameters
|
58
58
|
end
|
59
59
|
|
60
60
|
# Deletes an existing reseller.
|
61
61
|
def delete(username)
|
62
|
-
perform_request({:
|
62
|
+
perform_request({action: 'reseller-delete', username: username})
|
63
63
|
end
|
64
64
|
|
65
65
|
# Lists existing resellers.
|
66
66
|
def list
|
67
|
-
perform_request(:
|
67
|
+
perform_request(action: 'reseller-list')
|
68
68
|
parse_returned_params_as_list('usernames')
|
69
69
|
end
|
70
70
|
|
data/lib/solusvm/server.rb
CHANGED
@@ -22,167 +22,173 @@ module Solusvm
|
|
22
22
|
# * <tt>:issuelicense</tt> - 1|2 1 = cPanel monthly 2= cPanel yearly
|
23
23
|
def create(hostname, password, options = {})
|
24
24
|
options.reverse_merge!(
|
25
|
-
:
|
26
|
-
:
|
27
|
-
:
|
28
|
-
:
|
29
|
-
:
|
30
|
-
:
|
31
|
-
:
|
32
|
-
:
|
33
|
-
).merge!(:
|
25
|
+
type: 'xen',
|
26
|
+
username: nil,
|
27
|
+
ips: 1,
|
28
|
+
node: nil,
|
29
|
+
plan: nil,
|
30
|
+
template: nil,
|
31
|
+
password: password,
|
32
|
+
hostname: hostname
|
33
|
+
).merge!(action: 'vserver-create')
|
34
34
|
perform_request(options) && returned_parameters
|
35
35
|
end
|
36
36
|
|
37
37
|
# Boots a server.
|
38
38
|
def boot(vid)
|
39
|
-
perform_request(:
|
39
|
+
perform_request(action: 'vserver-boot', vserverid: vid)
|
40
40
|
end
|
41
41
|
|
42
42
|
# Reboots a server.
|
43
43
|
def reboot(vid)
|
44
|
-
perform_request(:
|
44
|
+
perform_request(action: 'vserver-reboot', vserverid: vid)
|
45
45
|
end
|
46
46
|
|
47
47
|
# Suspends a server.
|
48
48
|
def suspend(vid)
|
49
|
-
perform_request(:
|
49
|
+
perform_request(action: 'vserver-suspend', vserverid: vid)
|
50
50
|
end
|
51
51
|
|
52
52
|
# Resumes a server.
|
53
53
|
def resume(vid)
|
54
|
-
perform_request(:
|
54
|
+
perform_request(action: 'vserver-unsuspend', vserverid: vid)
|
55
55
|
end
|
56
56
|
|
57
57
|
# Shuts down a server.
|
58
58
|
def shutdown(vid)
|
59
|
-
perform_request(:
|
59
|
+
perform_request(action: 'vserver-shutdown', vserverid: vid)
|
60
60
|
end
|
61
61
|
|
62
62
|
# Enable TUN/TAP.
|
63
63
|
def tun_enable(vid)
|
64
|
-
perform_request(:
|
64
|
+
perform_request(action: 'vserver-tun-enable', vserverid: vid)
|
65
65
|
end
|
66
66
|
|
67
67
|
# Disable TUN/TAP.
|
68
68
|
def tun_disable(vid)
|
69
|
-
perform_request(:
|
69
|
+
perform_request(action: 'vserver-tun-disable', vserverid: vid)
|
70
70
|
end
|
71
71
|
|
72
72
|
# Enable Network Mode.
|
73
73
|
def network_enable(vid)
|
74
|
-
perform_request(:
|
74
|
+
perform_request(action: 'vserver-network-enable', vserverid: vid)
|
75
75
|
end
|
76
76
|
|
77
77
|
# Disables Network Mode.
|
78
78
|
def network_disable(vid)
|
79
|
-
perform_request(:
|
79
|
+
perform_request(action: 'vserver-network-disable', vserverid: vid)
|
80
80
|
end
|
81
81
|
|
82
82
|
# Enable PAE.
|
83
83
|
def pae_enable(vid)
|
84
|
-
perform_request(:
|
84
|
+
perform_request(action: 'vserver-pae', vserverid: vid, pae: "on")
|
85
85
|
end
|
86
86
|
|
87
87
|
# Disables PAE.
|
88
88
|
def pae_disable(vid)
|
89
|
-
perform_request(:
|
89
|
+
perform_request(action: 'vserver-pae', vserverid: vid, pae: "off")
|
90
90
|
end
|
91
91
|
|
92
92
|
# Terminates a server.
|
93
93
|
def terminate(vid, deleteclient = false)
|
94
|
-
perform_request(:
|
94
|
+
perform_request(action: 'vserver-terminate', vserverid: vid, deleteclient: deleteclient)
|
95
95
|
end
|
96
96
|
|
97
97
|
# Checks if a specific server exists.
|
98
98
|
def exists?(vid)
|
99
|
-
perform_request(:
|
99
|
+
perform_request(action: 'vserver-checkexists', vserverid: vid)
|
100
100
|
!statusmsg.match(/Virtual server exists/i).nil?
|
101
101
|
end
|
102
102
|
|
103
103
|
# Checks the status of specific server (disabled|online|offline).
|
104
104
|
def status(vid)
|
105
|
-
perform_request(:
|
105
|
+
perform_request(action: 'vserver-status', vserverid: vid)
|
106
106
|
statusmsg
|
107
107
|
end
|
108
108
|
|
109
109
|
# Adds an IP address for a specific server.
|
110
110
|
def add_ip(vid)
|
111
|
-
perform_request(:
|
111
|
+
perform_request(action: 'vserver-addip', vserverid: vid)
|
112
|
+
returned_parameters['ipaddress']
|
113
|
+
end
|
114
|
+
|
115
|
+
# Deletes an IP address for a specific server.
|
116
|
+
def del_ip(vid, ip_address)
|
117
|
+
perform_request(action: 'vserver-delip', vserverid: vid, ipaddr: ip_address)
|
112
118
|
end
|
113
119
|
|
114
120
|
# Changes server plan.
|
115
121
|
def change_plan(vid, plan)
|
116
|
-
perform_request(:
|
122
|
+
perform_request(action: 'vserver-change', vserverid: vid, plan: plan)
|
117
123
|
end
|
118
124
|
|
119
125
|
# Changes server owner.
|
120
126
|
def change_owner(vid, client_id)
|
121
|
-
perform_request(:
|
127
|
+
perform_request(action: 'vserver-changeowner', vserverid: vid, clientid: client_id)
|
122
128
|
end
|
123
129
|
|
124
130
|
# Changes server console password.
|
125
131
|
def change_consolepass(vid, new_password)
|
126
|
-
perform_request(:
|
132
|
+
perform_request(action: 'vserver-consolepass', vserverid: vid, consolepassword: new_password)
|
127
133
|
end
|
128
134
|
|
129
135
|
# Changes server vnc password.
|
130
136
|
def change_vncpass(vid, new_password)
|
131
|
-
perform_request(:
|
137
|
+
perform_request(action: 'vserver-vncpass', vserverid: vid, vncpassword: new_password)
|
132
138
|
end
|
133
139
|
|
134
140
|
# Changes server root password.
|
135
141
|
def change_rootpassword(vid, new_password)
|
136
|
-
perform_request(:
|
142
|
+
perform_request(action: 'vserver-rootpassword', vserverid: vid, rootpassword: new_password)
|
137
143
|
end
|
138
144
|
|
139
145
|
# Changes server boot order [cd(Hard Disk CDROM)|dc(CDROM Hard Disk)|c(Hard Disk)|d(CDROM)].
|
140
146
|
def change_bootorder(vid, bootorder)
|
141
|
-
perform_request(:
|
147
|
+
perform_request(action: 'vserver-bootorder', vserverid: vid, bootorder: bootorder.to_s)
|
142
148
|
end
|
143
149
|
|
144
150
|
# Changes server hostname.
|
145
151
|
def change_hostname(vid, hostname)
|
146
|
-
perform_request(:
|
152
|
+
perform_request(action: 'vserver-hostname', vserverid: vid, hostname: hostname)
|
147
153
|
end
|
148
154
|
|
149
155
|
# Retrieves server information.
|
150
156
|
def info(vid, reboot = false)
|
151
|
-
perform_request(:
|
157
|
+
perform_request(action: 'vserver-info', vserverid: vid, reboot: reboot)
|
152
158
|
returned_parameters
|
153
159
|
end
|
154
160
|
|
155
161
|
# Retrieves server vnc information.
|
156
162
|
def vnc(vid)
|
157
|
-
perform_request(:
|
163
|
+
perform_request(action: 'vserver-vnc', vserverid: vid)
|
158
164
|
returned_parameters
|
159
165
|
end
|
160
166
|
|
161
167
|
# Retrieves server console information.
|
162
168
|
def console(vid)
|
163
|
-
perform_request(:
|
169
|
+
perform_request(action: 'vserver-console', vserverid: vid)
|
164
170
|
returned_parameters
|
165
171
|
end
|
166
172
|
|
167
173
|
# Retrieves all available server information.
|
168
174
|
def info_all(vid)
|
169
|
-
perform_request(:
|
175
|
+
perform_request(action: 'vserver-infoall', vserverid: vid)
|
170
176
|
returned_parameters
|
171
177
|
end
|
172
178
|
|
173
179
|
# Rebuilds a server using a given template.
|
174
180
|
def rebuild(vid, template)
|
175
|
-
perform_request(:
|
181
|
+
perform_request(action: 'vserver-rebuild', vserverid: vid, template: template)
|
176
182
|
end
|
177
183
|
|
178
184
|
# Mounts a given iso.
|
179
185
|
def mountiso(vid, iso)
|
180
|
-
perform_request(:
|
186
|
+
perform_request(action: 'vserver-mountiso', vserverid: vid, iso: iso)
|
181
187
|
end
|
182
188
|
|
183
189
|
# Unmounts a given iso.
|
184
190
|
def unmountiso(vid)
|
185
|
-
perform_request(:
|
191
|
+
perform_request(action: 'vserver-unmountiso', vserverid: vid)
|
186
192
|
end
|
187
193
|
end
|
188
194
|
end
|
data/lib/solusvm/version.rb
CHANGED
data/solusvm.gemspec
CHANGED
@@ -11,6 +11,7 @@ Gem::Specification.new do |s|
|
|
11
11
|
s.homepage = "http://www.site5.com"
|
12
12
|
s.summary = "Wrapper for the SolusVM Admin::API"
|
13
13
|
s.description = "Solusvm allows for easy interaction with the SolusVM Admin::API."
|
14
|
+
s.license = 'MIT'
|
14
15
|
|
15
16
|
s.rubyforge_project = "solusvm"
|
16
17
|
s.files = `git ls-files`.split("\n")
|
data/test/cli/test_client_cli.rb
CHANGED
@@ -10,23 +10,22 @@ class TestClientCli < Test::Unit::TestCase
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def test_should_delegate_client_create_to_client
|
13
|
-
Solusvm.expects(:config).with("thelogin", "thekey", { :url => "theurl" })
|
14
13
|
api = mock do
|
15
14
|
expects(:successful?).returns(true)
|
16
15
|
expects(:create).with() do |options|
|
17
16
|
expected = {
|
18
|
-
:
|
19
|
-
:
|
20
|
-
:
|
21
|
-
:
|
22
|
-
:
|
23
|
-
:
|
17
|
+
username: "theusername",
|
18
|
+
password: "thepassword",
|
19
|
+
email: "theemail",
|
20
|
+
firstname: "thefirstname",
|
21
|
+
lastname: "thelastname",
|
22
|
+
company: "thecompany"
|
24
23
|
}
|
25
24
|
|
26
25
|
expected.all? { |k,v| options[k] == v }
|
27
26
|
end.returns("theresult")
|
28
27
|
end
|
29
|
-
Solusvm::Client.
|
28
|
+
Solusvm::Client.expects(:new).with(solusvm_params).returns(api)
|
30
29
|
|
31
30
|
$stdout.expects(:puts).with("theresult")
|
32
31
|
Solusvm::Cli.start(cli_expand_base_arguments([
|
@@ -41,8 +40,7 @@ class TestClientCli < Test::Unit::TestCase
|
|
41
40
|
end
|
42
41
|
|
43
42
|
def test_should_delegate_client_change_password_to_client
|
44
|
-
Solusvm.expects(:
|
45
|
-
Solusvm::Client.stubs(:new => mock do
|
43
|
+
Solusvm::Client.expects(:new).with(solusvm_params).returns(mock do
|
46
44
|
expects(:successful?).returns(true)
|
47
45
|
expects(:change_password).with("theusername", "thepassword").returns("theresult")
|
48
46
|
end)
|
@@ -52,8 +50,7 @@ class TestClientCli < Test::Unit::TestCase
|
|
52
50
|
end
|
53
51
|
|
54
52
|
def test_should_delegate_client_authenticate_to_client
|
55
|
-
Solusvm.expects(:
|
56
|
-
Solusvm::Client.stubs(:new => mock do
|
53
|
+
Solusvm::Client.expects(:new).with(solusvm_params).returns(mock do
|
57
54
|
expects(:successful?).returns(true)
|
58
55
|
expects(:authenticate).with("theusername", "thepassword").returns("theresult")
|
59
56
|
end)
|
@@ -63,8 +60,7 @@ class TestClientCli < Test::Unit::TestCase
|
|
63
60
|
end
|
64
61
|
|
65
62
|
def test_should_delegate_client_check_exists_to_client
|
66
|
-
Solusvm.expects(:
|
67
|
-
Solusvm::Client.stubs(:new => mock do
|
63
|
+
Solusvm::Client.expects(:new).with(solusvm_params).returns(mock do
|
68
64
|
expects(:successful?).returns(true)
|
69
65
|
expects(:exists?).with("theusername").returns("theresult")
|
70
66
|
end)
|
@@ -74,8 +70,7 @@ class TestClientCli < Test::Unit::TestCase
|
|
74
70
|
end
|
75
71
|
|
76
72
|
def test_should_delegate_client_delete_to_client
|
77
|
-
Solusvm.
|
78
|
-
Solusvm::Client.stubs(:new => mock do
|
73
|
+
Solusvm::Client.stubs(:new).with(solusvm_params).returns(mock do
|
79
74
|
expects(:successful?).returns(true)
|
80
75
|
expects(:delete).with("theusername").returns("theresult")
|
81
76
|
end)
|
@@ -85,8 +80,7 @@ class TestClientCli < Test::Unit::TestCase
|
|
85
80
|
end
|
86
81
|
|
87
82
|
def test_should_delegate_client_list_to_client
|
88
|
-
Solusvm.expects(:
|
89
|
-
Solusvm::Client.stubs(:new => mock do
|
83
|
+
Solusvm::Client.expects(:new).with(solusvm_params).returns(mock do
|
90
84
|
expects(:successful?).returns(true)
|
91
85
|
expects(:list).returns("theresult")
|
92
86
|
end)
|
@@ -94,4 +88,4 @@ class TestClientCli < Test::Unit::TestCase
|
|
94
88
|
$stdout.expects(:puts).with("theresult")
|
95
89
|
Solusvm::Cli.start(cli_expand_base_arguments(["client", "list"]))
|
96
90
|
end
|
97
|
-
end
|
91
|
+
end
|
@@ -10,8 +10,7 @@ class TestGeneralCli < Test::Unit::TestCase
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def test_should_delegate_templates_to_general
|
13
|
-
Solusvm.expects(:
|
14
|
-
Solusvm::General.stubs(:new => mock do
|
13
|
+
Solusvm::General.expects(:new).with(solusvm_params).returns(mock do
|
15
14
|
expects(:successful?).returns(true)
|
16
15
|
expects(:templates).with("type").returns("thetemplates")
|
17
16
|
end)
|
@@ -21,8 +20,7 @@ class TestGeneralCli < Test::Unit::TestCase
|
|
21
20
|
end
|
22
21
|
|
23
22
|
def test_should_delegate_plans_to_general
|
24
|
-
Solusvm.expects(:
|
25
|
-
Solusvm::General.stubs(:new => mock do
|
23
|
+
Solusvm::General.expects(:new).with(solusvm_params).returns(mock do
|
26
24
|
expects(:successful?).returns(true)
|
27
25
|
expects(:plans).with("type").returns("theplans")
|
28
26
|
end)
|
@@ -32,8 +30,7 @@ class TestGeneralCli < Test::Unit::TestCase
|
|
32
30
|
end
|
33
31
|
|
34
32
|
def test_should_delegate_isos_to_general
|
35
|
-
Solusvm.expects(:
|
36
|
-
Solusvm::General.stubs(:new => mock do
|
33
|
+
Solusvm::General.expects(:new).with(solusvm_params).returns(mock do
|
37
34
|
expects(:successful?).returns(true)
|
38
35
|
expects(:isos).with("type").returns("theisos")
|
39
36
|
end)
|
@@ -41,4 +38,4 @@ class TestGeneralCli < Test::Unit::TestCase
|
|
41
38
|
$stdout.expects(:puts).with("theisos")
|
42
39
|
Solusvm::Cli.start(cli_expand_base_arguments(["general", "isos", "type"]))
|
43
40
|
end
|
44
|
-
end
|
41
|
+
end
|
data/test/cli/test_node_cli.rb
CHANGED
@@ -10,8 +10,7 @@ class TestNodeCli < Test::Unit::TestCase
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def test_should_delegate_node_available_ips_to_node
|
13
|
-
Solusvm.expects(:
|
14
|
-
Solusvm::Node.stubs(:new => mock do
|
13
|
+
Solusvm::Node.expects(:new).with(solusvm_params).returns(mock do
|
15
14
|
expects(:successful?).returns(true)
|
16
15
|
expects(:available_ips).with("thevserverid").returns("theips")
|
17
16
|
end)
|
@@ -21,8 +20,7 @@ class TestNodeCli < Test::Unit::TestCase
|
|
21
20
|
end
|
22
21
|
|
23
22
|
def test_should_delegate_node_stats_to_node
|
24
|
-
Solusvm.expects(:
|
25
|
-
Solusvm::Node.stubs(:new => mock do
|
23
|
+
Solusvm::Node.expects(:new).with(solusvm_params).returns(mock do
|
26
24
|
expects(:successful?).returns(true)
|
27
25
|
expects(:statistics).with("thevserverid").returns("thestats")
|
28
26
|
end)
|
@@ -32,8 +30,7 @@ class TestNodeCli < Test::Unit::TestCase
|
|
32
30
|
end
|
33
31
|
|
34
32
|
def test_should_delegate_node_xenresources_to_node
|
35
|
-
Solusvm.expects(:
|
36
|
-
Solusvm::Node.stubs(:new => mock do
|
33
|
+
Solusvm::Node.expects(:new).with(solusvm_params).returns(mock do
|
37
34
|
expects(:successful?).returns(true)
|
38
35
|
expects(:xenresources).with("thevserverid").returns("theresources")
|
39
36
|
end)
|
@@ -43,8 +40,7 @@ class TestNodeCli < Test::Unit::TestCase
|
|
43
40
|
end
|
44
41
|
|
45
42
|
def test_should_delegate_node_virtualservers_to_node
|
46
|
-
Solusvm.expects(:
|
47
|
-
Solusvm::Node.stubs(:new => mock do
|
43
|
+
Solusvm::Node.expects(:new).with(solusvm_params).returns(mock do
|
48
44
|
expects(:successful?).returns(true)
|
49
45
|
expects(:virtualservers).with("thevserverid").returns("thedata")
|
50
46
|
end)
|
@@ -54,8 +50,7 @@ class TestNodeCli < Test::Unit::TestCase
|
|
54
50
|
end
|
55
51
|
|
56
52
|
def test_should_delegate_nodes_list_to_node
|
57
|
-
Solusvm.expects(:
|
58
|
-
Solusvm::Node.stubs(:new => mock do
|
53
|
+
Solusvm::Node.expects(:new).with(solusvm_params).returns(mock do
|
59
54
|
expects(:successful?).returns(true)
|
60
55
|
expects(:list).with("type").returns("thenodes")
|
61
56
|
end)
|
@@ -65,8 +60,7 @@ class TestNodeCli < Test::Unit::TestCase
|
|
65
60
|
end
|
66
61
|
|
67
62
|
def test_should_delegate_nodes_ids_to_node
|
68
|
-
Solusvm.expects(:
|
69
|
-
Solusvm::Node.stubs(:new => mock do
|
63
|
+
Solusvm::Node.expects(:new).with(solusvm_params).returns(mock do
|
70
64
|
expects(:successful?).returns(true)
|
71
65
|
expects(:ids).with("type").returns("thenodes")
|
72
66
|
end)
|
@@ -75,4 +69,4 @@ class TestNodeCli < Test::Unit::TestCase
|
|
75
69
|
Solusvm::Cli.start(cli_expand_base_arguments(["node", "list-ids", "type"]))
|
76
70
|
end
|
77
71
|
|
78
|
-
end
|
72
|
+
end
|