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.
@@ -10,32 +10,31 @@ class TestResellerCli < Test::Unit::TestCase
10
10
  end
11
11
 
12
12
  def test_should_delegate_reseller_create_to_reseller
13
- Solusvm.expects(:config).with("thelogin", "thekey", { :url => "theurl" })
14
- Solusvm::Reseller.stubs(:new => mock do
13
+ Solusvm::Reseller.expects(:new).with(solusvm_params).returns(mock do
15
14
  expects(:successful?).returns(true)
16
15
  expects(:create).with() do |options|
17
16
  expected = {
18
- :username => "theusername",
19
- :password => "thepassword",
20
- :email => "theemail",
21
- :firstname => "thefirstname",
22
- :lastname => "thelastname",
23
- :company => "thecompany",
24
- :usernameprefix => "theusernameprefix",
25
- :maxvps => "themaxvps",
26
- :maxusers => "themaxusers",
27
- :maxmem => "themaxmem",
28
- :maxburst => "themaxburst",
29
- :maxdisk => "themaxdisk",
30
- :maxbw => "themaxbw",
31
- :maxipv4 => "themaxipv4",
32
- :maxipv6 => "themaxipv6",
33
- :nodegroups => "thenodegroups",
34
- :mediagroups => "themediagroups",
35
- :openvz => "theopenvz",
36
- :xenpv => "thexenpv",
37
- :xenhvm => "thexenhvm",
38
- :kvm => "thekvm"
17
+ username: "theusername",
18
+ password: "thepassword",
19
+ email: "theemail",
20
+ firstname: "thefirstname",
21
+ lastname: "thelastname",
22
+ company: "thecompany",
23
+ usernameprefix: "theusernameprefix",
24
+ maxvps: "themaxvps",
25
+ maxusers: "themaxusers",
26
+ maxmem: "themaxmem",
27
+ maxburst: "themaxburst",
28
+ maxdisk: "themaxdisk",
29
+ maxbw: "themaxbw",
30
+ maxipv4: "themaxipv4",
31
+ maxipv6: "themaxipv6",
32
+ nodegroups: "thenodegroups",
33
+ mediagroups: "themediagroups",
34
+ openvz: "theopenvz",
35
+ xenpv: "thexenpv",
36
+ xenhvm: "thexenhvm",
37
+ kvm: "thekvm"
39
38
  }
40
39
 
41
40
  expected.all? { |k,v| options[k] == v }
@@ -70,25 +69,24 @@ class TestResellerCli < Test::Unit::TestCase
70
69
  end
71
70
 
72
71
  def test_should_delegate_reseller_change_resources_to_reseller
73
- Solusvm.expects(:config).with("thelogin", "thekey", { :url => "theurl" })
74
- Solusvm::Reseller.stubs(:new => mock do
72
+ Solusvm::Reseller.expects(:new).with(solusvm_params).returns(mock do
75
73
  expects(:successful?).returns(true)
76
74
  expects(:change_resources).with() do |options|
77
75
  expected = {
78
- :maxvps => "themaxvps",
79
- :maxusers => "themaxusers",
80
- :maxmem => "themaxmem",
81
- :maxburst => "themaxburst",
82
- :maxdisk => "themaxdisk",
83
- :maxbw => "themaxbw",
84
- :maxipv4 => "themaxipv4",
85
- :maxipv6 => "themaxipv6",
86
- :nodegroups => "thenodegroups",
87
- :mediagroups => "themediagroups",
88
- :openvz => "theopenvz",
89
- :xenpv => "thexenpv",
90
- :xenhvm => "thexenhvm",
91
- :kvm => "thekvm"
76
+ maxvps: "themaxvps",
77
+ maxusers: "themaxusers",
78
+ maxmem: "themaxmem",
79
+ maxburst: "themaxburst",
80
+ maxdisk: "themaxdisk",
81
+ maxbw: "themaxbw",
82
+ maxipv4: "themaxipv4",
83
+ maxipv6: "themaxipv6",
84
+ nodegroups: "thenodegroups",
85
+ mediagroups: "themediagroups",
86
+ openvz: "theopenvz",
87
+ xenpv: "thexenpv",
88
+ xenhvm: "thexenhvm",
89
+ kvm: "thekvm"
92
90
  }
93
91
 
94
92
  expected.all? { |k,v| options[k] == v }
@@ -116,8 +114,7 @@ class TestResellerCli < Test::Unit::TestCase
116
114
  end
117
115
 
118
116
  def test_should_delegate_reseller_info_to_reseller
119
- Solusvm.expects(:config).with("thelogin", "thekey", { :url => "theurl" })
120
- Solusvm::Reseller.stubs(:new => mock do
117
+ Solusvm::Reseller.expects(:new).with(solusvm_params).returns(mock do
121
118
  expects(:successful?).returns(true)
122
119
  expects(:info).with("theusername").returns("theresult")
123
120
  end)
@@ -127,8 +124,7 @@ class TestResellerCli < Test::Unit::TestCase
127
124
  end
128
125
 
129
126
  def test_should_delegate_reseller_delete_to_reseller
130
- Solusvm.expects(:config).with("thelogin", "thekey", { :url => "theurl" })
131
- Solusvm::Reseller.stubs(:new => mock do
127
+ Solusvm::Reseller.expects(:new).with(solusvm_params).returns(mock do
132
128
  expects(:successful?).returns(true)
133
129
  expects(:delete).with("theusername").returns("theresult")
134
130
  end)
@@ -138,8 +134,7 @@ class TestResellerCli < Test::Unit::TestCase
138
134
  end
139
135
 
140
136
  def test_should_delegate_reseller_list_to_reseller
141
- Solusvm.expects(:config).with("thelogin", "thekey", { :url => "theurl" })
142
- Solusvm::Reseller.stubs(:new => mock do
137
+ Solusvm::Reseller.expects(:new).with(solusvm_params).returns(mock do
143
138
  expects(:successful?).returns(true)
144
139
  expects(:list).returns("theresult")
145
140
  end)
@@ -147,4 +142,4 @@ class TestResellerCli < Test::Unit::TestCase
147
142
  $stdout.expects(:puts).with("theresult")
148
143
  Solusvm::Cli.start(cli_expand_base_arguments(["reseller", "list"]))
149
144
  end
150
- end
145
+ end
@@ -7,11 +7,11 @@ class TestServerCli < Test::Unit::TestCase
7
7
  # Prevents mocha from stubbing non existent methods so that we now if the CLI is failing because
8
8
  # something was moved around.
9
9
  Mocha::Configuration.prevent(:stubbing_non_existent_method)
10
+ @solusvm_params = { api_id: "api_id", api_key: "api_key", url: "http://www.example.com/api" }
10
11
  end
11
12
 
12
13
  def test_should_delegate_server_status_to_server
13
- Solusvm.expects(:config).with("thelogin", "thekey", { :url => "theurl" })
14
- Solusvm::Server.stubs(:new => mock do
14
+ Solusvm::Server.expects(:new).with(@solusvm_params).returns(mock do
15
15
  expects(:successful?).returns(true)
16
16
  expects(:status).with("thevserverid").returns("theresult")
17
17
  end)
@@ -21,8 +21,7 @@ class TestServerCli < Test::Unit::TestCase
21
21
  end
22
22
 
23
23
  def test_should_delegate_server_change_plan_to_server
24
- Solusvm.expects(:config).with("thelogin", "thekey", { :url => "theurl" })
25
- Solusvm::Server.stubs(:new => mock do
24
+ Solusvm::Server.stubs(:new).with(@solusvm_params).returns(mock do
26
25
  expects(:successful?).returns(true)
27
26
  expects(:change_plan).with("thevserverid", "thenewplan").returns("theresult")
28
27
  end)
@@ -32,8 +31,7 @@ class TestServerCli < Test::Unit::TestCase
32
31
  end
33
32
 
34
33
  def test_should_delegate_server_change_owner_to_server
35
- Solusvm.expects(:config).with("thelogin", "thekey", { :url => "theurl" })
36
- Solusvm::Server.stubs(:new => mock do
34
+ Solusvm::Server.stubs(:new).with(@solusvm_params).returns(mock do
37
35
  expects(:successful?).returns(true)
38
36
  expects(:change_owner).with("thevserverid", "thenewowner").returns("theresult")
39
37
  end)
@@ -43,8 +41,7 @@ class TestServerCli < Test::Unit::TestCase
43
41
  end
44
42
 
45
43
  def test_should_delegate_server_change_consolepass_to_server
46
- Solusvm.expects(:config).with("thelogin", "thekey", { :url => "theurl" })
47
- Solusvm::Server.stubs(:new => mock do
44
+ Solusvm::Server.stubs(:new).with(@solusvm_params).returns(mock do
48
45
  expects(:successful?).returns(true)
49
46
  expects(:change_consolepass).with("thevserverid", "thenewpass").returns("theresult")
50
47
  end)
@@ -54,8 +51,7 @@ class TestServerCli < Test::Unit::TestCase
54
51
  end
55
52
 
56
53
  def test_should_delegate_server_change_vncpass_to_server
57
- Solusvm.expects(:config).with("thelogin", "thekey", { :url => "theurl" })
58
- Solusvm::Server.stubs(:new => mock do
54
+ Solusvm::Server.stubs(:new).with(@solusvm_params).returns(mock do
59
55
  expects(:successful?).returns(true)
60
56
  expects(:change_vncpass).with("thevserverid", "thenewpass").returns("theresult")
61
57
  end)
@@ -65,8 +61,7 @@ class TestServerCli < Test::Unit::TestCase
65
61
  end
66
62
 
67
63
  def test_should_delegate_server_change_rootpass_to_server
68
- Solusvm.expects(:config).with("thelogin", "thekey", { :url => "theurl" })
69
- Solusvm::Server.stubs(:new => mock do
64
+ Solusvm::Server.stubs(:new).with(@solusvm_params).returns(mock do
70
65
  expects(:successful?).returns(true)
71
66
  expects(:change_rootpassword).with("thevserverid", "thenewpass").returns("theresult")
72
67
  end)
@@ -76,8 +71,7 @@ class TestServerCli < Test::Unit::TestCase
76
71
  end
77
72
 
78
73
  def test_should_delegate_server_change_bootorder_to_server
79
- Solusvm.expects(:config).with("thelogin", "thekey", { :url => "theurl" })
80
- Solusvm::Server.stubs(:new => mock do
74
+ Solusvm::Server.stubs(:new).with(@solusvm_params).returns(mock do
81
75
  expects(:successful?).returns(true)
82
76
  expects(:change_bootorder).with("thevserverid", "theneworder").returns("theresult")
83
77
  end)
@@ -87,8 +81,7 @@ class TestServerCli < Test::Unit::TestCase
87
81
  end
88
82
 
89
83
  def test_should_delegate_server_change_hostname_to_server
90
- Solusvm.expects(:config).with("thelogin", "thekey", { :url => "theurl" })
91
- Solusvm::Server.stubs(:new => mock do
84
+ Solusvm::Server.stubs(:new).with(@solusvm_params).returns(mock do
92
85
  expects(:successful?).returns(true)
93
86
  expects(:change_hostname).with("thevserverid", "thenewhostname").returns("theresult")
94
87
  end)
@@ -98,8 +91,7 @@ class TestServerCli < Test::Unit::TestCase
98
91
  end
99
92
 
100
93
  def test_should_delegate_server_add_ip_to_server
101
- Solusvm.expects(:config).with("thelogin", "thekey", { :url => "theurl" })
102
- Solusvm::Server.stubs(:new => mock do
94
+ Solusvm::Server.stubs(:new).with(@solusvm_params).returns(mock do
103
95
  expects(:successful?).returns(true)
104
96
  expects(:add_ip).with("thevserverid").returns("theresult")
105
97
  end)
@@ -109,8 +101,7 @@ class TestServerCli < Test::Unit::TestCase
109
101
  end
110
102
 
111
103
  def test_should_delegate_server_boot_to_server
112
- Solusvm.expects(:config).with("thelogin", "thekey", { :url => "theurl" })
113
- Solusvm::Server.stubs(:new => mock do
104
+ Solusvm::Server.stubs(:new).with(@solusvm_params).returns(mock do
114
105
  expects(:successful?).returns(true)
115
106
  expects(:boot).with("thevserverid").returns("theresult")
116
107
  end)
@@ -120,8 +111,7 @@ class TestServerCli < Test::Unit::TestCase
120
111
  end
121
112
 
122
113
  def test_should_delegate_server_reboot_to_server
123
- Solusvm.expects(:config).with("thelogin", "thekey", { :url => "theurl" })
124
- Solusvm::Server.stubs(:new => mock do
114
+ Solusvm::Server.stubs(:new).with(@solusvm_params).returns(mock do
125
115
  expects(:successful?).returns(true)
126
116
  expects(:reboot).with("thevserverid").returns("theresult")
127
117
  end)
@@ -131,8 +121,7 @@ class TestServerCli < Test::Unit::TestCase
131
121
  end
132
122
 
133
123
  def test_should_delegate_server_shutdown_to_server
134
- Solusvm.expects(:config).with("thelogin", "thekey", { :url => "theurl" })
135
- Solusvm::Server.stubs(:new => mock do
124
+ Solusvm::Server.stubs(:new).with(@solusvm_params).returns(mock do
136
125
  expects(:successful?).returns(true)
137
126
  expects(:shutdown).with("thevserverid").returns("theresult")
138
127
  end)
@@ -142,8 +131,7 @@ class TestServerCli < Test::Unit::TestCase
142
131
  end
143
132
 
144
133
  def test_should_delegate_server_suspend_to_server
145
- Solusvm.expects(:config).with("thelogin", "thekey", { :url => "theurl" })
146
- Solusvm::Server.stubs(:new => mock do
134
+ Solusvm::Server.stubs(:new).with(@solusvm_params).returns(mock do
147
135
  expects(:successful?).returns(true)
148
136
  expects(:suspend).with("thevserverid").returns("theresult")
149
137
  end)
@@ -153,8 +141,7 @@ class TestServerCli < Test::Unit::TestCase
153
141
  end
154
142
 
155
143
  def test_should_delegate_server_resume_to_server
156
- Solusvm.expects(:config).with("thelogin", "thekey", { :url => "theurl" })
157
- Solusvm::Server.stubs(:new => mock do
144
+ Solusvm::Server.stubs(:new).with(@solusvm_params).returns(mock do
158
145
  expects(:successful?).returns(true)
159
146
  expects(:resume).with("thevserverid").returns("theresult")
160
147
  end)
@@ -164,8 +151,7 @@ class TestServerCli < Test::Unit::TestCase
164
151
  end
165
152
 
166
153
  def test_should_delegate_server_check_exists_to_server
167
- Solusvm.expects(:config).with("thelogin", "thekey", { :url => "theurl" })
168
- Solusvm::Server.stubs(:new => mock do
154
+ Solusvm::Server.stubs(:new).with(@solusvm_params).returns(mock do
169
155
  expects(:successful?).returns(true)
170
156
  expects(:exists?).with("thevserverid").returns("theresult")
171
157
  end)
@@ -175,8 +161,7 @@ class TestServerCli < Test::Unit::TestCase
175
161
  end
176
162
 
177
163
  def test_should_delegate_server_terminate_to_server
178
- Solusvm.expects(:config).with("thelogin", "thekey", { :url => "theurl" })
179
- Solusvm::Server.stubs(:new => mock do
164
+ Solusvm::Server.stubs(:new).with(@solusvm_params).returns(mock do
180
165
  expects(:successful?).returns(true)
181
166
  expects(:terminate).with("thevserverid").returns("theresult")
182
167
  end)
@@ -186,10 +171,9 @@ class TestServerCli < Test::Unit::TestCase
186
171
  end
187
172
 
188
173
  def test_should_delegate_server_rebuild_to_server
189
- Solusvm.expects(:config).with("thelogin", "thekey", { :url => "theurl" })
190
- Solusvm::Server.stubs(:new => mock do
174
+ Solusvm::Server.stubs(:new).with(@solusvm_params).returns(mock do
191
175
  expects(:successful?).returns(true)
192
- expects(:rebuild).with("thevserverid", :template => "thetemplate").returns("theresult")
176
+ expects(:rebuild).with("thevserverid", template: "thetemplate").returns("theresult")
193
177
  end)
194
178
 
195
179
  $stdout.expects(:puts).with("theresult")
@@ -197,8 +181,7 @@ class TestServerCli < Test::Unit::TestCase
197
181
  end
198
182
 
199
183
  def test_should_delegate_server_tun_switcher_on_to_server
200
- Solusvm.expects(:config).with("thelogin", "thekey", { :url => "theurl" })
201
- Solusvm::Server.stubs(:new => mock do
184
+ Solusvm::Server.stubs(:new).with(@solusvm_params).returns(mock do
202
185
  expects(:successful?).returns(true)
203
186
  expects(:tun_enable).with("thevserverid").returns("theresult")
204
187
  end)
@@ -208,8 +191,7 @@ class TestServerCli < Test::Unit::TestCase
208
191
  end
209
192
 
210
193
  def test_should_delegate_server_tun_switcher_off_to_server
211
- Solusvm.expects(:config).with("thelogin", "thekey", { :url => "theurl" })
212
- Solusvm::Server.stubs(:new => mock do
194
+ Solusvm::Server.stubs(:new).with(@solusvm_params).returns(mock do
213
195
  expects(:successful?).returns(true)
214
196
  expects(:tun_disable).with("thevserverid").returns("theresult")
215
197
  end)
@@ -219,8 +201,7 @@ class TestServerCli < Test::Unit::TestCase
219
201
  end
220
202
 
221
203
  def test_should_delegate_server_network_switcher_on_to_server
222
- Solusvm.expects(:config).with("thelogin", "thekey", { :url => "theurl" })
223
- Solusvm::Server.stubs(:new => mock do
204
+ Solusvm::Server.stubs(:new).with(@solusvm_params).returns(mock do
224
205
  expects(:successful?).returns(true)
225
206
  expects(:network_enable).with("thevserverid").returns("theresult")
226
207
  end)
@@ -230,8 +211,7 @@ class TestServerCli < Test::Unit::TestCase
230
211
  end
231
212
 
232
213
  def test_should_delegate_server_network_switcher_off_to_server
233
- Solusvm.expects(:config).with("thelogin", "thekey", { :url => "theurl" })
234
- Solusvm::Server.stubs(:new => mock do
214
+ Solusvm::Server.stubs(:new).with(@solusvm_params).returns(mock do
235
215
  expects(:successful?).returns(true)
236
216
  expects(:network_disable).with("thevserverid").returns("theresult")
237
217
  end)
@@ -241,8 +221,7 @@ class TestServerCli < Test::Unit::TestCase
241
221
  end
242
222
 
243
223
  def test_should_delegate_server_pae_switcher_on_to_server
244
- Solusvm.expects(:config).with("thelogin", "thekey", { :url => "theurl" })
245
- Solusvm::Server.stubs(:new => mock do
224
+ Solusvm::Server.stubs(:new).with(@solusvm_params).returns(mock do
246
225
  expects(:successful?).returns(true)
247
226
  expects(:pae_enable).with("thevserverid").returns("theresult")
248
227
  end)
@@ -252,8 +231,7 @@ class TestServerCli < Test::Unit::TestCase
252
231
  end
253
232
 
254
233
  def test_should_delegate_server_pae_switcher_off_to_server
255
- Solusvm.expects(:config).with("thelogin", "thekey", { :url => "theurl" })
256
- Solusvm::Server.stubs(:new => mock do
234
+ Solusvm::Server.stubs(:new).with(@solusvm_params).returns(mock do
257
235
  expects(:successful?).returns(true)
258
236
  expects(:pae_disable).with("thevserverid").returns("theresult")
259
237
  end)
@@ -263,8 +241,7 @@ class TestServerCli < Test::Unit::TestCase
263
241
  end
264
242
 
265
243
  def test_should_delegate_server_info_to_server
266
- Solusvm.expects(:config).with("thelogin", "thekey", { :url => "theurl" })
267
- Solusvm::Server.stubs(:new => mock do
244
+ Solusvm::Server.stubs(:new).with(@solusvm_params).returns(mock do
268
245
  expects(:successful?).returns(true)
269
246
  expects(:info).with("thevserverid").returns("theresult")
270
247
  end)
@@ -274,8 +251,7 @@ class TestServerCli < Test::Unit::TestCase
274
251
  end
275
252
 
276
253
  def test_should_delegate_server_vnc_to_server
277
- Solusvm.expects(:config).with("thelogin", "thekey", { :url => "theurl" })
278
- Solusvm::Server.stubs(:new => mock do
254
+ Solusvm::Server.stubs(:new).with(@solusvm_params).returns(mock do
279
255
  expects(:successful?).returns(true)
280
256
  expects(:vnc).with("thevserverid").returns("theresult")
281
257
  end)
@@ -285,8 +261,7 @@ class TestServerCli < Test::Unit::TestCase
285
261
  end
286
262
 
287
263
  def test_should_delegate_server_console_to_server
288
- Solusvm.expects(:config).with("thelogin", "thekey", { :url => "theurl" })
289
- Solusvm::Server.stubs(:new => mock do
264
+ Solusvm::Server.stubs(:new).with(@solusvm_params).returns(mock do
290
265
  expects(:successful?).returns(true)
291
266
  expects(:console).with("thevserverid").returns("theresult")
292
267
  end)
@@ -296,8 +271,7 @@ class TestServerCli < Test::Unit::TestCase
296
271
  end
297
272
 
298
273
  def test_should_delegate_server_info_all_to_server
299
- Solusvm.expects(:config).with("thelogin", "thekey", { :url => "theurl" })
300
- Solusvm::Server.stubs(:new => mock do
274
+ Solusvm::Server.stubs(:new).with(@solusvm_params).returns(mock do
301
275
  expects(:successful?).returns(true)
302
276
  expects(:info_all).with("thevserverid").returns("theresult")
303
277
  end)
@@ -307,8 +281,7 @@ class TestServerCli < Test::Unit::TestCase
307
281
  end
308
282
 
309
283
  def test_should_delegate_server_mountiso_to_server
310
- Solusvm.expects(:config).with("thelogin", "thekey", { :url => "theurl" })
311
- Solusvm::Server.stubs(:new => mock do
284
+ Solusvm::Server.stubs(:new).with(@solusvm_params).returns(mock do
312
285
  expects(:successful?).returns(true)
313
286
  expects(:mountiso).with("thevserverid", "theiso").returns("theresult")
314
287
  end)
@@ -318,8 +291,7 @@ class TestServerCli < Test::Unit::TestCase
318
291
  end
319
292
 
320
293
  def test_should_delegate_server_unmountiso_to_server
321
- Solusvm.expects(:config).with("thelogin", "thekey", { :url => "theurl" })
322
- Solusvm::Server.stubs(:new => mock do
294
+ Solusvm::Server.stubs(:new).with(@solusvm_params).returns(mock do
323
295
  expects(:successful?).returns(true)
324
296
  expects(:unmountiso).with("thevserverid").returns("theresult")
325
297
  end)
@@ -329,13 +301,12 @@ class TestServerCli < Test::Unit::TestCase
329
301
  end
330
302
 
331
303
  def test_should_delegate_server_create_to_server
332
- Solusvm.expects(:config).with("thelogin", "thekey", { :url => "theurl" })
333
- Solusvm::Server.stubs(:new => mock do
304
+ Solusvm::Server.stubs(:new).with(@solusvm_params).returns(mock do
334
305
  expects(:successful?).returns(true)
335
306
  expects(:create).with(
336
307
  "thehostname", "thepassword",
337
- :plan => "theplan", :ips => "theips", :type => "thekind",
338
- :username => "theusername", :template => "thetemplate", :node => "thenode"
308
+ plan: "theplan", ips: "theips", type: "thekind",
309
+ username: "theusername", template: "thetemplate", node: "thenode"
339
310
  ).returns("theresult")
340
311
  end)
341
312
 
@@ -352,5 +323,4 @@ class TestServerCli < Test::Unit::TestCase
352
323
  "--node", "thenode"
353
324
  ]))
354
325
  end
355
-
356
- end
326
+ end
@@ -3,8 +3,7 @@ require 'test_helper'
3
3
  class TestBase < Test::Unit::TestCase
4
4
 
5
5
  def setup
6
- setup_solusvm
7
- @base = Solusvm::Base.new
6
+ @base = Solusvm::Base.new(solusvm_params)
8
7
  end
9
8
 
10
9
  def test_valid_server_types
@@ -15,7 +14,7 @@ class TestBase < Test::Unit::TestCase
15
14
  def test_parse_response
16
15
  assert_nil @base.returned_parameters
17
16
  VCR.use_cassette "base/parse_response" do
18
- @base.perform_request(:action => 'test', :vserverid => 1)
17
+ @base.perform_request(action: 'test', vserverid: 1)
19
18
  end
20
19
  params = @base.returned_parameters
21
20
 
@@ -34,11 +33,20 @@ class TestBase < Test::Unit::TestCase
34
33
 
35
34
  def test_successful
36
35
  VCR.use_cassette "base/successful" do
37
- @base.perform_request(:action => 'testsuccess', :vserverid => 1)
36
+ @base.perform_request(action: 'testsuccess', vserverid: 1)
38
37
  assert @base.successful?
39
38
 
40
- @base.perform_request(:action => 'testfail', :vserverid => 1)
39
+ @base.perform_request(action: 'testfail', vserverid: 1)
41
40
  assert_equal "error message", @base.statusmsg
41
+
42
+ @base.perform_request(action: 'testnostatus', vserverid: 1)
43
+ assert @base.successful?
44
+ end
45
+
46
+ VCR.use_cassette "base/successful_instance_config" do
47
+ @base = Solusvm::Base.new(api_key: "instance_key", api_id: "instance_id", url: "http://www.test.com/api" )
48
+ @base.perform_request(action: 'testconfig', vserverid: 1)
49
+ assert @base.successful?
42
50
  end
43
51
  end
44
52
 
@@ -48,7 +56,7 @@ class TestBase < Test::Unit::TestCase
48
56
 
49
57
  def test_statusmsg
50
58
  VCR.use_cassette "base/statusmsg" do
51
- @base.perform_request(:action => 'testsuccess', :vserverid => 1)
59
+ @base.perform_request(action: 'testsuccess', vserverid: 1)
52
60
  end
53
61
  assert_equal 'Virtual server created', @base.statusmsg
54
62
  end
@@ -65,7 +73,7 @@ class TestBase < Test::Unit::TestCase
65
73
 
66
74
  def test_unautorized_ip
67
75
  VCR.use_cassette "base/unauthorized_ip" do
68
- @base.perform_request(:action => 'unauthorized')
76
+ @base.perform_request(action: 'unauthorized')
69
77
 
70
78
  assert !@base.successful?
71
79
  assert_equal "This IP is not authorized to use the API", @base.statusmsg
@@ -74,7 +82,7 @@ class TestBase < Test::Unit::TestCase
74
82
 
75
83
  def test_invalid_key_or_id
76
84
  VCR.use_cassette "base/invalid_key" do
77
- @base.perform_request(:action => 'badkey')
85
+ @base.perform_request(action: 'badkey')
78
86
 
79
87
  assert !@base.successful?
80
88
  assert_equal "Invalid ID or key", @base.statusmsg
@@ -83,7 +91,7 @@ class TestBase < Test::Unit::TestCase
83
91
 
84
92
  def test_node_does_not_exist
85
93
  VCR.use_cassette "base/nonexistent_node" do
86
- @base.perform_request(:action => 'nodeexist')
94
+ @base.perform_request(action: 'nodeexist')
87
95
 
88
96
  assert !@base.successful?
89
97
  assert_equal "Node does not exist", @base.statusmsg
@@ -92,7 +100,7 @@ class TestBase < Test::Unit::TestCase
92
100
 
93
101
  def test_invalid_http_status
94
102
  VCR.use_cassette "base/invalid_status" do
95
- @base.perform_request(:action => 'httperror')
103
+ @base.perform_request(action: 'httperror')
96
104
 
97
105
  assert !@base.successful?
98
106
  assert_equal "Bad HTTP Status: 404", @base.statusmsg