squall 1.2.1beta1 → 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/lib/squall/support/base.rb +4 -4
- data/lib/squall/support/exception.rb +0 -9
- data/lib/squall/support/version.rb +1 -1
- data/lib/squall.rb +0 -1
- data/spec/squall/data_store_zone_spec.rb +8 -20
- data/spec/squall/firewall_rule_spec.rb +0 -12
- data/spec/squall/hypervisor_spec.rb +24 -38
- data/spec/squall/hypervisor_zone_spec.rb +34 -46
- data/spec/squall/ip_address_join_spec.rb +1 -15
- data/spec/squall/ip_address_spec.rb +2 -6
- data/spec/squall/network_spec.rb +2 -12
- data/spec/squall/network_zone_spec.rb +15 -43
- data/spec/squall/payment_spec.rb +9 -22
- data/spec/squall/role_spec.rb +4 -16
- data/spec/squall/support/base_spec.rb +16 -10
- data/spec/squall/template_spec.rb +3 -8
- data/spec/squall/transaction_spec.rb +2 -6
- data/spec/squall/user_group_spec.rb +6 -14
- data/spec/squall/user_spec.rb +12 -44
- data/spec/squall/virtual_machine_spec.rb +0 -102
- data/spec/squall/whitelist_spec.rb +10 -26
- data/squall.gemspec +1 -1
- metadata +76 -161
- data/.rbenv-version +0 -1
- data/lib/squall/support/on_app_errors.rb +0 -23
data/lib/squall/support/base.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
Faraday.register_middleware :response, :on_app_errors => Squall::OnAppErrors
|
2
|
-
|
3
1
|
module Squall
|
4
2
|
# All OnApp API classes subclass Base to get access to
|
5
3
|
# HTTParty methods and other convenience methods
|
@@ -44,20 +42,22 @@ module Squall
|
|
44
42
|
# request :put, '/something.json', :something => 1 # PUT /something.json?something=1
|
45
43
|
def request(request_method, path, options = {})
|
46
44
|
check_config
|
45
|
+
|
47
46
|
conn = Faraday.new(:url => Squall.config[:base_uri]) do |c|
|
48
47
|
c.basic_auth Squall.config[:username], Squall.config[:password]
|
49
48
|
c.params = (options[:query] || {})
|
50
49
|
c.request :url_encoded
|
51
|
-
c.response :on_app_errors
|
52
50
|
c.response :json
|
53
51
|
c.adapter :net_http
|
54
52
|
if Squall.config[:debug]
|
55
53
|
c.use Faraday::Response::Logger
|
56
54
|
end
|
57
55
|
end
|
56
|
+
|
58
57
|
response = conn.send(request_method, path)
|
58
|
+
|
59
59
|
@success = (200..207).include?(response.env[:status])
|
60
|
-
@result
|
60
|
+
@result = response.body
|
61
61
|
end
|
62
62
|
|
63
63
|
# Raises an error if a request is made without first calling Squall.config
|
@@ -1,13 +1,4 @@
|
|
1
1
|
module Squall
|
2
2
|
# Config missing
|
3
3
|
class NoConfig < StandardError;end
|
4
|
-
|
5
|
-
# HTTP 404 not found
|
6
|
-
class NotFoundError < StandardError;end
|
7
|
-
|
8
|
-
# HTTP 422
|
9
|
-
class ClientError < StandardError;end
|
10
|
-
|
11
|
-
# HTTP 500 error
|
12
|
-
class ServerError < StandardError;end
|
13
4
|
end
|
data/lib/squall.rb
CHANGED
@@ -8,7 +8,7 @@ describe Squall::DataStoreZone do
|
|
8
8
|
|
9
9
|
describe "#list" do
|
10
10
|
use_vcr_cassette "data_store_zone/list"
|
11
|
-
|
11
|
+
|
12
12
|
it "returns all data store zones" do
|
13
13
|
data_store_zones = @data_store_zone.list
|
14
14
|
data_store_zones.should be_an(Array)
|
@@ -19,30 +19,26 @@ describe Squall::DataStoreZone do
|
|
19
19
|
data_store_zones.all? {|w| w.is_a?(Hash) }.should be_true
|
20
20
|
end
|
21
21
|
end
|
22
|
-
|
22
|
+
|
23
23
|
describe "#show" do
|
24
24
|
use_vcr_cassette "data_store_zone/show"
|
25
25
|
it "requires an id" do
|
26
26
|
expect { @data_store_zone.show }.to raise_error(ArgumentError)
|
27
27
|
end
|
28
28
|
|
29
|
-
it "returns not found for invalid data store zone id" do
|
30
|
-
expect { @data_store_zone.show(404) }.to raise_error(Squall::NotFoundError)
|
31
|
-
end
|
32
|
-
|
33
29
|
it "returns a data store zone" do
|
34
30
|
data_store_zone = @data_store_zone.show(1)
|
35
31
|
data_store_zone.should be_a(Hash)
|
36
32
|
end
|
37
33
|
end
|
38
|
-
|
34
|
+
|
39
35
|
describe "#create" do
|
40
36
|
use_vcr_cassette "data_store_zone/create"
|
41
37
|
it "requires label" do
|
42
38
|
invalid = @valid.reject{|k,v| k == :label }
|
43
39
|
requires_attr(:label) { @data_store_zone.create(invalid) }
|
44
40
|
end
|
45
|
-
|
41
|
+
|
46
42
|
it "raises error on unknown params" do
|
47
43
|
expect { @data_store_zone.create(@valid.merge(:what => 'what')) }.to raise_error(ArgumentError, 'Unknown params: what')
|
48
44
|
end
|
@@ -52,10 +48,10 @@ describe Squall::DataStoreZone do
|
|
52
48
|
@data_store_zone.success.should be_true
|
53
49
|
end
|
54
50
|
end
|
55
|
-
|
51
|
+
|
56
52
|
describe "#edit" do
|
57
53
|
use_vcr_cassette "data_store_zone/edit"
|
58
|
-
|
54
|
+
|
59
55
|
it "allows select params" do
|
60
56
|
optional = [:label]
|
61
57
|
@data_store_zone.should_receive(:request).exactly(optional.size).times.and_return Hash.new()
|
@@ -63,7 +59,7 @@ describe Squall::DataStoreZone do
|
|
63
59
|
@data_store_zone.edit(1, param => "test")
|
64
60
|
end
|
65
61
|
end
|
66
|
-
|
62
|
+
|
67
63
|
it "raises error on unknown params" do
|
68
64
|
expect { @data_store_zone.edit(1, @valid.merge(:what => 'what')) }.to raise_error(ArgumentError, 'Unknown params: what')
|
69
65
|
end
|
@@ -72,12 +68,8 @@ describe Squall::DataStoreZone do
|
|
72
68
|
@data_store_zone.edit(1, :label => "Updated zone")
|
73
69
|
@data_store_zone.success.should be_true
|
74
70
|
end
|
75
|
-
|
76
|
-
it "raises an error for an invalid data store zone id" do
|
77
|
-
expect { @data_store_zone.edit(404, @valid) }.to raise_error(Squall::NotFoundError)
|
78
|
-
end
|
79
71
|
end
|
80
|
-
|
72
|
+
|
81
73
|
describe "#delete" do
|
82
74
|
use_vcr_cassette "data_store_zone/delete"
|
83
75
|
it "requires an id" do
|
@@ -88,10 +80,6 @@ describe Squall::DataStoreZone do
|
|
88
80
|
@data_store_zone.delete(1)
|
89
81
|
@data_store_zone.success.should be_true
|
90
82
|
end
|
91
|
-
|
92
|
-
it "returns NotFound for invalid data store zone id" do
|
93
|
-
expect { @data_store_zone.delete(404) }.to raise_error(Squall::NotFoundError)
|
94
|
-
end
|
95
83
|
end
|
96
84
|
|
97
85
|
end
|
@@ -53,10 +53,6 @@ describe Squall::FirewallRule do
|
|
53
53
|
expect { @firewall_rule.create(1, @valid.merge(:what => 'what')) }.to raise_error(ArgumentError, 'Unknown params: what')
|
54
54
|
end
|
55
55
|
|
56
|
-
it "raises an error for an invalid vm id" do
|
57
|
-
expect { @firewall_rule.create(404, @valid) }.to raise_error(Squall::NotFoundError)
|
58
|
-
end
|
59
|
-
|
60
56
|
it "creates a firewall rule for a virtual machine" do
|
61
57
|
@firewall_rule.create(1, @valid)
|
62
58
|
@firewall_rule.success.should be_true
|
@@ -82,10 +78,6 @@ describe Squall::FirewallRule do
|
|
82
78
|
@firewall_rule.edit(1, 1, :port => 1000)
|
83
79
|
@firewall_rule.success.should be_true
|
84
80
|
end
|
85
|
-
|
86
|
-
it "raises an error for an invalid firewall rule id" do
|
87
|
-
expect { @firewall_rule.edit(1, 404, @valid) }.to raise_error(Squall::NotFoundError)
|
88
|
-
end
|
89
81
|
end
|
90
82
|
|
91
83
|
describe "#delete" do
|
@@ -99,10 +91,6 @@ describe Squall::FirewallRule do
|
|
99
91
|
@firewall_rule.delete(1, 1)
|
100
92
|
@firewall_rule.success.should be_true
|
101
93
|
end
|
102
|
-
|
103
|
-
it "returns NotFound for missing virtual machine" do
|
104
|
-
expect { @firewall_rule.delete(1, 404) }.to raise_error(Squall::NotFoundError)
|
105
|
-
end
|
106
94
|
end
|
107
95
|
|
108
96
|
end
|
@@ -13,12 +13,12 @@ describe Squall::Hypervisor do
|
|
13
13
|
hvs = @hv.list
|
14
14
|
hvs.should be_an(Array)
|
15
15
|
end
|
16
|
-
|
16
|
+
|
17
17
|
it "contains hypervisor data" do
|
18
18
|
hvs = @hv.list
|
19
19
|
hvs.all?.should be_true
|
20
20
|
end
|
21
|
-
|
21
|
+
|
22
22
|
end
|
23
23
|
|
24
24
|
describe "#show" do
|
@@ -27,10 +27,6 @@ describe Squall::Hypervisor do
|
|
27
27
|
expect { @hv.show }.to raise_error(ArgumentError)
|
28
28
|
end
|
29
29
|
|
30
|
-
it "returns not found for invalid hvs" do
|
31
|
-
expect { @hv.show(404) }.to raise_error(Squall::NotFoundError)
|
32
|
-
end
|
33
|
-
|
34
30
|
it "returns a hv" do
|
35
31
|
@hv.show(1)
|
36
32
|
@hv.success.should be_true
|
@@ -88,11 +84,6 @@ describe Squall::Hypervisor do
|
|
88
84
|
@hv.success.should be_false
|
89
85
|
end
|
90
86
|
|
91
|
-
it "404s on not found" do
|
92
|
-
expect { @hv.reboot(404) }.to raise_error(Squall::NotFoundError)
|
93
|
-
@hv.success.should be_false
|
94
|
-
end
|
95
|
-
|
96
87
|
it "reboots the hypervisor" do
|
97
88
|
reboot = @hv.reboot(1)
|
98
89
|
@hv.success.should be_true
|
@@ -105,92 +96,87 @@ describe Squall::Hypervisor do
|
|
105
96
|
expect { @hv.delete }.to raise_error(ArgumentError)
|
106
97
|
end
|
107
98
|
|
108
|
-
it "404s on not found" do
|
109
|
-
expect { @hv.delete(404) }.to raise_error(Squall::NotFoundError)
|
110
|
-
@hv.success.should be_false
|
111
|
-
end
|
112
|
-
|
113
99
|
it "returns a hv" do
|
114
100
|
@hv.delete(1)
|
115
101
|
@hv.success.should be_true
|
116
102
|
end
|
117
103
|
end
|
118
|
-
|
104
|
+
|
119
105
|
describe "#data_store_joins" do
|
120
106
|
use_vcr_cassette "hypervisor/data_store_joins"
|
121
|
-
|
107
|
+
|
122
108
|
it "returns a list of data store joins" do
|
123
109
|
joins = @hv.data_store_joins(1)
|
124
110
|
joins.should be_an(Array)
|
125
111
|
end
|
126
|
-
|
112
|
+
|
127
113
|
it "contains the data store join data" do
|
128
114
|
joins = @hv.data_store_joins(1)
|
129
115
|
joins.all? {|w| w.is_a?(Hash) }.should be_true
|
130
116
|
end
|
131
|
-
|
117
|
+
|
132
118
|
end
|
133
|
-
|
119
|
+
|
134
120
|
describe "#add_data_store_join" do
|
135
121
|
use_vcr_cassette "hypervisor/add_data_store_join"
|
136
|
-
|
122
|
+
|
137
123
|
it "adds the data store to the hypervisor zone" do
|
138
124
|
@hv.add_data_store_join(1, 1)
|
139
125
|
@hv.success.should be_true
|
140
126
|
end
|
141
|
-
|
127
|
+
|
142
128
|
end
|
143
|
-
|
129
|
+
|
144
130
|
describe "#remove_data_store_join" do
|
145
131
|
use_vcr_cassette "hypervisor/remove_data_store_join"
|
146
|
-
|
132
|
+
|
147
133
|
it "removes the data store from the hypervisor zone" do
|
148
134
|
@hv.remove_data_store_join(1, 1)
|
149
135
|
@hv.success.should be_true
|
150
136
|
end
|
151
|
-
|
137
|
+
|
152
138
|
end
|
153
|
-
|
139
|
+
|
154
140
|
describe "#network_joins" do
|
155
141
|
use_vcr_cassette "hypervisor/network_joins"
|
156
|
-
|
142
|
+
|
157
143
|
it "returns a list of network joins" do
|
158
144
|
joins = @hv.network_joins(1)
|
159
145
|
joins.should be_an(Array)
|
160
146
|
end
|
161
|
-
|
147
|
+
|
162
148
|
it "contains the network join data" do
|
163
149
|
joins = @hv.network_joins(1)
|
164
150
|
joins.all? {|w| w.is_a?(Hash) }.should be_true
|
165
151
|
end
|
166
|
-
|
152
|
+
|
167
153
|
end
|
168
|
-
|
154
|
+
|
169
155
|
describe "#add_network_join" do
|
170
156
|
use_vcr_cassette "hypervisor/add_network_join"
|
171
|
-
|
157
|
+
|
172
158
|
it "requires network id" do
|
173
159
|
requires_attr(:network_id) { @hv.add_network_join(1, :interface => "interface") }
|
174
160
|
end
|
175
|
-
|
161
|
+
|
176
162
|
it "requires interface" do
|
177
163
|
requires_attr(:interface) { @hv.add_network_join(1, :network_id => 1) }
|
178
164
|
end
|
179
|
-
|
165
|
+
|
180
166
|
it "adds the network to the hypervisor zone" do
|
181
167
|
@hv.add_network_join(1, :network_id => 1, :interface => "interface")
|
182
168
|
@hv.success.should be_true
|
183
169
|
end
|
184
|
-
|
170
|
+
|
185
171
|
end
|
186
|
-
|
172
|
+
|
187
173
|
describe "#remove_network_join" do
|
188
174
|
use_vcr_cassette "hypervisor/remove_network_join"
|
189
|
-
|
175
|
+
|
190
176
|
it "removes the network from the hypervisor zone" do
|
191
177
|
@hv.remove_network_join(1, 1)
|
192
178
|
@hv.success.should be_true
|
193
179
|
end
|
194
|
-
|
180
|
+
|
195
181
|
end
|
196
182
|
end
|
@@ -8,7 +8,7 @@ describe Squall::HypervisorZone do
|
|
8
8
|
|
9
9
|
describe "#list" do
|
10
10
|
use_vcr_cassette "hypervisor_zones/list"
|
11
|
-
|
11
|
+
|
12
12
|
it "returns all hypervisor zones" do
|
13
13
|
hypervisor_zoness = @hypervisor_zone.list
|
14
14
|
hypervisor_zoness.should be_an(Array)
|
@@ -19,30 +19,26 @@ describe Squall::HypervisorZone do
|
|
19
19
|
hypervisor_zoness.all? {|w| w.is_a?(Hash) }.should be_true
|
20
20
|
end
|
21
21
|
end
|
22
|
-
|
22
|
+
|
23
23
|
describe "#show" do
|
24
24
|
use_vcr_cassette "hypervisor_zones/show"
|
25
25
|
it "requires an id" do
|
26
26
|
expect { @hypervisor_zone.show }.to raise_error(ArgumentError)
|
27
27
|
end
|
28
28
|
|
29
|
-
it "returns not found for invalid hypervisor zone id" do
|
30
|
-
expect { @hypervisor_zone.show(404) }.to raise_error(Squall::NotFoundError)
|
31
|
-
end
|
32
|
-
|
33
29
|
it "returns a hypervisor zone" do
|
34
30
|
hypervisor_zones = @hypervisor_zone.show(1)
|
35
31
|
hypervisor_zones.should be_a(Hash)
|
36
32
|
end
|
37
33
|
end
|
38
|
-
|
34
|
+
|
39
35
|
describe "#create" do
|
40
36
|
use_vcr_cassette "hypervisor_zones/create"
|
41
37
|
it "requires label" do
|
42
38
|
invalid = @valid.reject{|k,v| k == :label }
|
43
39
|
requires_attr(:label) { @hypervisor_zone.create(invalid) }
|
44
40
|
end
|
45
|
-
|
41
|
+
|
46
42
|
it "raises error on unknown params" do
|
47
43
|
expect { @hypervisor_zone.create(@valid.merge(:what => 'what')) }.to raise_error(ArgumentError, 'Unknown params: what')
|
48
44
|
end
|
@@ -52,10 +48,10 @@ describe Squall::HypervisorZone do
|
|
52
48
|
@hypervisor_zone.success.should be_true
|
53
49
|
end
|
54
50
|
end
|
55
|
-
|
51
|
+
|
56
52
|
describe "#edit" do
|
57
53
|
use_vcr_cassette "hypervisor_zones/edit"
|
58
|
-
|
54
|
+
|
59
55
|
it "allows select params" do
|
60
56
|
optional = [:label]
|
61
57
|
@hypervisor_zone.should_receive(:request).exactly(optional.size).times.and_return Hash.new()
|
@@ -63,7 +59,7 @@ describe Squall::HypervisorZone do
|
|
63
59
|
@hypervisor_zone.edit(1, param => "test")
|
64
60
|
end
|
65
61
|
end
|
66
|
-
|
62
|
+
|
67
63
|
it "raises error on unknown params" do
|
68
64
|
expect { @hypervisor_zone.edit(1, @valid.merge(:what => 'what')) }.to raise_error(ArgumentError, 'Unknown params: what')
|
69
65
|
end
|
@@ -72,12 +68,8 @@ describe Squall::HypervisorZone do
|
|
72
68
|
@hypervisor_zone.edit(1, :label => "Updated zone")
|
73
69
|
@hypervisor_zone.success.should be_true
|
74
70
|
end
|
75
|
-
|
76
|
-
it "raises an error for an invalid hypervisor zone id" do
|
77
|
-
expect { @hypervisor_zone.edit(404, @valid) }.to raise_error(Squall::NotFoundError)
|
78
|
-
end
|
79
71
|
end
|
80
|
-
|
72
|
+
|
81
73
|
describe "#delete" do
|
82
74
|
use_vcr_cassette "hypervisor_zones/delete"
|
83
75
|
it "requires an id" do
|
@@ -88,103 +80,99 @@ describe Squall::HypervisorZone do
|
|
88
80
|
@hypervisor_zone.delete(1)
|
89
81
|
@hypervisor_zone.success.should be_true
|
90
82
|
end
|
91
|
-
|
92
|
-
it "returns NotFound for invalid hypervisor zone id" do
|
93
|
-
expect { @hypervisor_zone.delete(404) }.to raise_error(Squall::NotFoundError)
|
94
|
-
end
|
95
83
|
end
|
96
|
-
|
84
|
+
|
97
85
|
describe "#hypervisors" do
|
98
86
|
use_vcr_cassette "hypervisor_zones/hypervisors"
|
99
|
-
|
87
|
+
|
100
88
|
it "returns a list of hypervisors" do
|
101
89
|
hypervisors = @hypervisor_zone.hypervisors(1)
|
102
90
|
hypervisors.should be_an(Array)
|
103
91
|
end
|
104
|
-
|
92
|
+
|
105
93
|
it "contains the hypervisor data" do
|
106
94
|
hypervisors = @hypervisor_zone.hypervisors(1)
|
107
95
|
hypervisors.all? {|w| w.is_a?(Hash) }.should be_true
|
108
96
|
end
|
109
|
-
|
97
|
+
|
110
98
|
end
|
111
|
-
|
99
|
+
|
112
100
|
describe "#data_store_joins" do
|
113
101
|
use_vcr_cassette "hypervisor_zones/data_store_joins"
|
114
|
-
|
102
|
+
|
115
103
|
it "returns a list of data store joins" do
|
116
104
|
joins = @hypervisor_zone.data_store_joins(1)
|
117
105
|
joins.should be_an(Array)
|
118
106
|
end
|
119
|
-
|
107
|
+
|
120
108
|
it "contains the data store join data" do
|
121
109
|
joins = @hypervisor_zone.data_store_joins(1)
|
122
110
|
joins.all? {|w| w.is_a?(Hash) }.should be_true
|
123
111
|
end
|
124
|
-
|
112
|
+
|
125
113
|
end
|
126
|
-
|
114
|
+
|
127
115
|
describe "#add_data_store_join" do
|
128
116
|
use_vcr_cassette "hypervisor_zones/add_data_store_join"
|
129
|
-
|
117
|
+
|
130
118
|
it "adds the data store to the hypervisor zone" do
|
131
119
|
@hypervisor_zone.add_data_store_join(1, 1)
|
132
120
|
@hypervisor_zone.success.should be_true
|
133
121
|
end
|
134
|
-
|
122
|
+
|
135
123
|
end
|
136
|
-
|
124
|
+
|
137
125
|
describe "#remove_data_store_join" do
|
138
126
|
use_vcr_cassette "hypervisor_zones/remove_data_store_join"
|
139
|
-
|
127
|
+
|
140
128
|
it "removes the data store from the hypervisor zone" do
|
141
129
|
@hypervisor_zone.remove_data_store_join(1, 1)
|
142
130
|
@hypervisor_zone.success.should be_true
|
143
131
|
end
|
144
|
-
|
132
|
+
|
145
133
|
end
|
146
|
-
|
134
|
+
|
147
135
|
describe "#network_joins" do
|
148
136
|
use_vcr_cassette "hypervisor_zones/network_joins"
|
149
|
-
|
137
|
+
|
150
138
|
it "returns a list of network joins" do
|
151
139
|
joins = @hypervisor_zone.network_joins(1)
|
152
140
|
joins.should be_an(Array)
|
153
141
|
end
|
154
|
-
|
142
|
+
|
155
143
|
it "contains the network join data" do
|
156
144
|
joins = @hypervisor_zone.network_joins(1)
|
157
145
|
joins.all? {|w| w.is_a?(Hash) }.should be_true
|
158
146
|
end
|
159
|
-
|
147
|
+
|
160
148
|
end
|
161
|
-
|
149
|
+
|
162
150
|
describe "#add_network_join" do
|
163
151
|
use_vcr_cassette "hypervisor_zones/add_network_join"
|
164
|
-
|
152
|
+
|
165
153
|
it "requires network id" do
|
166
154
|
requires_attr(:network_id) { @hypervisor_zone.add_network_join(1, :interface => "interface") }
|
167
155
|
end
|
168
|
-
|
156
|
+
|
169
157
|
it "requires interface" do
|
170
158
|
requires_attr(:interface) { @hypervisor_zone.add_network_join(1, :network_id => 1) }
|
171
159
|
end
|
172
|
-
|
160
|
+
|
173
161
|
it "adds the network to the hypervisor zone" do
|
174
162
|
@hypervisor_zone.add_network_join(1, :network_id => 1, :interface => "interface")
|
175
163
|
@hypervisor_zone.success.should be_true
|
176
164
|
end
|
177
|
-
|
165
|
+
|
178
166
|
end
|
179
|
-
|
167
|
+
|
180
168
|
describe "#remove_network_join" do
|
181
169
|
use_vcr_cassette "hypervisor_zones/remove_network_join"
|
182
|
-
|
170
|
+
|
183
171
|
it "removes the network from the hypervisor zone" do
|
184
172
|
@hypervisor_zone.remove_network_join(1, 1)
|
185
173
|
@hypervisor_zone.success.should be_true
|
186
174
|
end
|
187
|
-
|
175
|
+
|
188
176
|
end
|
189
177
|
|
190
178
|
end
|
@@ -12,15 +12,11 @@ describe Squall::IpAddressJoin do
|
|
12
12
|
expect { @join.list }.to raise_error(ArgumentError)
|
13
13
|
end
|
14
14
|
|
15
|
-
it "raises NotFound with an invalid virtual machine ID" do
|
16
|
-
expect { @join.list(404) }.to raise_error(Squall::NotFoundError)
|
17
|
-
end
|
18
|
-
|
19
15
|
it "returns list of ip_addresses" do
|
20
16
|
ips = @join.list(1)
|
21
17
|
ips.should be_an(Array)
|
22
18
|
end
|
23
|
-
|
19
|
+
|
24
20
|
it "contains IP address data" do
|
25
21
|
ips = @join.list(1)
|
26
22
|
ips.all?.should be_true
|
@@ -35,12 +31,6 @@ describe Squall::IpAddressJoin do
|
|
35
31
|
expect { @join.assign(1) }.to raise_error(ArgumentError)
|
36
32
|
end
|
37
33
|
|
38
|
-
it "raises NotFound with an invalid virtual machine ID" do
|
39
|
-
expect {
|
40
|
-
@join.assign(404, {:ip_address_id => 1, :network_interface_id => 1})
|
41
|
-
}.to raise_error(Squall::NotFoundError)
|
42
|
-
end
|
43
|
-
|
44
34
|
it "assigns the IP join" do
|
45
35
|
join = @join.assign(1, {:ip_address_id => 1, :network_interface_id => 1})
|
46
36
|
@join.success.should be_true
|
@@ -55,10 +45,6 @@ describe Squall::IpAddressJoin do
|
|
55
45
|
expect { @join.delete(1) }.to raise_error(ArgumentError)
|
56
46
|
end
|
57
47
|
|
58
|
-
it "raises NotFound with an invalid ID" do
|
59
|
-
expect { @join.delete(404, 1) }.to raise_error(Squall::NotFoundError)
|
60
|
-
end
|
61
|
-
|
62
48
|
it "deletes the IP join" do
|
63
49
|
@join.delete(1, 1)
|
64
50
|
@join.success.should be_true
|
@@ -3,7 +3,7 @@ require 'spec_helper'
|
|
3
3
|
describe Squall::IpAddress do
|
4
4
|
before(:each) do
|
5
5
|
@ip = Squall::IpAddress.new
|
6
|
-
@keys = ["netmask", "disallowed_primary", "address", "created_at", "updated_at", "network_id",
|
6
|
+
@keys = ["netmask", "disallowed_primary", "address", "created_at", "updated_at", "network_id",
|
7
7
|
"network_address", "broadcast", "id", "gateway"]
|
8
8
|
end
|
9
9
|
|
@@ -14,15 +14,11 @@ describe Squall::IpAddress do
|
|
14
14
|
expect { @ip.list }.to raise_error(ArgumentError)
|
15
15
|
end
|
16
16
|
|
17
|
-
it "404s on invalid network" do
|
18
|
-
expect { @ip.list(404) }.to raise_error(Squall::NotFoundError)
|
19
|
-
end
|
20
|
-
|
21
17
|
it "returns ip_addresses" do
|
22
18
|
ips = @ip.list(1)
|
23
19
|
ips.should be_an(Array)
|
24
20
|
end
|
25
|
-
|
21
|
+
|
26
22
|
it "contains ip address data" do
|
27
23
|
ips = @ip.list(1)
|
28
24
|
ips.all?.should be_true
|
data/spec/squall/network_spec.rb
CHANGED
@@ -47,11 +47,6 @@ describe Squall::Network do
|
|
47
47
|
@network.edit(1, :label => 'two', :vlan => 2, :identifier => 'woah')
|
48
48
|
@network.success.should be_true
|
49
49
|
end
|
50
|
-
|
51
|
-
it "404s on not found" do
|
52
|
-
expect { @network.edit(404) }.to raise_error(Squall::NotFoundError)
|
53
|
-
@network.success.should be_false
|
54
|
-
end
|
55
50
|
end
|
56
51
|
|
57
52
|
describe "#create" do
|
@@ -62,7 +57,7 @@ describe Squall::Network do
|
|
62
57
|
|
63
58
|
it "raises error on duplicate account" do
|
64
59
|
pending "Broken in OnApp" do
|
65
|
-
expect {
|
60
|
+
expect {
|
66
61
|
@network.create(:label => 'networktaken')
|
67
62
|
}.to raise_error(Squall::ServerError)
|
68
63
|
@network.errors['label'].should include("has already been taken")
|
@@ -70,7 +65,7 @@ describe Squall::Network do
|
|
70
65
|
end
|
71
66
|
|
72
67
|
it "raises error on invalid params" do
|
73
|
-
expect {
|
68
|
+
expect {
|
74
69
|
@network.create(:what => 'networktaken', :label => 'wut')
|
75
70
|
}.to raise_error(ArgumentError, 'Unknown params: what')
|
76
71
|
end
|
@@ -107,11 +102,6 @@ describe Squall::Network do
|
|
107
102
|
@network.success.should be_false
|
108
103
|
end
|
109
104
|
|
110
|
-
it "404s on not found" do
|
111
|
-
expect { @network.delete(404) }.to raise_error(Squall::NotFoundError)
|
112
|
-
@network.success.should be_false
|
113
|
-
end
|
114
|
-
|
115
105
|
it "deletes the network" do
|
116
106
|
delete = @network.delete(16)
|
117
107
|
@network.success.should be_true
|