solusvm 2.0.0.beta2 → 2.0.0.beta4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +1 -1
- data/lib/solusvm.rb +1 -0
- data/lib/solusvm/cli/server_cli.rb +3 -3
- data/lib/solusvm/server.rb +3 -2
- data/lib/solusvm/version.rb +1 -1
- data/test/cli/test_client_cli.rb +32 -20
- data/test/cli/test_general_cli.rb +12 -6
- data/test/cli/test_node_cli.rb +24 -12
- data/test/cli/test_reseller_cli.rb +59 -49
- data/test/cli/test_server_cli.rb +127 -69
- data/test/solusvm/test_cli.rb +2 -2
- data/test/solusvm/test_server.rb +7 -0
- data/test/test_helper.rb +15 -1
- metadata +36 -36
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d7b577a2b2f0d9e3d4d4a8f2f69316b7e607a150
|
4
|
+
data.tar.gz: abc92d8690f985cce76be047e74d095aeff3a47f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 91c838d21eec7df5b22203874694bab4f0cfaa170d41273dc56bd1c4f47bd37021266b5e15316d1cfa33bc7741cf3f20b7a46a6a2913e212587987bb35081020
|
7
|
+
data.tar.gz: c6d613db43540b0bbf1c67cbbc6f8dd9c914e846e5207bea945e22f568b22fcaac63b7b3761ba51a0cb093a52e2755e8388ef82fe94f1f558d33d2793b5bc37e
|
data/Rakefile
CHANGED
data/lib/solusvm.rb
CHANGED
@@ -56,9 +56,9 @@ module SolusVM
|
|
56
56
|
output api.change_hostname(vserverid, newhostname)
|
57
57
|
end
|
58
58
|
|
59
|
-
desc "addip VSERVERID", "Adds an ip to the server"
|
60
|
-
def addip(vserverid)
|
61
|
-
output api.add_ip(vserverid)
|
59
|
+
desc "addip VSERVERID [ip]", "Adds an ip to the server"
|
60
|
+
def addip(vserverid, ip = nil)
|
61
|
+
output api.add_ip(vserverid, ip)
|
62
62
|
end
|
63
63
|
|
64
64
|
desc "boot VSERVERID", "Boots up a server"
|
data/lib/solusvm/server.rb
CHANGED
@@ -170,10 +170,11 @@ module SolusVM
|
|
170
170
|
# Public: Adds an IP address for a specific server.
|
171
171
|
#
|
172
172
|
# vid - The virtual server ID in SolusVM
|
173
|
+
# ip - Specific IPv4 address to add (optional)
|
173
174
|
#
|
174
175
|
# Returns the IP as a String.
|
175
|
-
def add_ip(vid)
|
176
|
-
perform_request(action: 'vserver-addip', vserverid: vid)
|
176
|
+
def add_ip(vid, ip = nil)
|
177
|
+
perform_request(action: 'vserver-addip', vserverid: vid, ipv4addr: ip)
|
177
178
|
returned_parameters['ipaddress']
|
178
179
|
end
|
179
180
|
|
data/lib/solusvm/version.rb
CHANGED
data/test/cli/test_client_cli.rb
CHANGED
@@ -27,16 +27,18 @@ class TestClientCLI < Test::Unit::TestCase
|
|
27
27
|
end
|
28
28
|
SolusVM::Client.expects(:new).with(solusvm_params).returns(api)
|
29
29
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
30
|
+
out = capture_stdout do
|
31
|
+
SolusVM::CLI.start(cli_expand_base_arguments([
|
32
|
+
"client", "create",
|
33
|
+
"--username", "theusername",
|
34
|
+
"--password", "thepassword",
|
35
|
+
"--email", "theemail",
|
36
|
+
"--firstname", "thefirstname",
|
37
|
+
"--lastname", "thelastname",
|
38
|
+
"--company", "thecompany"
|
39
|
+
]))
|
40
|
+
end
|
41
|
+
assert_match "theresult", out.string
|
40
42
|
end
|
41
43
|
|
42
44
|
def test_should_delegate_client_change_password_to_client
|
@@ -45,8 +47,10 @@ class TestClientCLI < Test::Unit::TestCase
|
|
45
47
|
expects(:change_password).with("theusername", "thepassword").returns("theresult")
|
46
48
|
end)
|
47
49
|
|
48
|
-
|
49
|
-
|
50
|
+
out = capture_stdout do
|
51
|
+
SolusVM::CLI.start(cli_expand_base_arguments(["client", "change-password", "theusername", "thepassword"]))
|
52
|
+
end
|
53
|
+
assert_match "theresult", out.string
|
50
54
|
end
|
51
55
|
|
52
56
|
def test_should_delegate_client_authenticate_to_client
|
@@ -55,8 +59,10 @@ class TestClientCLI < Test::Unit::TestCase
|
|
55
59
|
expects(:authenticate).with("theusername", "thepassword").returns("theresult")
|
56
60
|
end)
|
57
61
|
|
58
|
-
|
59
|
-
|
62
|
+
out = capture_stdout do
|
63
|
+
SolusVM::CLI.start(cli_expand_base_arguments(["client", "authenticate", "theusername", "thepassword"]))
|
64
|
+
end
|
65
|
+
assert_match "theresult", out.string
|
60
66
|
end
|
61
67
|
|
62
68
|
def test_should_delegate_client_check_exists_to_client
|
@@ -65,8 +71,10 @@ class TestClientCLI < Test::Unit::TestCase
|
|
65
71
|
expects(:exists?).with("theusername").returns("theresult")
|
66
72
|
end)
|
67
73
|
|
68
|
-
|
69
|
-
|
74
|
+
out = capture_stdout do
|
75
|
+
SolusVM::CLI.start(cli_expand_base_arguments(["client", "check-exists", "theusername"]))
|
76
|
+
end
|
77
|
+
assert_match "theresult", out.string
|
70
78
|
end
|
71
79
|
|
72
80
|
def test_should_delegate_client_delete_to_client
|
@@ -75,8 +83,10 @@ class TestClientCLI < Test::Unit::TestCase
|
|
75
83
|
expects(:delete).with("theusername").returns("theresult")
|
76
84
|
end)
|
77
85
|
|
78
|
-
|
79
|
-
|
86
|
+
out = capture_stdout do
|
87
|
+
SolusVM::CLI.start(cli_expand_base_arguments(["client", "delete", "theusername"]))
|
88
|
+
end
|
89
|
+
assert_match "theresult", out.string
|
80
90
|
end
|
81
91
|
|
82
92
|
def test_should_delegate_client_list_to_client
|
@@ -85,7 +95,9 @@ class TestClientCLI < Test::Unit::TestCase
|
|
85
95
|
expects(:list).returns("theresult")
|
86
96
|
end)
|
87
97
|
|
88
|
-
|
89
|
-
|
98
|
+
out = capture_stdout do
|
99
|
+
SolusVM::CLI.start(cli_expand_base_arguments(["client", "list"]))
|
100
|
+
end
|
101
|
+
assert_match "theresult", out.string
|
90
102
|
end
|
91
103
|
end
|
@@ -15,8 +15,10 @@ class TestGeneralCLI < Test::Unit::TestCase
|
|
15
15
|
expects(:templates).with("type").returns("thetemplates")
|
16
16
|
end)
|
17
17
|
|
18
|
-
|
19
|
-
|
18
|
+
out = capture_stdout do
|
19
|
+
SolusVM::CLI.start(cli_expand_base_arguments(["general", "templates", "type"]))
|
20
|
+
end
|
21
|
+
assert_match "thetemplates", out.string
|
20
22
|
end
|
21
23
|
|
22
24
|
def test_should_delegate_plans_to_general
|
@@ -25,8 +27,10 @@ class TestGeneralCLI < Test::Unit::TestCase
|
|
25
27
|
expects(:plans).with("type").returns("theplans")
|
26
28
|
end)
|
27
29
|
|
28
|
-
|
29
|
-
|
30
|
+
out = capture_stdout do
|
31
|
+
SolusVM::CLI.start(cli_expand_base_arguments(["general", "plans", "type"]))
|
32
|
+
end
|
33
|
+
assert_match "theplans", out.string
|
30
34
|
end
|
31
35
|
|
32
36
|
def test_should_delegate_isos_to_general
|
@@ -35,7 +39,9 @@ class TestGeneralCLI < Test::Unit::TestCase
|
|
35
39
|
expects(:isos).with("type").returns("theisos")
|
36
40
|
end)
|
37
41
|
|
38
|
-
|
39
|
-
|
42
|
+
out = capture_stdout do
|
43
|
+
SolusVM::CLI.start(cli_expand_base_arguments(["general", "isos", "type"]))
|
44
|
+
end
|
45
|
+
assert_match "theisos", out.string
|
40
46
|
end
|
41
47
|
end
|
data/test/cli/test_node_cli.rb
CHANGED
@@ -15,8 +15,10 @@ class TestNodeCLI < Test::Unit::TestCase
|
|
15
15
|
expects(:available_ips).with("thevserverid").returns("theips")
|
16
16
|
end)
|
17
17
|
|
18
|
-
|
19
|
-
|
18
|
+
out = capture_stdout do
|
19
|
+
SolusVM::CLI.start(cli_expand_base_arguments(["node", "available-ips", "thevserverid"]))
|
20
|
+
end
|
21
|
+
assert_match "theips", out.string
|
20
22
|
end
|
21
23
|
|
22
24
|
def test_should_delegate_node_stats_to_node
|
@@ -25,8 +27,10 @@ class TestNodeCLI < Test::Unit::TestCase
|
|
25
27
|
expects(:statistics).with("thevserverid").returns("thestats")
|
26
28
|
end)
|
27
29
|
|
28
|
-
|
29
|
-
|
30
|
+
out = capture_stdout do
|
31
|
+
SolusVM::CLI.start(cli_expand_base_arguments(["node", "stats", "thevserverid"]))
|
32
|
+
end
|
33
|
+
assert_match "thestats", out.string
|
30
34
|
end
|
31
35
|
|
32
36
|
def test_should_delegate_node_xenresources_to_node
|
@@ -35,8 +39,10 @@ class TestNodeCLI < Test::Unit::TestCase
|
|
35
39
|
expects(:xenresources).with("thevserverid").returns("theresources")
|
36
40
|
end)
|
37
41
|
|
38
|
-
|
39
|
-
|
42
|
+
out = capture_stdout do
|
43
|
+
SolusVM::CLI.start(cli_expand_base_arguments(["node", "xenresources", "thevserverid"]))
|
44
|
+
end
|
45
|
+
assert_match "theresources", out.string
|
40
46
|
end
|
41
47
|
|
42
48
|
def test_should_delegate_node_virtualservers_to_node
|
@@ -45,8 +51,10 @@ class TestNodeCLI < Test::Unit::TestCase
|
|
45
51
|
expects(:virtualservers).with("thevserverid").returns("thedata")
|
46
52
|
end)
|
47
53
|
|
48
|
-
|
49
|
-
|
54
|
+
out = capture_stdout do
|
55
|
+
SolusVM::CLI.start(cli_expand_base_arguments(["node", "virtualservers", "thevserverid"]))
|
56
|
+
end
|
57
|
+
assert_match "thedata", out.string
|
50
58
|
end
|
51
59
|
|
52
60
|
def test_should_delegate_nodes_list_to_node
|
@@ -55,8 +63,10 @@ class TestNodeCLI < Test::Unit::TestCase
|
|
55
63
|
expects(:list).with("type").returns("thenodes")
|
56
64
|
end)
|
57
65
|
|
58
|
-
|
59
|
-
|
66
|
+
out = capture_stdout do
|
67
|
+
SolusVM::CLI.start(cli_expand_base_arguments(["node", "list", "type"]))
|
68
|
+
end
|
69
|
+
assert_match "thenodes", out.string
|
60
70
|
end
|
61
71
|
|
62
72
|
def test_should_delegate_nodes_ids_to_node
|
@@ -65,8 +75,10 @@ class TestNodeCLI < Test::Unit::TestCase
|
|
65
75
|
expects(:ids).with("type").returns("thenodes")
|
66
76
|
end)
|
67
77
|
|
68
|
-
|
69
|
-
|
78
|
+
out = capture_stdout do
|
79
|
+
SolusVM::CLI.start(cli_expand_base_arguments(["node", "list-ids", "type"]))
|
80
|
+
end
|
81
|
+
assert_match "thenodes", out.string
|
70
82
|
end
|
71
83
|
|
72
84
|
end
|
@@ -41,31 +41,33 @@ class TestResellerCLI < Test::Unit::TestCase
|
|
41
41
|
end.returns("theresult")
|
42
42
|
end)
|
43
43
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
44
|
+
out = capture_stdout do
|
45
|
+
SolusVM::CLI.start(cli_expand_base_arguments([
|
46
|
+
"reseller", "create",
|
47
|
+
"--username", "theusername",
|
48
|
+
"--password", "thepassword",
|
49
|
+
"--email", "theemail",
|
50
|
+
"--firstname", "thefirstname",
|
51
|
+
"--lastname", "thelastname",
|
52
|
+
"--company", "thecompany",
|
53
|
+
"--usernameprefix", "theusernameprefix",
|
54
|
+
"--maxvps", "themaxvps",
|
55
|
+
"--maxusers", "themaxusers",
|
56
|
+
"--maxmem", "themaxmem",
|
57
|
+
"--maxburst", "themaxburst",
|
58
|
+
"--maxdisk", "themaxdisk",
|
59
|
+
"--maxbw", "themaxbw",
|
60
|
+
"--maxipv4", "themaxipv4",
|
61
|
+
"--maxipv6", "themaxipv6",
|
62
|
+
"--nodegroups", "thenodegroups",
|
63
|
+
"--mediagroups", "themediagroups",
|
64
|
+
"--openvz", "theopenvz",
|
65
|
+
"--xenpv", "thexenpv",
|
66
|
+
"--xenhvm", "thexenhvm",
|
67
|
+
"--kvm", "thekvm"
|
68
|
+
]))
|
69
|
+
end
|
70
|
+
assert_match "theresult", out.string
|
69
71
|
end
|
70
72
|
|
71
73
|
def test_should_delegate_reseller_change_resources_to_reseller
|
@@ -93,24 +95,26 @@ class TestResellerCLI < Test::Unit::TestCase
|
|
93
95
|
end.returns("theresult")
|
94
96
|
end)
|
95
97
|
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
98
|
+
out = capture_stdout do
|
99
|
+
SolusVM::CLI.start(cli_expand_base_arguments([
|
100
|
+
"reseller", "change-resources",
|
101
|
+
"--maxvps", "themaxvps",
|
102
|
+
"--maxusers", "themaxusers",
|
103
|
+
"--maxmem", "themaxmem",
|
104
|
+
"--maxburst", "themaxburst",
|
105
|
+
"--maxdisk", "themaxdisk",
|
106
|
+
"--maxbw", "themaxbw",
|
107
|
+
"--maxipv4", "themaxipv4",
|
108
|
+
"--maxipv6", "themaxipv6",
|
109
|
+
"--nodegroups", "thenodegroups",
|
110
|
+
"--mediagroups", "themediagroups",
|
111
|
+
"--openvz", "theopenvz",
|
112
|
+
"--xenpv", "thexenpv",
|
113
|
+
"--xenhvm", "thexenhvm",
|
114
|
+
"--kvm", "thekvm"
|
115
|
+
]))
|
116
|
+
end
|
117
|
+
assert_match "theresult", out.string
|
114
118
|
end
|
115
119
|
|
116
120
|
def test_should_delegate_reseller_info_to_reseller
|
@@ -119,8 +123,10 @@ class TestResellerCLI < Test::Unit::TestCase
|
|
119
123
|
expects(:info).with("theusername").returns("theresult")
|
120
124
|
end)
|
121
125
|
|
122
|
-
|
123
|
-
|
126
|
+
out = capture_stdout do
|
127
|
+
SolusVM::CLI.start(cli_expand_base_arguments(["reseller", "info", "theusername"]))
|
128
|
+
end
|
129
|
+
assert_match "theresult", out.string
|
124
130
|
end
|
125
131
|
|
126
132
|
def test_should_delegate_reseller_delete_to_reseller
|
@@ -129,8 +135,10 @@ class TestResellerCLI < Test::Unit::TestCase
|
|
129
135
|
expects(:delete).with("theusername").returns("theresult")
|
130
136
|
end)
|
131
137
|
|
132
|
-
|
133
|
-
|
138
|
+
out = capture_stdout do
|
139
|
+
SolusVM::CLI.start(cli_expand_base_arguments(["reseller", "delete", "theusername"]))
|
140
|
+
end
|
141
|
+
assert_match "theresult", out.string
|
134
142
|
end
|
135
143
|
|
136
144
|
def test_should_delegate_reseller_list_to_reseller
|
@@ -139,7 +147,9 @@ class TestResellerCLI < Test::Unit::TestCase
|
|
139
147
|
expects(:list).returns("theresult")
|
140
148
|
end)
|
141
149
|
|
142
|
-
|
143
|
-
|
150
|
+
out = capture_stdout do
|
151
|
+
SolusVM::CLI.start(cli_expand_base_arguments(["reseller", "list"]))
|
152
|
+
end
|
153
|
+
assert_match "theresult", out.string
|
144
154
|
end
|
145
155
|
end
|
data/test/cli/test_server_cli.rb
CHANGED
@@ -16,8 +16,10 @@ class TestServerCLI < Test::Unit::TestCase
|
|
16
16
|
expects(:status).with("thevserverid").returns("theresult")
|
17
17
|
end)
|
18
18
|
|
19
|
-
|
20
|
-
|
19
|
+
out = capture_stdout do
|
20
|
+
SolusVM::CLI.start(cli_expand_base_arguments(["server", "status", "thevserverid"]))
|
21
|
+
end
|
22
|
+
assert_match "theresult", out.string
|
21
23
|
end
|
22
24
|
|
23
25
|
def test_should_delegate_server_change_plan_to_server
|
@@ -26,8 +28,10 @@ class TestServerCLI < Test::Unit::TestCase
|
|
26
28
|
expects(:change_plan).with("thevserverid", "thenewplan").returns("theresult")
|
27
29
|
end)
|
28
30
|
|
29
|
-
|
30
|
-
|
31
|
+
out = capture_stdout do
|
32
|
+
SolusVM::CLI.start(cli_expand_base_arguments(["server", "change-plan", "thevserverid", "thenewplan"]))
|
33
|
+
end
|
34
|
+
assert_match "theresult", out.string
|
31
35
|
end
|
32
36
|
|
33
37
|
def test_should_delegate_server_change_owner_to_server
|
@@ -36,8 +40,10 @@ class TestServerCLI < Test::Unit::TestCase
|
|
36
40
|
expects(:change_owner).with("thevserverid", "thenewowner").returns("theresult")
|
37
41
|
end)
|
38
42
|
|
39
|
-
|
40
|
-
|
43
|
+
out = capture_stdout do
|
44
|
+
SolusVM::CLI.start(cli_expand_base_arguments(["server", "change-owner", "thevserverid", "thenewowner"]))
|
45
|
+
end
|
46
|
+
assert_match "theresult", out.string
|
41
47
|
end
|
42
48
|
|
43
49
|
def test_should_delegate_server_change_vncpass_to_server
|
@@ -46,8 +52,10 @@ class TestServerCLI < Test::Unit::TestCase
|
|
46
52
|
expects(:change_vncpass).with("thevserverid", "thenewpass").returns("theresult")
|
47
53
|
end)
|
48
54
|
|
49
|
-
|
50
|
-
|
55
|
+
out = capture_stdout do
|
56
|
+
SolusVM::CLI.start(cli_expand_base_arguments(["server", "change-vncpass", "thevserverid", "thenewpass"]))
|
57
|
+
end
|
58
|
+
assert_match "theresult", out.string
|
51
59
|
end
|
52
60
|
|
53
61
|
def test_should_delegate_server_change_rootpass_to_server
|
@@ -56,8 +64,10 @@ class TestServerCLI < Test::Unit::TestCase
|
|
56
64
|
expects(:change_rootpassword).with("thevserverid", "thenewpass").returns("theresult")
|
57
65
|
end)
|
58
66
|
|
59
|
-
|
60
|
-
|
67
|
+
out = capture_stdout do
|
68
|
+
SolusVM::CLI.start(cli_expand_base_arguments(["server", "change-rootpass", "thevserverid", "thenewpass"]))
|
69
|
+
end
|
70
|
+
assert_match "theresult", out.string
|
61
71
|
end
|
62
72
|
|
63
73
|
def test_should_delegate_server_change_bootorder_to_server
|
@@ -66,8 +76,10 @@ class TestServerCLI < Test::Unit::TestCase
|
|
66
76
|
expects(:change_bootorder).with("thevserverid", "theneworder").returns("theresult")
|
67
77
|
end)
|
68
78
|
|
69
|
-
|
70
|
-
|
79
|
+
out = capture_stdout do
|
80
|
+
SolusVM::CLI.start(cli_expand_base_arguments(["server", "change-bootorder", "thevserverid", "theneworder"]))
|
81
|
+
end
|
82
|
+
assert_match "theresult", out.string
|
71
83
|
end
|
72
84
|
|
73
85
|
def test_should_delegate_server_change_hostname_to_server
|
@@ -76,18 +88,22 @@ class TestServerCLI < Test::Unit::TestCase
|
|
76
88
|
expects(:change_hostname).with("thevserverid", "thenewhostname").returns("theresult")
|
77
89
|
end)
|
78
90
|
|
79
|
-
|
80
|
-
|
91
|
+
out = capture_stdout do
|
92
|
+
SolusVM::CLI.start(cli_expand_base_arguments(["server", "change-hostname", "thevserverid", "thenewhostname"]))
|
93
|
+
end
|
94
|
+
assert_match "theresult", out.string
|
81
95
|
end
|
82
96
|
|
83
97
|
def test_should_delegate_server_add_ip_to_server
|
84
98
|
SolusVM::Server.stubs(:new).with(@solusvm_params).returns(mock do
|
85
99
|
expects(:successful?).returns(true)
|
86
|
-
expects(:add_ip).with("thevserverid").returns("theresult")
|
100
|
+
expects(:add_ip).with("thevserverid", "ipv4addr").returns("theresult")
|
87
101
|
end)
|
88
102
|
|
89
|
-
|
90
|
-
|
103
|
+
out = capture_stdout do
|
104
|
+
SolusVM::CLI.start(cli_expand_base_arguments(["server", "addip", "thevserverid", "ipv4addr"]))
|
105
|
+
end
|
106
|
+
assert_match "theresult", out.string
|
91
107
|
end
|
92
108
|
|
93
109
|
def test_should_delegate_server_boot_to_server
|
@@ -96,8 +112,10 @@ class TestServerCLI < Test::Unit::TestCase
|
|
96
112
|
expects(:boot).with("thevserverid").returns("theresult")
|
97
113
|
end)
|
98
114
|
|
99
|
-
|
100
|
-
|
115
|
+
out = capture_stdout do
|
116
|
+
SolusVM::CLI.start(cli_expand_base_arguments(["server", "boot", "thevserverid"]))
|
117
|
+
end
|
118
|
+
assert_match "theresult", out.string
|
101
119
|
end
|
102
120
|
|
103
121
|
def test_should_delegate_server_reboot_to_server
|
@@ -106,8 +124,10 @@ class TestServerCLI < Test::Unit::TestCase
|
|
106
124
|
expects(:reboot).with("thevserverid").returns("theresult")
|
107
125
|
end)
|
108
126
|
|
109
|
-
|
110
|
-
|
127
|
+
out = capture_stdout do
|
128
|
+
SolusVM::CLI.start(cli_expand_base_arguments(["server", "reboot", "thevserverid"]))
|
129
|
+
end
|
130
|
+
assert_match "theresult", out.string
|
111
131
|
end
|
112
132
|
|
113
133
|
def test_should_delegate_server_shutdown_to_server
|
@@ -116,8 +136,10 @@ class TestServerCLI < Test::Unit::TestCase
|
|
116
136
|
expects(:shutdown).with("thevserverid").returns("theresult")
|
117
137
|
end)
|
118
138
|
|
119
|
-
|
120
|
-
|
139
|
+
out = capture_stdout do
|
140
|
+
SolusVM::CLI.start(cli_expand_base_arguments(["server", "shutdown", "thevserverid"]))
|
141
|
+
end
|
142
|
+
assert_match "theresult", out.string
|
121
143
|
end
|
122
144
|
|
123
145
|
def test_should_delegate_server_suspend_to_server
|
@@ -126,8 +148,10 @@ class TestServerCLI < Test::Unit::TestCase
|
|
126
148
|
expects(:suspend).with("thevserverid").returns("theresult")
|
127
149
|
end)
|
128
150
|
|
129
|
-
|
130
|
-
|
151
|
+
out = capture_stdout do
|
152
|
+
SolusVM::CLI.start(cli_expand_base_arguments(["server", "suspend", "thevserverid"]))
|
153
|
+
end
|
154
|
+
assert_match "theresult", out.string
|
131
155
|
end
|
132
156
|
|
133
157
|
def test_should_delegate_server_resume_to_server
|
@@ -136,8 +160,10 @@ class TestServerCLI < Test::Unit::TestCase
|
|
136
160
|
expects(:resume).with("thevserverid").returns("theresult")
|
137
161
|
end)
|
138
162
|
|
139
|
-
|
140
|
-
|
163
|
+
out = capture_stdout do
|
164
|
+
SolusVM::CLI.start(cli_expand_base_arguments(["server", "resume", "thevserverid"]))
|
165
|
+
end
|
166
|
+
assert_match "theresult", out.string
|
141
167
|
end
|
142
168
|
|
143
169
|
def test_should_delegate_server_check_exists_to_server
|
@@ -146,8 +172,10 @@ class TestServerCLI < Test::Unit::TestCase
|
|
146
172
|
expects(:exists?).with("thevserverid").returns("theresult")
|
147
173
|
end)
|
148
174
|
|
149
|
-
|
150
|
-
|
175
|
+
out = capture_stdout do
|
176
|
+
SolusVM::CLI.start(cli_expand_base_arguments(["server", "check-exists", "thevserverid"]))
|
177
|
+
end
|
178
|
+
assert_match "theresult", out.string
|
151
179
|
end
|
152
180
|
|
153
181
|
def test_should_delegate_server_terminate_to_server
|
@@ -156,8 +184,10 @@ class TestServerCLI < Test::Unit::TestCase
|
|
156
184
|
expects(:terminate).with("thevserverid").returns("theresult")
|
157
185
|
end)
|
158
186
|
|
159
|
-
|
160
|
-
|
187
|
+
out = capture_stdout do
|
188
|
+
SolusVM::CLI.start(cli_expand_base_arguments(["server", "terminate", "thevserverid"]))
|
189
|
+
end
|
190
|
+
assert_match "theresult", out.string
|
161
191
|
end
|
162
192
|
|
163
193
|
def test_should_delegate_server_rebuild_to_server
|
@@ -166,8 +196,10 @@ class TestServerCLI < Test::Unit::TestCase
|
|
166
196
|
expects(:rebuild).with("thevserverid", template: "thetemplate").returns("theresult")
|
167
197
|
end)
|
168
198
|
|
169
|
-
|
170
|
-
|
199
|
+
out = capture_stdout do
|
200
|
+
SolusVM::CLI.start(cli_expand_base_arguments(["server", "rebuild", "thevserverid", "--template", "thetemplate"]))
|
201
|
+
end
|
202
|
+
assert_match "theresult", out.string
|
171
203
|
end
|
172
204
|
|
173
205
|
def test_should_delegate_server_tun_switcher_on_to_server
|
@@ -176,8 +208,10 @@ class TestServerCLI < Test::Unit::TestCase
|
|
176
208
|
expects(:tun_enable).with("thevserverid").returns("theresult")
|
177
209
|
end)
|
178
210
|
|
179
|
-
|
180
|
-
|
211
|
+
out = capture_stdout do
|
212
|
+
SolusVM::CLI.start(cli_expand_base_arguments(["server", "tun-switcher", "thevserverid", "on"]))
|
213
|
+
end
|
214
|
+
assert_match "theresult", out.string
|
181
215
|
end
|
182
216
|
|
183
217
|
def test_should_delegate_server_tun_switcher_off_to_server
|
@@ -186,8 +220,10 @@ class TestServerCLI < Test::Unit::TestCase
|
|
186
220
|
expects(:tun_disable).with("thevserverid").returns("theresult")
|
187
221
|
end)
|
188
222
|
|
189
|
-
|
190
|
-
|
223
|
+
out = capture_stdout do
|
224
|
+
SolusVM::CLI.start(cli_expand_base_arguments(["server", "tun-switcher", "thevserverid", "off"]))
|
225
|
+
end
|
226
|
+
assert_match "theresult", out.string
|
191
227
|
end
|
192
228
|
|
193
229
|
def test_should_delegate_server_network_switcher_on_to_server
|
@@ -196,8 +232,10 @@ class TestServerCLI < Test::Unit::TestCase
|
|
196
232
|
expects(:network_enable).with("thevserverid").returns("theresult")
|
197
233
|
end)
|
198
234
|
|
199
|
-
|
200
|
-
|
235
|
+
out = capture_stdout do
|
236
|
+
SolusVM::CLI.start(cli_expand_base_arguments(["server", "network-switcher", "thevserverid", "on"]))
|
237
|
+
end
|
238
|
+
assert_match "theresult", out.string
|
201
239
|
end
|
202
240
|
|
203
241
|
def test_should_delegate_server_network_switcher_off_to_server
|
@@ -206,8 +244,10 @@ class TestServerCLI < Test::Unit::TestCase
|
|
206
244
|
expects(:network_disable).with("thevserverid").returns("theresult")
|
207
245
|
end)
|
208
246
|
|
209
|
-
|
210
|
-
|
247
|
+
out = capture_stdout do
|
248
|
+
SolusVM::CLI.start(cli_expand_base_arguments(["server", "network-switcher", "thevserverid", "off"]))
|
249
|
+
end
|
250
|
+
assert_match "theresult", out.string
|
211
251
|
end
|
212
252
|
|
213
253
|
def test_should_delegate_server_pae_switcher_on_to_server
|
@@ -216,8 +256,10 @@ class TestServerCLI < Test::Unit::TestCase
|
|
216
256
|
expects(:pae_enable).with("thevserverid").returns("theresult")
|
217
257
|
end)
|
218
258
|
|
219
|
-
|
220
|
-
|
259
|
+
out = capture_stdout do
|
260
|
+
SolusVM::CLI.start(cli_expand_base_arguments(["server", "pae-switcher", "thevserverid", "on"]))
|
261
|
+
end
|
262
|
+
assert_match "theresult", out.string
|
221
263
|
end
|
222
264
|
|
223
265
|
def test_should_delegate_server_pae_switcher_off_to_server
|
@@ -226,8 +268,10 @@ class TestServerCLI < Test::Unit::TestCase
|
|
226
268
|
expects(:pae_disable).with("thevserverid").returns("theresult")
|
227
269
|
end)
|
228
270
|
|
229
|
-
|
230
|
-
|
271
|
+
out = capture_stdout do
|
272
|
+
SolusVM::CLI.start(cli_expand_base_arguments(["server", "pae-switcher", "thevserverid", "off"]))
|
273
|
+
end
|
274
|
+
assert_match "theresult", out.string
|
231
275
|
end
|
232
276
|
|
233
277
|
def test_should_delegate_server_info_to_server
|
@@ -236,8 +280,10 @@ class TestServerCLI < Test::Unit::TestCase
|
|
236
280
|
expects(:info).with("thevserverid").returns("theresult")
|
237
281
|
end)
|
238
282
|
|
239
|
-
|
240
|
-
|
283
|
+
out = capture_stdout do
|
284
|
+
SolusVM::CLI.start(cli_expand_base_arguments(["server", "info", "thevserverid"]))
|
285
|
+
end
|
286
|
+
assert_match "theresult", out.string
|
241
287
|
end
|
242
288
|
|
243
289
|
def test_should_delegate_server_vnc_to_server
|
@@ -246,8 +292,10 @@ class TestServerCLI < Test::Unit::TestCase
|
|
246
292
|
expects(:vnc).with("thevserverid").returns("theresult")
|
247
293
|
end)
|
248
294
|
|
249
|
-
|
250
|
-
|
295
|
+
out = capture_stdout do
|
296
|
+
SolusVM::CLI.start(cli_expand_base_arguments(["server", "vnc", "thevserverid"]))
|
297
|
+
end
|
298
|
+
assert_match "theresult", out.string
|
251
299
|
end
|
252
300
|
|
253
301
|
def test_should_delegate_server_console_to_server
|
@@ -256,8 +304,10 @@ class TestServerCLI < Test::Unit::TestCase
|
|
256
304
|
expects(:console).with("thevserverid").returns("theresult")
|
257
305
|
end)
|
258
306
|
|
259
|
-
|
260
|
-
|
307
|
+
out = capture_stdout do
|
308
|
+
SolusVM::CLI.start(cli_expand_base_arguments(["server", "console", "thevserverid"]))
|
309
|
+
end
|
310
|
+
assert_match "theresult", out.string
|
261
311
|
end
|
262
312
|
|
263
313
|
def test_should_delegate_server_info_all_to_server
|
@@ -266,8 +316,10 @@ class TestServerCLI < Test::Unit::TestCase
|
|
266
316
|
expects(:info_all).with("thevserverid").returns("theresult")
|
267
317
|
end)
|
268
318
|
|
269
|
-
|
270
|
-
|
319
|
+
out = capture_stdout do
|
320
|
+
SolusVM::CLI.start(cli_expand_base_arguments(["server", "info-all", "thevserverid"]))
|
321
|
+
end
|
322
|
+
assert_match "theresult", out.string
|
271
323
|
end
|
272
324
|
|
273
325
|
def test_should_delegate_server_mountiso_to_server
|
@@ -276,8 +328,10 @@ class TestServerCLI < Test::Unit::TestCase
|
|
276
328
|
expects(:mountiso).with("thevserverid", "theiso").returns("theresult")
|
277
329
|
end)
|
278
330
|
|
279
|
-
|
280
|
-
|
331
|
+
out = capture_stdout do
|
332
|
+
SolusVM::CLI.start(cli_expand_base_arguments(["server", "mountiso", "thevserverid", "theiso"]))
|
333
|
+
end
|
334
|
+
assert_match "theresult", out.string
|
281
335
|
end
|
282
336
|
|
283
337
|
def test_should_delegate_server_unmountiso_to_server
|
@@ -286,8 +340,10 @@ class TestServerCLI < Test::Unit::TestCase
|
|
286
340
|
expects(:unmountiso).with("thevserverid").returns("theresult")
|
287
341
|
end)
|
288
342
|
|
289
|
-
|
290
|
-
|
343
|
+
out = capture_stdout do
|
344
|
+
SolusVM::CLI.start(cli_expand_base_arguments(["server", "unmountiso", "thevserverid"]))
|
345
|
+
end
|
346
|
+
assert_match "theresult", out.string
|
291
347
|
end
|
292
348
|
|
293
349
|
def test_should_delegate_server_create_to_server
|
@@ -300,17 +356,19 @@ class TestServerCLI < Test::Unit::TestCase
|
|
300
356
|
).returns("theresult")
|
301
357
|
end)
|
302
358
|
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
359
|
+
out = capture_stdout do
|
360
|
+
SolusVM::CLI.start(cli_expand_base_arguments([
|
361
|
+
"server", "create",
|
362
|
+
"thehostname",
|
363
|
+
"thepassword",
|
364
|
+
"--plan", "theplan",
|
365
|
+
"--ips", "theips",
|
366
|
+
"--kind", "thekind",
|
367
|
+
"--username", "theusername",
|
368
|
+
"--template", "thetemplate",
|
369
|
+
"--node", "thenode"
|
370
|
+
]))
|
371
|
+
end
|
372
|
+
assert_match "theresult", out.string
|
315
373
|
end
|
316
374
|
end
|
data/test/solusvm/test_cli.rb
CHANGED
@@ -10,8 +10,8 @@ class TestCLI < Test::Unit::TestCase
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def test_should_print_version
|
13
|
-
|
14
|
-
SolusVM::
|
13
|
+
out = capture_stdout { SolusVM::CLI.start %W(version) }
|
14
|
+
assert_match SolusVM::VERSION, out.string
|
15
15
|
end
|
16
16
|
|
17
17
|
end
|
data/test/solusvm/test_server.rb
CHANGED
@@ -146,6 +146,13 @@ class TestServer < Test::Unit::TestCase
|
|
146
146
|
assert @server.successful?
|
147
147
|
end
|
148
148
|
|
149
|
+
def test_add_specific_ip
|
150
|
+
stub_response 'server/add-ip'
|
151
|
+
|
152
|
+
assert_equal '123.123.123.123', @server.add_ip(1, '123.123.123.123')
|
153
|
+
assert @server.successful?
|
154
|
+
end
|
155
|
+
|
149
156
|
def test_del_ip
|
150
157
|
stub_response 'server/del-ip'
|
151
158
|
|
data/test/test_helper.rb
CHANGED
@@ -1,9 +1,23 @@
|
|
1
|
+
require 'stringio'
|
1
2
|
require 'test/unit'
|
2
3
|
require 'solusvm'
|
3
4
|
require 'mocha/setup'
|
4
5
|
require 'sham_rack'
|
5
6
|
require 'set'
|
6
|
-
|
7
|
+
|
8
|
+
module Kernel
|
9
|
+
# Public: Redirect $stdout to an instance of StringIO.
|
10
|
+
#
|
11
|
+
# Returns the captured output as a StringIO.
|
12
|
+
def capture_stdout
|
13
|
+
out = StringIO.new
|
14
|
+
$stdout = out
|
15
|
+
yield
|
16
|
+
return out
|
17
|
+
ensure
|
18
|
+
$stdout = STDOUT
|
19
|
+
end
|
20
|
+
end
|
7
21
|
|
8
22
|
class Test::Unit::TestCase
|
9
23
|
# Public: Stubs a JSON reponse using ShamRack.
|
metadata
CHANGED
@@ -1,127 +1,127 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: solusvm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.0.
|
4
|
+
version: 2.0.0.beta4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Mazzi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-06-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - '>='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.19.1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - '>='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: 0.19.1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: faraday
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
33
|
+
version: 0.9.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ~>
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.
|
40
|
+
version: 0.9.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: mocha
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ~>
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: 1.0.0
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ~>
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 1.0.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ~>
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: 10.1.1
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ~>
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 10.1.1
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: rake-tomdoc
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - "~>"
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: 0.0.1
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - "~>"
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: 0.0.1
|
83
69
|
- !ruby/object:Gem::Dependency
|
84
70
|
name: sham_rack
|
85
71
|
requirement: !ruby/object:Gem::Requirement
|
86
72
|
requirements:
|
87
|
-
- -
|
73
|
+
- - ~>
|
88
74
|
- !ruby/object:Gem::Version
|
89
75
|
version: 1.3.6
|
90
76
|
type: :development
|
91
77
|
prerelease: false
|
92
78
|
version_requirements: !ruby/object:Gem::Requirement
|
93
79
|
requirements:
|
94
|
-
- -
|
80
|
+
- - ~>
|
95
81
|
- !ruby/object:Gem::Version
|
96
82
|
version: 1.3.6
|
97
83
|
- !ruby/object:Gem::Dependency
|
98
84
|
name: sinatra
|
99
85
|
requirement: !ruby/object:Gem::Requirement
|
100
86
|
requirements:
|
101
|
-
- -
|
87
|
+
- - ~>
|
102
88
|
- !ruby/object:Gem::Version
|
103
89
|
version: 1.4.4
|
104
90
|
type: :development
|
105
91
|
prerelease: false
|
106
92
|
version_requirements: !ruby/object:Gem::Requirement
|
107
93
|
requirements:
|
108
|
-
- -
|
94
|
+
- - ~>
|
109
95
|
- !ruby/object:Gem::Version
|
110
96
|
version: 1.4.4
|
111
97
|
- !ruby/object:Gem::Dependency
|
112
98
|
name: test-unit
|
113
99
|
requirement: !ruby/object:Gem::Requirement
|
114
100
|
requirements:
|
115
|
-
- -
|
101
|
+
- - ~>
|
116
102
|
- !ruby/object:Gem::Version
|
117
103
|
version: 2.5.5
|
118
104
|
type: :development
|
119
105
|
prerelease: false
|
120
106
|
version_requirements: !ruby/object:Gem::Requirement
|
121
107
|
requirements:
|
122
|
-
- -
|
108
|
+
- - ~>
|
123
109
|
- !ruby/object:Gem::Version
|
124
110
|
version: 2.5.5
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rake-tomdoc
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ~>
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 0.0.2
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ~>
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 0.0.2
|
125
125
|
description: SolusVM allows for easy interaction with the SolusVM Admin::API.
|
126
126
|
email:
|
127
127
|
- jmazzi@gmail.com
|
@@ -239,12 +239,12 @@ require_paths:
|
|
239
239
|
- lib
|
240
240
|
required_ruby_version: !ruby/object:Gem::Requirement
|
241
241
|
requirements:
|
242
|
-
- -
|
242
|
+
- - '>='
|
243
243
|
- !ruby/object:Gem::Version
|
244
244
|
version: '0'
|
245
245
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
246
246
|
requirements:
|
247
|
-
- -
|
247
|
+
- - '>'
|
248
248
|
- !ruby/object:Gem::Version
|
249
249
|
version: 1.3.1
|
250
250
|
requirements: []
|