fog-softlayer 0.4.6 → 0.4.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CONTRIBUTORS.md +1 -0
- data/examples/account.md +82 -0
- data/examples/compute.md +20 -4
- data/examples/network.md +6 -0
- data/lib/fog/softlayer.rb +5 -0
- data/lib/fog/softlayer/account.rb +66 -0
- data/lib/fog/softlayer/compute.rb +0 -2
- data/lib/fog/softlayer/models/account/brand.rb +50 -0
- data/lib/fog/softlayer/models/account/brands.rb +31 -0
- data/lib/fog/softlayer/models/compute/server.rb +52 -17
- data/lib/fog/softlayer/models/network/datacenter.rb +4 -0
- data/lib/fog/softlayer/network.rb +1 -1
- data/lib/fog/softlayer/requests/account/create_brand.rb +41 -0
- data/lib/fog/softlayer/requests/account/get_account_owned_brands.rb +58 -0
- data/lib/fog/softlayer/requests/account/get_brand.rb +36 -0
- data/lib/fog/softlayer/requests/account/get_brand_owned_accounts.rb +111 -0
- data/lib/fog/softlayer/requests/network/get_maintenance_windows.rb +82 -0
- data/lib/fog/softlayer/requests/product/place_order.rb +7 -17
- data/lib/fog/softlayer/storage.rb +11 -0
- data/lib/fog/softlayer/version.rb +1 -1
- data/tests/softlayer/account/helper.rb +8 -0
- data/tests/softlayer/account/schema.rb +38 -0
- data/tests/softlayer/models/account/brand_tests.rb +66 -0
- data/tests/softlayer/models/compute/server_tests.rb +17 -2
- data/tests/softlayer/models/network/datacenter_tests.rb +32 -0
- data/tests/softlayer/network/helper.rb +8 -0
- data/tests/softlayer/network/schema.rb +20 -0
- data/tests/softlayer/requests/account/account_tests.rb +31 -0
- data/tests/softlayer/requests/account/brand_tests.rb +59 -0
- data/tests/softlayer/requests/compute/bmc_tests.rb +56 -1
- data/tests/softlayer/requests/compute/key_pair_tests.rb +0 -7
- data/tests/softlayer/requests/compute/tag_tests.rb +0 -1
- data/tests/softlayer/requests/compute/vm_tests.rb +60 -4
- data/tests/softlayer/requests/network/datacenter_tests.rb +44 -0
- metadata +21 -3
@@ -0,0 +1,38 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Matheus Francisco Barra Mina (<mfbmina@gmail.com>)
|
3
|
+
# © Copyright IBM Corporation 2015.
|
4
|
+
#
|
5
|
+
# LICENSE: MIT (http://opensource.org/licenses/MIT)
|
6
|
+
#
|
7
|
+
|
8
|
+
class Softlayer
|
9
|
+
module Account
|
10
|
+
module Formats
|
11
|
+
module Brand
|
12
|
+
BRAND = {
|
13
|
+
:id => Integer,
|
14
|
+
:catalogId => Integer,
|
15
|
+
:keyName => String,
|
16
|
+
:longName => String,
|
17
|
+
:name => String,
|
18
|
+
:account => Hash
|
19
|
+
}
|
20
|
+
end
|
21
|
+
|
22
|
+
module Collected
|
23
|
+
BRAND = {
|
24
|
+
:id => Fog::Nullable::Integer,
|
25
|
+
:catalog_id => Fog::Nullable::Integer,
|
26
|
+
:name => Fog::Nullable::String,
|
27
|
+
:long_name => Fog::Nullable::String,
|
28
|
+
:key_name => Fog::Nullable::String,
|
29
|
+
:account => Hash
|
30
|
+
}
|
31
|
+
end
|
32
|
+
|
33
|
+
module Collection
|
34
|
+
BRANDS = [Softlayer::Account::Formats::Collected::BRAND]
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Matheus Francisco Barra Mina (<mfbmina@gmail.com>)
|
3
|
+
# © Copyright IBM Corporation 2015.
|
4
|
+
#
|
5
|
+
# LICENSE: MIT (http://opensource.org/licenses/MIT)
|
6
|
+
#
|
7
|
+
|
8
|
+
Shindo.tests("Fog::Account[:softlayer] | brand model", ["softlayer"]) do
|
9
|
+
@sl = Fog::Account[:softlayer]
|
10
|
+
|
11
|
+
tests 'success' do
|
12
|
+
attributes = {
|
13
|
+
'key_name' => "T_B",
|
14
|
+
'long_name' => "Long Test Brand Name",
|
15
|
+
'name' => "My name",
|
16
|
+
'account' => {}
|
17
|
+
}
|
18
|
+
|
19
|
+
tests '#save' do
|
20
|
+
@brand = @sl.brands.new(attributes)
|
21
|
+
response = @brand.save
|
22
|
+
data_matches_schema(Softlayer::Account::Formats::Collected::BRAND) { response }
|
23
|
+
end
|
24
|
+
|
25
|
+
tests '#create' do
|
26
|
+
@brand = @sl.brands.new(attributes)
|
27
|
+
response = @brand.create
|
28
|
+
@brand.id = response[:id]
|
29
|
+
data_matches_schema(Softlayer::Account::Formats::Collected::BRAND) { response }
|
30
|
+
end
|
31
|
+
|
32
|
+
tests '#get_accounts' do
|
33
|
+
data_matches_schema(Array) { @brand.get_accounts }
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
tests 'failure' do
|
38
|
+
attributes = {
|
39
|
+
'key_name' => "T_B",
|
40
|
+
'long_name' => "Long Test Brand Name",
|
41
|
+
'name' => "My name",
|
42
|
+
}
|
43
|
+
|
44
|
+
tests '#save' do
|
45
|
+
@brand = @sl.brands.new(attributes)
|
46
|
+
response = @brand.save
|
47
|
+
data_matches_schema(Hash) { response }
|
48
|
+
end
|
49
|
+
|
50
|
+
tests '#save' do
|
51
|
+
@brand.id = 1
|
52
|
+
raises(StandardError) { @brand.save }
|
53
|
+
end
|
54
|
+
|
55
|
+
tests '#create' do
|
56
|
+
@brand = @sl.brands.new(attributes)
|
57
|
+
response = @brand.create
|
58
|
+
data_matches_schema(Hash) { response }
|
59
|
+
end
|
60
|
+
|
61
|
+
tests '#get_accounts' do
|
62
|
+
response = @brand.get_accounts
|
63
|
+
data_matches_schema(Hash) { response }
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
@@ -76,6 +76,18 @@ Shindo.tests("Fog::Compute[:softlayer] | Server model", ["softlayer"]) do
|
|
76
76
|
data_matches_schema(Array) { @bmc.get_upgrade_options }
|
77
77
|
end
|
78
78
|
|
79
|
+
tests("#update(opts") do
|
80
|
+
bm_opts = {
|
81
|
+
:ram => 4
|
82
|
+
}
|
83
|
+
vm_opts = {
|
84
|
+
:ram => 4,
|
85
|
+
:maintenance_window => 1111
|
86
|
+
}
|
87
|
+
data_matches_schema(Hash) { @vm.update(vm_opts) }
|
88
|
+
data_matches_schema(Hash) { @bmc.update(bm_opts) }
|
89
|
+
end
|
90
|
+
|
79
91
|
tests("#start") do
|
80
92
|
returns(true) { @vm.start }
|
81
93
|
returns(true) { @bmc.start }
|
@@ -140,9 +152,12 @@ Shindo.tests("Fog::Compute[:softlayer] | Server model", ["softlayer"]) do
|
|
140
152
|
|
141
153
|
tests("#destroy") do
|
142
154
|
data_matches_schema(String){ @bmc.destroy }
|
155
|
+
data_matches_schema(String){ @vm.destroy }
|
143
156
|
end
|
144
157
|
|
145
|
-
|
146
|
-
|
158
|
+
tests("#update") do
|
159
|
+
raises(ArgumentError) { @vm.update }
|
160
|
+
raises(ArgumentError) { @bmc.update }
|
161
|
+
end
|
147
162
|
end
|
148
163
|
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Matheus Francisco Barra Mina (<mfbmina@gmail.com>)
|
3
|
+
# © Copyright IBM Corporation 2015.
|
4
|
+
#
|
5
|
+
# LICENSE: MIT (http://opensource.org/licenses/MIT)
|
6
|
+
#
|
7
|
+
|
8
|
+
Shindo.tests("Fog::Network[:softlayer] | Datacenter model", ["softlayer"]) do
|
9
|
+
pending unless Fog.mocking?
|
10
|
+
|
11
|
+
tests("success") do
|
12
|
+
@dc = Fog::Network[:softlayer].datacenters.first
|
13
|
+
|
14
|
+
tests("#get_avaliable_maintenance_windows(begin_date, end_date, slots_number)") do
|
15
|
+
data_matches_schema(Array) { @dc.get_avaliable_maintenance_windows("2015-06-01", "2015-06-02", 1) }
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
tests ("failure") do
|
20
|
+
tests("#get_avaliable_maintenance_windows(nil, end_date, slots_number)") do
|
21
|
+
raises(ArgumentError) { @dc.get_avaliable_maintenance_windows(nil, "2015-06-02", 1) }
|
22
|
+
end
|
23
|
+
|
24
|
+
tests("#get_maintenance_windows(location_id, begin_date, nil, slots_number)") do
|
25
|
+
raises(ArgumentError) { @dc.get_avaliable_maintenance_windows("2015-06-01", nil, 1) }
|
26
|
+
end
|
27
|
+
|
28
|
+
tests("#get_maintenance_windows(location_id, begin_date, end_date)") do
|
29
|
+
raises(ArgumentError) { @dc.get_avaliable_maintenance_windows("2015-06-01", "2015-06-02") }
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Matheus Francisco Barra Mina (<mfbmina@gmail.com>)
|
3
|
+
# © Copyright IBM Corporation 2015.
|
4
|
+
#
|
5
|
+
# LICENSE: MIT (http://opensource.org/licenses/MIT)
|
6
|
+
#
|
7
|
+
|
8
|
+
class Softlayer
|
9
|
+
module Network
|
10
|
+
module Formats
|
11
|
+
module Datacenter
|
12
|
+
DATACENTER = {
|
13
|
+
"id" => Integer,
|
14
|
+
"long_name" => String,
|
15
|
+
"name" => String
|
16
|
+
}
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Matheus Francisco Barra Mina (<mfbmina@gmail.com>)
|
3
|
+
# © Copyright IBM Corporation 2015.
|
4
|
+
#
|
5
|
+
# LICENSE: MIT (http://opensource.org/licenses/MIT)
|
6
|
+
#
|
7
|
+
Shindo.tests("Fog::Account[:softlayer] | account requests", ["softlayer"]) do
|
8
|
+
@sl = Fog::Account[:softlayer]
|
9
|
+
|
10
|
+
tests('success') do
|
11
|
+
tests"#get_account_owned_brands('1')" do
|
12
|
+
response = @sl.get_account_owned_brands(1)
|
13
|
+
data_matches_schema(200) { response.status }
|
14
|
+
data_matches_schema(Array) { response.body }
|
15
|
+
end
|
16
|
+
|
17
|
+
tests"#get_account_owned_brands('1')" do
|
18
|
+
response = @sl.get_account_owned_brands(1)
|
19
|
+
data_matches_schema(200) { response.status }
|
20
|
+
data_matches_schema(Array) { response.body }
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
tests('failure') do
|
25
|
+
tests("#get_account_owned_brands('99999999')") do
|
26
|
+
response = @sl.get_account_owned_brands(99999999)
|
27
|
+
data_matches_schema('SoftLayer_Exception_ObjectNotFound'){ response.body['code'] }
|
28
|
+
data_matches_schema(404){ response.status }
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Matheus Francisco Barra Mina (<mfbmina@gmail.com>)
|
3
|
+
# © Copyright IBM Corporation 2015.
|
4
|
+
#
|
5
|
+
# LICENSE: MIT (http://opensource.org/licenses/MIT)
|
6
|
+
#
|
7
|
+
Shindo.tests("Fog::Account[:softlayer] | brand requests", ["softlayer"]) do
|
8
|
+
@sl = Fog::Account[:softlayer]
|
9
|
+
|
10
|
+
tests 'success' do
|
11
|
+
attributes = {
|
12
|
+
:keyName => "BRAND_NAME",
|
13
|
+
:longName => "Your Long Brand Name",
|
14
|
+
:name => "Brand Name",
|
15
|
+
:account => {}
|
16
|
+
}
|
17
|
+
|
18
|
+
tests '#create_brand(attributes)' do
|
19
|
+
response = @sl.create_brand(attributes)
|
20
|
+
@brand_id = response.body[:id]
|
21
|
+
data_matches_schema(201) { response.status }
|
22
|
+
data_matches_schema(Softlayer::Account::Formats::Brand::BRAND) { response.body }
|
23
|
+
end
|
24
|
+
|
25
|
+
tests "#get_brand('@brand_id')" do
|
26
|
+
response = @sl.get_brand(@brand_id)
|
27
|
+
data_matches_schema(200) { response.status }
|
28
|
+
data_matches_schema(Softlayer::Account::Formats::Brand::BRAND) { response.body }
|
29
|
+
end
|
30
|
+
|
31
|
+
tests "#get_brand_owned_accounts('@brand_id')" do
|
32
|
+
response = @sl.get_brand_owned_accounts(@brand_id)
|
33
|
+
data_matches_schema(200) { response.status }
|
34
|
+
data_matches_schema(Array) { response.body }
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
tests 'failure' do
|
39
|
+
tests "#get_brand('99999999')" do
|
40
|
+
response = @sl.get_brand(99999999)
|
41
|
+
data_matches_schema('SoftLayer_Exception_ObjectNotFound'){ response.body['code'] }
|
42
|
+
data_matches_schema(404){ response.status }
|
43
|
+
end
|
44
|
+
|
45
|
+
tests "#get_brand()" do
|
46
|
+
raises(ArgumentError) { @sl.get_brand }
|
47
|
+
end
|
48
|
+
|
49
|
+
tests "#get_brand_owned_accounts('99999999')" do
|
50
|
+
response = @sl.get_brand_owned_accounts(99999999)
|
51
|
+
data_matches_schema('SoftLayer_Exception_ObjectNotFound'){ response.body['code'] }
|
52
|
+
data_matches_schema(404){ response.status }
|
53
|
+
end
|
54
|
+
|
55
|
+
tests "#get_brand_owned_accounts()" do
|
56
|
+
raises(ArgumentError) { @sl.get_brand_owned_accounts }
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -28,19 +28,36 @@ Shindo.tests("Fog::Compute[:softlayer] | server requests", ["softlayer"]) do
|
|
28
28
|
data_matches_schema(201) { response.status }
|
29
29
|
end
|
30
30
|
|
31
|
+
tests("#create_bare_metal_tags('#{@server_id}', [])") do
|
32
|
+
response = @sl_connection.create_bare_metal_tags(@server_id, [])
|
33
|
+
data_matches_schema(true) {response.body}
|
34
|
+
data_matches_schema(200) {response.status}
|
35
|
+
end
|
36
|
+
|
37
|
+
tests("#delete_bare_metal_tags('#{@server_id}', [])") do
|
38
|
+
response = @sl_connection.delete_bare_metal_tags(@server_id, [])
|
39
|
+
data_matches_schema(true) {response.body}
|
40
|
+
data_matches_schema(200) {response.status}
|
41
|
+
end
|
42
|
+
|
31
43
|
tests("#generate_bare_metal_order_template('#{@bmc}')") do
|
32
44
|
response = @sl_connection.generate_bare_metal_order_template(@bmc)
|
33
45
|
data_matches_schema(Hash) {response.body}
|
34
46
|
data_matches_schema(200) {response.status}
|
35
47
|
end
|
36
48
|
|
49
|
+
tests"#get_bare_metal_server('#{@server_id}'))" do
|
50
|
+
response = @sl_connection.get_bare_metal_server(@server_id)
|
51
|
+
data_matches_schema(200) { response.status }
|
52
|
+
data_matches_schema(Softlayer::Compute::Formats::BareMetal::SERVER) { response.body }
|
53
|
+
end
|
54
|
+
|
37
55
|
tests"#get_bare_metal_server_by_ip('#{@server_ip}'))" do
|
38
56
|
response = @sl_connection.get_bare_metal_server_by_ip(@server_ip)
|
39
57
|
data_matches_schema(200) { response.status }
|
40
58
|
data_matches_schema(Softlayer::Compute::Formats::BareMetal::SERVER) { response.body }
|
41
59
|
end
|
42
60
|
|
43
|
-
|
44
61
|
tests("#get_bare_metal_servers()") do
|
45
62
|
@sl_connection.get_bare_metal_servers.body.each do |bms|
|
46
63
|
data_matches_schema(Softlayer::Compute::Formats::BareMetal::SERVER) { bms }
|
@@ -53,6 +70,12 @@ Shindo.tests("Fog::Compute[:softlayer] | server requests", ["softlayer"]) do
|
|
53
70
|
data_matches_schema(200) {response.status}
|
54
71
|
end
|
55
72
|
|
73
|
+
tests("#get_bare_metal_tags('#{@server_id})'") do
|
74
|
+
response = @sl_connection.get_bare_metal_tags(@server_id)
|
75
|
+
data_matches_schema(Hash) {response.body}
|
76
|
+
data_matches_schema(200) {response.status}
|
77
|
+
end
|
78
|
+
|
56
79
|
tests("#get_bare_metal_users('#{@server_id})'") do
|
57
80
|
response = @sl_connection.get_bare_metal_users(@server_id)
|
58
81
|
data_matches_schema(Array) {response.body}
|
@@ -121,6 +144,12 @@ Shindo.tests("Fog::Compute[:softlayer] | server requests", ["softlayer"]) do
|
|
121
144
|
@sl_connection.create_bare_metal_server([@bmc])
|
122
145
|
end
|
123
146
|
|
147
|
+
tests("#get_bare_metal_server(#{@bmc}") do
|
148
|
+
response = @sl_connection.get_bare_metal_server(@bmc)
|
149
|
+
data_matches_schema('SoftLayer_Exception_ObjectNotFound'){ response.body['code'] }
|
150
|
+
data_matches_schema(404){ response.status }
|
151
|
+
end
|
152
|
+
|
124
153
|
tests("#get_bare_metal_server_by_ip('1.1.1.1')") do
|
125
154
|
response = @sl_connection.get_bare_metal_server_by_ip('1.1.1.1')
|
126
155
|
data_matches_schema('SoftLayer_Exception_ObjectNotFound'){ response.body['code'] }
|
@@ -133,6 +162,32 @@ Shindo.tests("Fog::Compute[:softlayer] | server requests", ["softlayer"]) do
|
|
133
162
|
data_matches_schema(404){ response.status }
|
134
163
|
end
|
135
164
|
|
165
|
+
tests("#get_bare_metal_tags('#{bmc}')") do
|
166
|
+
response = @sl_connection.get_bare_metal_tags(bmc)
|
167
|
+
data_matches_schema('SoftLayer_Exception_ObjectNotFound'){ response.body['code'] }
|
168
|
+
data_matches_schema(404){ response.status }
|
169
|
+
end
|
170
|
+
|
171
|
+
tests("#create_bare_metal_tags('#{bmc}', {})") do
|
172
|
+
raises(ArgumentError) { raise ArgumentError.new }
|
173
|
+
end
|
174
|
+
|
175
|
+
tests("#create_bare_metal_tags('#{bmc}', [])") do
|
176
|
+
response = @sl_connection.create_bare_metal_tags(bmc, [])
|
177
|
+
data_matches_schema('SoftLayer_Exception_ObjectNotFound'){ response.body['code'] }
|
178
|
+
data_matches_schema(404){ response.status }
|
179
|
+
end
|
180
|
+
|
181
|
+
tests("#delete_bare_metal_tags('#{bmc}', {})") do
|
182
|
+
raises(ArgumentError) { raise ArgumentError.new }
|
183
|
+
end
|
184
|
+
|
185
|
+
tests("#delete_bare_metal_tags('#{bmc}', [])") do
|
186
|
+
response = @sl_connection.delete_bare_metal_tags(bmc, [])
|
187
|
+
data_matches_schema('SoftLayer_Exception_ObjectNotFound'){ response.body['code'] }
|
188
|
+
data_matches_schema(404){ response.status }
|
189
|
+
end
|
190
|
+
|
136
191
|
tests("#get_bare_metal_active_tickets('#{bmc}')") do
|
137
192
|
response = @sl_connection.get_bare_metal_active_tickets(bmc)
|
138
193
|
data_matches_schema('SoftLayer_Exception_ObjectNotFound'){ response.body['code'] }
|
@@ -24,7 +24,6 @@ Shindo.tests("Fog::Compute[:softlayer] | key_pair requests", ["softlayer"]) do
|
|
24
24
|
|
25
25
|
|
26
26
|
tests('success') do
|
27
|
-
|
28
27
|
tests("#create_key_pair") do
|
29
28
|
key = @sl_connection.create_key_pair(:key => @key_gen.call, :label => 'test-key-tmp')
|
30
29
|
@kp2 = @sl_connection.key_pairs.get(key.body['id'])
|
@@ -51,11 +50,9 @@ Shindo.tests("Fog::Compute[:softlayer] | key_pair requests", ["softlayer"]) do
|
|
51
50
|
returns(true) { @sl_connection.delete_key_pair(@kp1.id).body }
|
52
51
|
returns(1) { @sl_connection.get_key_pairs.body.count }
|
53
52
|
end
|
54
|
-
|
55
53
|
end
|
56
54
|
|
57
55
|
tests('failure') do
|
58
|
-
|
59
56
|
tests("#get_key_pair").raises(ArgumentError) do
|
60
57
|
@sl_connection.get_key_pair
|
61
58
|
end
|
@@ -71,9 +68,5 @@ Shindo.tests("Fog::Compute[:softlayer] | key_pair requests", ["softlayer"]) do
|
|
71
68
|
tests("#delete_key_pair(#{@kp1.id}") do
|
72
69
|
returns(404) { @sl_connection.delete_key_pair(@kp1.id).status }
|
73
70
|
end
|
74
|
-
|
75
|
-
|
76
|
-
|
77
71
|
end
|
78
|
-
|
79
72
|
end
|
@@ -18,7 +18,6 @@ Shindo.tests("Fog::Compute[:softlayer] | tag requests", ["softlayer"]) do
|
|
18
18
|
test_tags = ['foo', 'bar', 'baz']
|
19
19
|
|
20
20
|
tests('success') do
|
21
|
-
|
22
21
|
tests("#create_vm_tags('#{@vm.id}', #{test_tags})") do
|
23
22
|
returns(true, "returns true") { @sl_connection.create_vm_tags(@vm.id, test_tags).body}
|
24
23
|
end
|
@@ -33,7 +33,8 @@ Shindo.tests("Fog::Compute[:softlayer] | server requests", ["softlayer"]) do
|
|
33
33
|
|
34
34
|
tests("#create_vms('#{@vms}')") do
|
35
35
|
response = @sl_connection.create_vms(@vms)
|
36
|
-
|
36
|
+
data_matches_schema(Array) { response.body }
|
37
|
+
data_matches_schema(Softlayer::Compute::Formats::VirtualGuest::SERVER, {:allow_extra_keys => true}) { response.body.first }
|
37
38
|
data_matches_schema(200) { response.status }
|
38
39
|
end
|
39
40
|
|
@@ -41,27 +42,45 @@ Shindo.tests("Fog::Compute[:softlayer] | server requests", ["softlayer"]) do
|
|
41
42
|
response = @sl_connection.create_vm(@vm)
|
42
43
|
@vm_id = response.body.first['id']
|
43
44
|
@vm_ip = response.body.first['primaryIpAddress']
|
44
|
-
|
45
|
+
data_matches_schema([Softlayer::Compute::Formats::VirtualGuest::SERVER], {:allow_extra_keys => true}) { response.body }
|
45
46
|
data_matches_schema(200) { response.status }
|
46
47
|
end
|
47
48
|
|
49
|
+
tests("#create_vm_tags('#{@vm}', [])") do
|
50
|
+
response = @sl_connection.create_vm_tags(@vm_id, [])
|
51
|
+
data_matches_schema(true) {response.body}
|
52
|
+
data_matches_schema(200) {response.status}
|
53
|
+
end
|
54
|
+
|
48
55
|
tests("#generate_virtual_guest_order_template('#{@vm}')") do
|
49
56
|
response = @sl_connection.generate_virtual_guest_order_template(@vm)
|
50
57
|
data_matches_schema(Hash) {response.body}
|
51
58
|
data_matches_schema(200) {response.status}
|
52
59
|
end
|
53
60
|
|
54
|
-
|
55
61
|
tests"#get_virtual_guest_by_ip('#{@vm_ip}'))" do
|
56
62
|
response = @sl_connection.get_virtual_guest_by_ip(@vm_ip)
|
57
63
|
data_matches_schema(200) { response.status }
|
58
64
|
data_matches_schema(Softlayer::Compute::Formats::VirtualGuest::SERVER) { response.body }
|
59
65
|
end
|
60
66
|
|
67
|
+
tests"#get_vm('#{@vm_id}')" do
|
68
|
+
response = @sl_connection.get_vm(@vm_id)
|
69
|
+
data_matches_schema(200) { response.status }
|
70
|
+
data_matches_schema(Softlayer::Compute::Formats::VirtualGuest::SERVER) { response.body }
|
71
|
+
end
|
72
|
+
|
73
|
+
tests"#get_vm_tags('#{@vm_id}')" do
|
74
|
+
response = @sl_connection.get_vm_tags(@vm_id)
|
75
|
+
data_matches_schema(200) { response.status }
|
76
|
+
data_matches_schema(Softlayer::Compute::Formats::VirtualGuest::SERVER) { response.body }
|
77
|
+
end
|
78
|
+
|
61
79
|
tests"#get_vms()" do
|
62
80
|
response = @sl_connection.get_vms
|
63
81
|
data_matches_schema(200) { response.status }
|
64
|
-
|
82
|
+
data_matches_schema(Array) { response.body }
|
83
|
+
data_matches_schema(Softlayer::Compute::Formats::VirtualGuest::SERVER) { response.body.first }
|
65
84
|
end
|
66
85
|
|
67
86
|
tests("#get_virtual_guest_active_tickets(#{@vm_id})") do
|
@@ -118,6 +137,12 @@ Shindo.tests("Fog::Compute[:softlayer] | server requests", ["softlayer"]) do
|
|
118
137
|
data_matches_schema(200) {response.status}
|
119
138
|
end
|
120
139
|
|
140
|
+
tests("#delete_vm_tags('#{@vm_id})', []") do
|
141
|
+
response = @sl_connection.delete_vm_tags(@vm_id, [])
|
142
|
+
data_matches_schema(true) {response.body}
|
143
|
+
data_matches_schema(200) {response.status}
|
144
|
+
end
|
145
|
+
|
121
146
|
tests("#get_virtual_guest_create_options()") do
|
122
147
|
response = @sl_connection.get_virtual_guest_create_options
|
123
148
|
data_matches_schema(Hash) {response.body}
|
@@ -155,12 +180,34 @@ Shindo.tests("Fog::Compute[:softlayer] | server requests", ["softlayer"]) do
|
|
155
180
|
@sl_connection.create_vm(@vms)
|
156
181
|
end
|
157
182
|
|
183
|
+
tests("#get_vm('99999999999999)") do
|
184
|
+
response = @sl_connection.get_vm('99999999999999')
|
185
|
+
data_matches_schema('SoftLayer_Exception_ObjectNotFound'){ response.body['code'] }
|
186
|
+
data_matches_schema(404) {response.status}
|
187
|
+
end
|
188
|
+
|
189
|
+
tests("#get_vm_tags('99999999999999)") do
|
190
|
+
response = @sl_connection.get_vm_tags('99999999999999')
|
191
|
+
data_matches_schema('SoftLayer_Exception_ObjectNotFound'){ response.body['code'] }
|
192
|
+
data_matches_schema(404) {response.status}
|
193
|
+
end
|
194
|
+
|
158
195
|
tests("#get_virtual_guest_by_ip('1.1.1.1')") do
|
159
196
|
response = @sl_connection.get_virtual_guest_by_ip('1.1.1.1')
|
160
197
|
data_matches_schema('SoftLayer_Exception_ObjectNotFound'){ response.body['code'] }
|
161
198
|
data_matches_schema(404) {response.status}
|
162
199
|
end
|
163
200
|
|
201
|
+
tests("#create_vm_tags('99999999999999')") do
|
202
|
+
raises(ArgumentError) { raise ArgumentError.new }
|
203
|
+
end
|
204
|
+
|
205
|
+
tests("#create_vm_tags('99999999999999', [])") do
|
206
|
+
response = @sl_connection.create_vm_tags(99999999999999, [])
|
207
|
+
data_matches_schema('SoftLayer_Exception_ObjectNotFound'){ response.body['code'] }
|
208
|
+
data_matches_schema(404) {response.status}
|
209
|
+
end
|
210
|
+
|
164
211
|
tests("#get_virtual_guest_users('99999999999999')") do
|
165
212
|
response = @sl_connection.get_virtual_guest_users(99999999999999)
|
166
213
|
data_matches_schema('SoftLayer_Exception_ObjectNotFound'){ response.body['code'] }
|
@@ -215,5 +262,14 @@ Shindo.tests("Fog::Compute[:softlayer] | server requests", ["softlayer"]) do
|
|
215
262
|
data_matches_schema(500) {response.status}
|
216
263
|
end
|
217
264
|
|
265
|
+
tests("#delete_vm_tags('99999999999999', [])'") do
|
266
|
+
response = @sl_connection.delete_vm_tags(99999999999999)
|
267
|
+
data_matches_schema('SoftLayer_Exception_ObjectNotFound'){ response.body['code'] }
|
268
|
+
data_matches_schema(404) {response.status}
|
269
|
+
end
|
270
|
+
|
271
|
+
tests("#delete_vm_tags('99999999999999')") do
|
272
|
+
raises(ArgumentError) { raise ArgumentError.new }
|
273
|
+
end
|
218
274
|
end
|
219
275
|
end
|