misty 0.7.2 → 0.8.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.
- checksums.yaml +4 -4
- data/README.md +23 -23
- data/lib/misty/auth.rb +24 -19
- data/lib/misty/auth/auth_v2.rb +12 -12
- data/lib/misty/auth/auth_v3.rb +15 -15
- data/lib/misty/autoload.rb +27 -27
- data/lib/misty/cloud.rb +2 -1
- data/lib/misty/http/client.rb +17 -15
- data/lib/misty/http/method_builder.rb +1 -1
- data/lib/misty/http/net_http.rb +12 -7
- data/lib/misty/http/request.rb +13 -7
- data/lib/misty/misty.rb +30 -30
- data/lib/misty/openstack/aodh/v2.rb +1 -1
- data/lib/misty/openstack/ceilometer/v2.rb +1 -1
- data/lib/misty/openstack/cinder/v1.rb +2 -2
- data/lib/misty/openstack/cinder/v2.rb +2 -2
- data/lib/misty/openstack/cinder/v3.rb +2 -2
- data/lib/misty/openstack/designate/v2.rb +1 -1
- data/lib/misty/openstack/freezer/v1.rb +1 -1
- data/lib/misty/openstack/glance/v1.rb +1 -1
- data/lib/misty/openstack/glance/v2.rb +1 -1
- data/lib/misty/openstack/heat/v1.rb +2 -2
- data/lib/misty/openstack/ironic/v1.rb +2 -2
- data/lib/misty/openstack/karbor/v1.rb +1 -1
- data/lib/misty/openstack/keystone/v2_0.rb +2 -2
- data/lib/misty/openstack/keystone/v3.rb +2 -2
- data/lib/misty/openstack/magnum/v1.rb +2 -2
- data/lib/misty/openstack/manila/v2.rb +2 -2
- data/lib/misty/openstack/microversion.rb +9 -9
- data/lib/misty/openstack/murano/v1.rb +1 -1
- data/lib/misty/openstack/neutron/v2_0.rb +1 -1
- data/lib/misty/openstack/nova/v2_1.rb +4 -4
- data/lib/misty/openstack/octavia/v2_0.rb +1 -1
- data/lib/misty/openstack/sahara/v1_1.rb +1 -1
- data/lib/misty/openstack/searchlight/v1.rb +1 -1
- data/lib/misty/openstack/senlin/v1.rb +1 -1
- data/lib/misty/openstack/swift/v1.rb +1 -1
- data/lib/misty/openstack/tacker/v1_0.rb +1 -1
- data/lib/misty/openstack/trove/v1_0.rb +1 -1
- data/lib/misty/openstack/zaqar/v2.rb +1 -1
- data/lib/misty/services.rb +1 -1
- data/lib/misty/version.rb +1 -1
- data/test/integration/compute_test.rb +17 -17
- data/test/integration/network_test.rb +16 -16
- data/test/integration/orchestration_test.rb +51 -51
- data/test/integration/test_helper.rb +7 -7
- data/test/unit/auth/name_test.rb +53 -53
- data/test/unit/auth_test.rb +151 -152
- data/test/unit/cloud/requests_test.rb +58 -58
- data/test/unit/cloud/services_test.rb +62 -62
- data/test/unit/cloud_test.rb +48 -48
- data/test/unit/http/client_test.rb +21 -28
- data/test/unit/http/direct_test.rb +31 -31
- data/test/unit/http/method_builder_test.rb +42 -42
- data/test/unit/http/request_test.rb +33 -33
- data/test/unit/misty_test.rb +28 -28
- data/test/unit/openstack/APIs_test.rb +3 -3
- data/test/unit/openstack/microversion_test.rb +14 -14
- data/test/unit/service_helper.rb +4 -4
- data/test/unit/services_test.rb +5 -5
- data/test/unit/test_helper.rb +1 -1
- metadata +4 -4
@@ -4,19 +4,19 @@ require 'misty/http/request'
|
|
4
4
|
require 'misty/http/direct'
|
5
5
|
|
6
6
|
describe Misty::HTTP::Direct do
|
7
|
-
describe
|
8
|
-
it
|
9
|
-
service.base_set(nil).must_equal
|
7
|
+
describe '#base_set' do
|
8
|
+
it 'returns @base_set' do
|
9
|
+
service.base_set(nil).must_equal ''
|
10
10
|
end
|
11
11
|
|
12
|
-
it
|
13
|
-
service.base_set(
|
12
|
+
it 'returns parameter' do
|
13
|
+
service.base_set('/another-base').must_equal '/another-base'
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
-
describe
|
18
|
-
it
|
19
|
-
stub_request(:delete,
|
17
|
+
describe '#delete' do
|
18
|
+
it 'successful without providing a base url' do
|
19
|
+
stub_request(:delete, 'http://localhost/resource/test').
|
20
20
|
with(:headers => request_header).
|
21
21
|
to_return(:status => 204, :body => '', :headers => {})
|
22
22
|
|
@@ -25,20 +25,20 @@ describe Misty::HTTP::Direct do
|
|
25
25
|
response.body.must_be_nil
|
26
26
|
end
|
27
27
|
|
28
|
-
it
|
29
|
-
stub_request(:delete,
|
28
|
+
it 'successful with a base url' do
|
29
|
+
stub_request(:delete, 'http://localhost/another-base/resource/test').
|
30
30
|
with(:headers => request_header).
|
31
31
|
to_return(:status => 204, :body => '', :headers => {})
|
32
32
|
|
33
|
-
response = service.delete('/resource/test',
|
33
|
+
response = service.delete('/resource/test', '/another-base')
|
34
34
|
response.must_be_kind_of Net::HTTPNoContent
|
35
35
|
response.body.must_be_nil
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
|
-
describe
|
40
|
-
it
|
41
|
-
stub_request(:get,
|
39
|
+
describe '#get' do
|
40
|
+
it 'successful without providing a base url' do
|
41
|
+
stub_request(:get, 'http://localhost/resource/test').
|
42
42
|
with(:headers => request_header).
|
43
43
|
to_return(:status => 200, :body => '', :headers => {})
|
44
44
|
|
@@ -47,55 +47,55 @@ describe Misty::HTTP::Direct do
|
|
47
47
|
response.body.must_be_nil
|
48
48
|
end
|
49
49
|
|
50
|
-
it
|
51
|
-
stub_request(:get,
|
50
|
+
it 'successful with a base url' do
|
51
|
+
stub_request(:get, 'http://localhost/another-base/resource/test').
|
52
52
|
with(:headers => request_header).
|
53
53
|
to_return(:status => 200, :body => '', :headers => {})
|
54
54
|
|
55
|
-
response = service.get('/resource/test',
|
55
|
+
response = service.get('/resource/test', '/another-base')
|
56
56
|
response.must_be_kind_of Net::HTTPOK
|
57
57
|
response.body.must_be_nil
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
61
|
-
describe
|
62
|
-
it
|
63
|
-
stub_request(:post,
|
61
|
+
describe '#post' do
|
62
|
+
it 'successful without providing a base url' do
|
63
|
+
stub_request(:post, 'http://localhost/resource/test').
|
64
64
|
with(:body => "{\"data\":\"value\"}", :headers => request_header).
|
65
65
|
to_return(:status => 201, :body => '', :headers => {})
|
66
66
|
|
67
|
-
response = service.post('/resource/test',
|
67
|
+
response = service.post('/resource/test', 'data' => 'value')
|
68
68
|
response.must_be_kind_of Net::HTTPCreated
|
69
69
|
response.body.must_be_nil
|
70
70
|
end
|
71
71
|
|
72
|
-
it
|
73
|
-
stub_request(:post,
|
72
|
+
it 'successful with a base url' do
|
73
|
+
stub_request(:post, 'http://localhost/another-base/resource/test').
|
74
74
|
with(:body => "{\"data\":\"value\"}", :headers => request_header).
|
75
75
|
to_return(:status => 201, :body => '', :headers => {})
|
76
|
-
response = service.post('/resource/test', {
|
76
|
+
response = service.post('/resource/test', {'data' => 'value'}, '/another-base')
|
77
77
|
response.must_be_kind_of Net::HTTPCreated
|
78
78
|
response.body.must_be_nil
|
79
79
|
end
|
80
80
|
end
|
81
81
|
|
82
|
-
describe
|
83
|
-
it
|
84
|
-
stub_request(:put,
|
82
|
+
describe '#put' do
|
83
|
+
it 'successful without providing a base url' do
|
84
|
+
stub_request(:put, 'http://localhost/resource/test').
|
85
85
|
with(:body => "{\"data\":\"value\"}", :headers => request_header).
|
86
86
|
to_return(:status => 200, :body => '', :headers => {})
|
87
87
|
|
88
|
-
response = service.put('/resource/test',
|
88
|
+
response = service.put('/resource/test', 'data' => 'value')
|
89
89
|
response.must_be_kind_of Net::HTTPOK
|
90
90
|
response.body.must_be_nil
|
91
91
|
end
|
92
92
|
|
93
|
-
it
|
94
|
-
stub_request(:put,
|
93
|
+
it 'successful with a base url' do
|
94
|
+
stub_request(:put, 'http://localhost/another-base/resource/test').
|
95
95
|
with(:body => "{\"data\":\"value\"}", :headers => request_header).
|
96
96
|
to_return(:status => 200, :body => '', :headers => {})
|
97
97
|
|
98
|
-
response = service.put('/resource/test', {
|
98
|
+
response = service.put('/resource/test', {'data' => 'value'}, '/another-base')
|
99
99
|
response.must_be_kind_of Net::HTTPOK
|
100
100
|
response.body.must_be_nil
|
101
101
|
end
|
@@ -14,29 +14,29 @@ describe Misty::HTTP::MethodBuilder do
|
|
14
14
|
Service.new
|
15
15
|
end
|
16
16
|
|
17
|
-
describe
|
18
|
-
it
|
19
|
-
service.base_path =
|
20
|
-
service.send(:base_filter, true,
|
17
|
+
describe '#base_filter' do
|
18
|
+
it 'return path with base_path' do
|
19
|
+
service.base_path = '/base_path'
|
20
|
+
service.send(:base_filter, true, '/abc/def/').must_equal '/base_path/abc/def/'
|
21
21
|
end
|
22
22
|
|
23
|
-
it
|
24
|
-
service.base_path =
|
25
|
-
service.send(:base_filter, false,
|
23
|
+
it 'returns path only' do
|
24
|
+
service.base_path = '/base_path'
|
25
|
+
service.send(:base_filter, false, '/abc/def/').must_equal '/abc/def/'
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
|
-
describe
|
30
|
-
it
|
31
|
-
service.send(:count_path_params,
|
29
|
+
describe '#count_path_params' do
|
30
|
+
it 'returns number of path parameters from path' do
|
31
|
+
service.send(:count_path_params, '/servers/{element1}/config/{element2}/{element3}').must_equal 3
|
32
32
|
end
|
33
33
|
|
34
|
-
it
|
35
|
-
service.send(:count_path_params,
|
34
|
+
it 'returns 0 when no parameters in path' do
|
35
|
+
service.send(:count_path_params, '/blah/bla').must_equal 0
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
|
-
describe
|
39
|
+
describe '#get_method' do
|
40
40
|
class Service
|
41
41
|
def self.api
|
42
42
|
{
|
@@ -49,84 +49,84 @@ describe Misty::HTTP::MethodBuilder do
|
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
52
|
-
it
|
53
|
-
service.send(:get_method, :list_extensions).must_equal ({:path=>
|
52
|
+
it 'successful find a existing method' do
|
53
|
+
service.send(:get_method, :list_extensions).must_equal ({:path=>'/v2.0/extensions', :request=>:GET, :name=>:list_extensions})
|
54
54
|
end
|
55
55
|
|
56
|
-
it
|
56
|
+
it 'returns nil when no method matches' do
|
57
57
|
service.send(:get_method, :incognito).must_be_nil
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
61
|
-
describe
|
62
|
-
let(:path) {
|
61
|
+
describe '#inject_elements' do
|
62
|
+
let(:path) { '/v3/domains/{domain_id}/groups/{group_id}/roles/{role_id}/projects' }
|
63
63
|
|
64
|
-
it
|
65
|
-
service.send(:inject_elements, path, [
|
64
|
+
it 'replaces elements' do
|
65
|
+
service.send(:inject_elements, path, ['id1', 'id2', 'id3']).must_equal '/v3/domains/id1/groups/id2/roles/id3/projects'
|
66
66
|
end
|
67
67
|
|
68
|
-
it
|
68
|
+
it 'fails when not enough arguments' do
|
69
69
|
proc do
|
70
|
-
service.send(:inject_elements, path,
|
70
|
+
service.send(:inject_elements, path, 'id1', 'id2')
|
71
71
|
end.must_raise ArgumentError
|
72
72
|
end
|
73
73
|
|
74
|
-
it
|
75
|
-
service.send(:inject_elements,
|
74
|
+
it 'return path when no match' do
|
75
|
+
service.send(:inject_elements, '/v3/path', ['id1', 'id2']).must_equal '/v3/path'
|
76
76
|
end
|
77
77
|
end
|
78
78
|
|
79
|
-
describe
|
80
|
-
it
|
79
|
+
describe '#prefixed_path' do
|
80
|
+
it 'returns true and same path with empty prefix' do
|
81
81
|
class Service
|
82
82
|
def self.prefix_path_to_ignore
|
83
|
-
|
83
|
+
''
|
84
84
|
end
|
85
85
|
end
|
86
86
|
|
87
|
-
path =
|
87
|
+
path = '/v3/resources/type'
|
88
88
|
base, newpath = service.send(:prefixed_path, path)
|
89
89
|
base.must_equal true
|
90
90
|
newpath.must_equal path
|
91
91
|
end
|
92
92
|
|
93
|
-
it
|
93
|
+
it 'returns false and same path when unmatched prefix' do
|
94
94
|
class Service
|
95
95
|
def self.prefix_path_to_ignore
|
96
|
-
|
96
|
+
'/v3/{project_id}'
|
97
97
|
end
|
98
98
|
end
|
99
99
|
|
100
|
-
path =
|
100
|
+
path = '/v2/schemas/tasks'
|
101
101
|
base, newpath = service.send(:prefixed_path, path)
|
102
102
|
base.must_equal false
|
103
103
|
newpath.must_equal path
|
104
104
|
end
|
105
105
|
|
106
|
-
it
|
106
|
+
it 'returns true and filtered path when matched prefix' do
|
107
107
|
class Service
|
108
108
|
def self.prefix_path_to_ignore
|
109
|
-
|
109
|
+
'/v3/{project_id}'
|
110
110
|
end
|
111
111
|
end
|
112
112
|
|
113
|
-
path =
|
113
|
+
path = '/v3/{project_id}/backups/detail'
|
114
114
|
base, newpath = service.send(:prefixed_path, path)
|
115
115
|
base.must_equal true
|
116
|
-
newpath.must_equal
|
116
|
+
newpath.must_equal '/backups/detail'
|
117
117
|
end
|
118
118
|
end
|
119
119
|
|
120
|
-
describe
|
121
|
-
it
|
122
|
-
service.send(:query_param,
|
120
|
+
describe '#query_param' do
|
121
|
+
it 'returns string when passing a String' do
|
122
|
+
service.send(:query_param, 'name=foobar').must_equal '?name=foobar'
|
123
123
|
end
|
124
124
|
|
125
|
-
it
|
126
|
-
service.send(:query_param,
|
125
|
+
it 'returns empty string when passing an empty String' do
|
126
|
+
service.send(:query_param, '').must_equal ''
|
127
127
|
end
|
128
128
|
|
129
|
-
it
|
129
|
+
it 'returns a query string when passing in a Hash' do
|
130
130
|
service.send(:query_param, {}).must_equal ''
|
131
131
|
|
132
132
|
service.send(:query_param, {:foo => 'bar'}).must_equal '?foo=bar'
|
@@ -137,7 +137,7 @@ describe Misty::HTTP::MethodBuilder do
|
|
137
137
|
service.send(:query_param, {'===' => 'Ëncøding is hárd!'}).must_equal '?%3D%3D%3D=%C3%8Bnc%C3%B8ding+is+h%C3%A1rd%21'
|
138
138
|
end
|
139
139
|
|
140
|
-
it
|
140
|
+
it 'returns nil unless passing a String or Hash' do
|
141
141
|
service.send(:query_param, 42).must_be_nil
|
142
142
|
end
|
143
143
|
end
|
@@ -5,42 +5,42 @@ require 'misty/http/request'
|
|
5
5
|
describe Misty::HTTP::Request do
|
6
6
|
let(:request_header) { {'Accept' => '*/*'} }
|
7
7
|
|
8
|
-
describe
|
8
|
+
describe '#decode?' do
|
9
9
|
let(:response) do
|
10
|
-
uri = URI.parse(
|
10
|
+
uri = URI.parse('http://localhost/')
|
11
11
|
http = Net::HTTP.new(uri.host, uri.port)
|
12
|
-
request = Net::HTTP::Get.new(
|
12
|
+
request = Net::HTTP::Get.new('/resource', {})
|
13
13
|
http.request(request)
|
14
14
|
end
|
15
15
|
|
16
|
-
it
|
17
|
-
stub_request(:get,
|
16
|
+
it 'true when response has a body' do
|
17
|
+
stub_request(:get, 'http://localhost/resource').
|
18
18
|
with(:headers => {'Accept' => '*/*'}).
|
19
19
|
to_return(:status => 200, :body => "{\"key\": \"value\"}", :headers => {'Content-Type' => 'application/json'})
|
20
20
|
|
21
21
|
service.decode?(response).must_equal true
|
22
22
|
end
|
23
23
|
|
24
|
-
it
|
25
|
-
stub_request(:get,
|
24
|
+
it 'false when response has no content' do
|
25
|
+
stub_request(:get, 'http://localhost/resource').
|
26
26
|
with(:headers => {'Accept' => '*/*'}).
|
27
27
|
to_return(:status => 204, :body => nil, :headers => {'Content-Type' => 'application/json'})
|
28
28
|
|
29
|
-
service.decode?(response).
|
29
|
+
service.decode?(response).must_equal false
|
30
30
|
end
|
31
31
|
|
32
|
-
it
|
33
|
-
stub_request(:get,
|
32
|
+
it 'false when content_type is JSON' do
|
33
|
+
stub_request(:get, 'http://localhost/resource').
|
34
34
|
with(:headers => request_header).
|
35
35
|
to_return(:status => 200, :body => "{\"blah\": \"bla\"}")
|
36
36
|
|
37
|
-
service(:json).decode?(response).
|
37
|
+
service(:json).decode?(response).must_equal false
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
41
|
-
describe
|
42
|
-
it
|
43
|
-
stub_request(:copy,
|
41
|
+
describe 'http requests' do
|
42
|
+
it '#http_copy' do
|
43
|
+
stub_request(:copy, 'http://localhost/resource').
|
44
44
|
with(:headers => request_header).
|
45
45
|
to_return(:status => 202, :body => "{\"key\": \"value\"}")
|
46
46
|
|
@@ -49,8 +49,8 @@ describe Misty::HTTP::Request do
|
|
49
49
|
response.body.wont_be_nil
|
50
50
|
end
|
51
51
|
|
52
|
-
it
|
53
|
-
stub_request(:delete,
|
52
|
+
it '#http_delete' do
|
53
|
+
stub_request(:delete, 'http://localhost/resource').
|
54
54
|
with(:headers => request_header).
|
55
55
|
to_return(:status => 204, :body => '')
|
56
56
|
|
@@ -59,8 +59,8 @@ describe Misty::HTTP::Request do
|
|
59
59
|
response.body.must_be_nil
|
60
60
|
end
|
61
61
|
|
62
|
-
it
|
63
|
-
stub_request(:get,
|
62
|
+
it '#http_get' do
|
63
|
+
stub_request(:get, 'http://localhost/resource').
|
64
64
|
with(:headers => request_header).
|
65
65
|
to_return(:status => 200, :body => "{\"key\": \"value\"}")
|
66
66
|
|
@@ -69,8 +69,8 @@ describe Misty::HTTP::Request do
|
|
69
69
|
response.body.wont_be_empty
|
70
70
|
end
|
71
71
|
|
72
|
-
it
|
73
|
-
stub_request(:head,
|
72
|
+
it '#http_head' do
|
73
|
+
stub_request(:head, 'http://localhost/resource').
|
74
74
|
with(:headers => request_header).
|
75
75
|
to_return(:status => '200')
|
76
76
|
|
@@ -79,8 +79,8 @@ describe Misty::HTTP::Request do
|
|
79
79
|
response.body.must_be_nil
|
80
80
|
end
|
81
81
|
|
82
|
-
it
|
83
|
-
stub_request(:options,
|
82
|
+
it '#http_options' do
|
83
|
+
stub_request(:options, 'http://localhost/resource').
|
84
84
|
with(:headers => request_header).
|
85
85
|
to_return(:status => '200')
|
86
86
|
|
@@ -88,36 +88,36 @@ describe Misty::HTTP::Request do
|
|
88
88
|
response.must_be_kind_of Net::HTTPSuccess
|
89
89
|
end
|
90
90
|
|
91
|
-
it
|
92
|
-
stub_request(:patch,
|
91
|
+
it '#http_patch' do
|
92
|
+
stub_request(:patch, 'http://localhost/resource').
|
93
93
|
with(:headers => request_header).
|
94
94
|
to_return(:status => 202, :body => "{\"key\": \"value\"}")
|
95
95
|
|
96
|
-
response = service.http_patch('/resource', {},
|
96
|
+
response = service.http_patch('/resource', {}, 'data' => 'value')
|
97
97
|
response.must_be_kind_of Net::HTTPAccepted
|
98
98
|
response.body.wont_be_nil
|
99
99
|
end
|
100
100
|
|
101
|
-
it
|
102
|
-
stub_request(:post,
|
101
|
+
it '#http_post' do
|
102
|
+
stub_request(:post, 'http://localhost/resource').
|
103
103
|
with(:headers => request_header).
|
104
104
|
to_return(:status => 201)
|
105
105
|
|
106
|
-
response = service.http_post('/resource', {},
|
106
|
+
response = service.http_post('/resource', {}, 'data' => 'value')
|
107
107
|
response.must_be_kind_of Net::HTTPCreated
|
108
108
|
end
|
109
109
|
|
110
|
-
it
|
111
|
-
stub_request(:put,
|
110
|
+
it '#http_put' do
|
111
|
+
stub_request(:put, 'http://localhost/resource').
|
112
112
|
with(:headers => request_header).
|
113
113
|
to_return(:status => 200)
|
114
114
|
|
115
|
-
response = service.http_put('/resource', {},
|
115
|
+
response = service.http_put('/resource', {}, 'data' => 'value')
|
116
116
|
response.must_be_kind_of Net::HTTPOK
|
117
117
|
end
|
118
118
|
|
119
|
-
it
|
120
|
-
service.http_to_s('/resource',
|
119
|
+
it '#http_to_s' do
|
120
|
+
service.http_to_s('/resource', 'headers', 'data' => 'value').must_equal "base_url='localhost:80', path='/resource', header=headers, data='{\"data\"=>\"value\"}'"
|
121
121
|
end
|
122
122
|
end
|
123
123
|
end
|
data/test/unit/misty_test.rb
CHANGED
@@ -11,124 +11,124 @@ def validate(service)
|
|
11
11
|
end
|
12
12
|
|
13
13
|
describe Misty do
|
14
|
-
describe
|
15
|
-
it
|
14
|
+
describe '#set_services' do
|
15
|
+
it 'has alarming service' do
|
16
16
|
service = Misty::services.find { |s| s.name == :alarming}
|
17
17
|
validate(service)
|
18
18
|
end
|
19
19
|
|
20
|
-
it
|
20
|
+
it 'has baremetal service' do
|
21
21
|
service = Misty::services.find { |s| s.name == :baremetal}
|
22
22
|
validate(service)
|
23
23
|
end
|
24
24
|
|
25
|
-
it
|
25
|
+
it 'has block_storage service' do
|
26
26
|
service = Misty::services.find { |s| s.name == :block_storage}
|
27
27
|
validate(service)
|
28
28
|
end
|
29
29
|
|
30
|
-
it
|
30
|
+
it 'has clustering service' do
|
31
31
|
service = Misty::services.find { |s| s.name == :clustering}
|
32
32
|
validate(service)
|
33
33
|
end
|
34
34
|
|
35
|
-
it
|
35
|
+
it 'has compute service' do
|
36
36
|
service = Misty::services.find { |s| s.name == :compute}
|
37
37
|
validate(service)
|
38
38
|
end
|
39
39
|
|
40
|
-
it
|
40
|
+
it 'has container service' do
|
41
41
|
service = Misty::services.find { |s| s.name == :container}
|
42
42
|
validate(service)
|
43
43
|
end
|
44
44
|
|
45
|
-
it
|
45
|
+
it 'has data_processing service' do
|
46
46
|
service = Misty::services.find { |s| s.name == :data_processing}
|
47
47
|
validate(service)
|
48
48
|
end
|
49
49
|
|
50
|
-
it
|
50
|
+
it 'has data_protection service' do
|
51
51
|
service = Misty::services.find { |s| s.name == :data_protection}
|
52
52
|
validate(service)
|
53
53
|
end
|
54
54
|
|
55
|
-
it
|
55
|
+
it 'has database service' do
|
56
56
|
service = Misty::services.find { |s| s.name == :database}
|
57
57
|
validate(service)
|
58
58
|
end
|
59
59
|
|
60
|
-
it
|
60
|
+
it 'has dns service' do
|
61
61
|
service = Misty::services.find { |s| s.name == :dns}
|
62
62
|
validate(service)
|
63
63
|
end
|
64
64
|
|
65
|
-
it
|
65
|
+
it 'has identity service' do
|
66
66
|
service = Misty::services.find { |s| s.name == :identity}
|
67
67
|
validate(service)
|
68
68
|
end
|
69
69
|
|
70
|
-
it
|
70
|
+
it 'has image service' do
|
71
71
|
service = Misty::services.find { |s| s.name == :image}
|
72
72
|
validate(service)
|
73
73
|
end
|
74
74
|
|
75
|
-
it
|
75
|
+
it 'has messaging service' do
|
76
76
|
service = Misty::services.find { |s| s.name == :messaging}
|
77
77
|
validate(service)
|
78
78
|
end
|
79
79
|
|
80
|
-
it
|
80
|
+
it 'has metering service' do
|
81
81
|
service = Misty::services.find { |s| s.name == :metering}
|
82
82
|
validate(service)
|
83
83
|
end
|
84
84
|
|
85
|
-
it
|
85
|
+
it 'has networking service' do
|
86
86
|
service = Misty::services.find { |s| s.name == :networking}
|
87
87
|
validate(service)
|
88
88
|
end
|
89
89
|
|
90
|
-
it
|
90
|
+
it 'has object_storage service' do
|
91
91
|
service = Misty::services.find { |s| s.name == :object_storage}
|
92
92
|
validate(service)
|
93
93
|
end
|
94
94
|
|
95
|
-
it
|
95
|
+
it 'has orchestration service' do
|
96
96
|
service = Misty::services.find { |s| s.name == :orchestration}
|
97
97
|
validate(service)
|
98
98
|
end
|
99
99
|
|
100
|
-
it
|
100
|
+
it 'has search service' do
|
101
101
|
service = Misty::services.find { |s| s.name == :search}
|
102
102
|
validate(service)
|
103
103
|
end
|
104
104
|
|
105
|
-
it
|
105
|
+
it 'has shared_file_systems service' do
|
106
106
|
service = Misty::services.find { |s| s.name == :shared_file_systems}
|
107
107
|
validate(service)
|
108
108
|
end
|
109
109
|
|
110
|
-
describe
|
111
|
-
it
|
110
|
+
describe '#services' do
|
111
|
+
it 'returns Services' do
|
112
112
|
services = Misty::services
|
113
113
|
services.must_be_kind_of Misty::Services
|
114
114
|
end
|
115
115
|
end
|
116
116
|
end
|
117
117
|
|
118
|
-
describe
|
119
|
-
it
|
120
|
-
Misty.to_json({
|
118
|
+
describe '#to_json' do
|
119
|
+
it 'returns a JSON string when using a Ruby hash' do
|
120
|
+
Misty.to_json({'key' => 'val'}).must_be_kind_of String
|
121
121
|
end
|
122
122
|
|
123
|
-
it
|
123
|
+
it 'returns same string when using a string' do
|
124
124
|
data = "{\"key\": \"val\"}"
|
125
125
|
response = Misty.to_json(data)
|
126
126
|
response.must_be_kind_of String
|
127
127
|
response.must_equal data
|
128
128
|
end
|
129
129
|
|
130
|
-
it
|
131
|
-
data =
|
130
|
+
it 'fails when using a string with non JSON data' do
|
131
|
+
data = 'key;val'
|
132
132
|
proc do
|
133
133
|
response = Misty.to_json(data)
|
134
134
|
end.must_raise JSON::ParserError
|