misty 0.1.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +222 -1
- data/lib/misty.rb +8 -0
- data/lib/misty/auth.rb +60 -0
- data/lib/misty/auth/auth_v2.rb +46 -0
- data/lib/misty/auth/auth_v3.rb +58 -0
- data/lib/misty/autoload.rb +82 -0
- data/lib/misty/cloud.rb +133 -0
- data/lib/misty/http/client.rb +115 -0
- data/lib/misty/http/direct.rb +26 -0
- data/lib/misty/http/method_builder.rb +96 -0
- data/lib/misty/http/request.rb +75 -0
- data/lib/misty/misty.rb +51 -0
- data/lib/misty/openstack/aodh/aodh_v2.rb +12 -0
- data/lib/misty/openstack/aodh/v2.rb +20 -0
- data/lib/misty/openstack/ceilometer/ceilometer_v2.rb +13 -0
- data/lib/misty/openstack/ceilometer/v2.rb +20 -0
- data/lib/misty/openstack/cinder/cinder_v1.rb +35 -0
- data/lib/misty/openstack/cinder/cinder_v3.rb +148 -0
- data/lib/misty/openstack/cinder/v1.rb +24 -0
- data/lib/misty/openstack/cinder/v3.rb +24 -0
- data/lib/misty/openstack/designate/designate_v2.rb +69 -0
- data/lib/misty/openstack/designate/v2.rb +20 -0
- data/lib/misty/openstack/glance/glance_v1.rb +16 -0
- data/lib/misty/openstack/glance/glance_v2.rb +29 -0
- data/lib/misty/openstack/glance/v1.rb +20 -0
- data/lib/misty/openstack/glance/v2.rb +20 -0
- data/lib/misty/openstack/heat/heat_v1.rb +85 -0
- data/lib/misty/openstack/heat/v1.rb +24 -0
- data/lib/misty/openstack/ironic/ironic_v1.rb +71 -0
- data/lib/misty/openstack/ironic/v1.rb +26 -0
- data/lib/misty/openstack/karbor/karbor_v1.rb +32 -0
- data/lib/misty/openstack/karbor/v1.rb +20 -0
- data/lib/misty/openstack/keystone/keystone_v2_0.rb +11 -0
- data/lib/misty/openstack/keystone/keystone_v2_0_ext.rb +32 -0
- data/lib/misty/openstack/keystone/keystone_v3.rb +147 -0
- data/lib/misty/openstack/keystone/keystone_v3_ext.rb +124 -0
- data/lib/misty/openstack/keystone/v2_0.rb +23 -0
- data/lib/misty/openstack/keystone/v3.rb +23 -0
- data/lib/misty/openstack/magnum/magnum_v1.rb +41 -0
- data/lib/misty/openstack/magnum/v1.rb +26 -0
- data/lib/misty/openstack/manila/manila_v2.rb +143 -0
- data/lib/misty/openstack/manila/v2.rb +26 -0
- data/lib/misty/openstack/microversion.rb +62 -0
- data/lib/misty/openstack/neutron/neutron_v2_0.rb +205 -0
- data/lib/misty/openstack/neutron/v2_0.rb +20 -0
- data/lib/misty/openstack/nova/nova_v2_1.rb +269 -0
- data/lib/misty/openstack/nova/v2_1.rb +40 -0
- data/lib/misty/openstack/sahara/sahara_v1_1.rb +77 -0
- data/lib/misty/openstack/sahara/v1_1.rb +20 -0
- data/lib/misty/openstack/searchlight/searchlight_v1.rb +15 -0
- data/lib/misty/openstack/searchlight/v1.rb +20 -0
- data/lib/misty/openstack/senlin/senlin_v1.rb +66 -0
- data/lib/misty/openstack/senlin/v1.rb +20 -0
- data/lib/misty/openstack/swift/swift_v1.rb +23 -0
- data/lib/misty/openstack/swift/v1.rb +20 -0
- data/lib/misty/openstack/trove/trove_v1_0.rb +51 -0
- data/lib/misty/openstack/trove/v1_0.rb +20 -0
- data/lib/misty/openstack/zaqar/v2.rb +20 -0
- data/lib/misty/openstack/zaqar/zaqar_v2.rb +46 -0
- data/lib/misty/version.rb +2 -2
- data/test/integration/compute_test.rb +35 -0
- data/test/integration/network_test.rb +34 -0
- data/test/integration/orchestration_test.rb +92 -0
- data/test/integration/test_helper.rb +19 -0
- data/test/integration/vcr/compute_using_nova_v2_1.yml +1107 -0
- data/test/integration/vcr/network_using_neutron_v2_0.yml +1029 -0
- data/test/integration/vcr/orchestration_using_heat_v1.yml +1457 -0
- data/test/unit/auth_helper.rb +52 -0
- data/test/unit/auth_test.rb +99 -0
- data/test/unit/cloud/requests_test.rb +113 -0
- data/test/unit/cloud/services_test.rb +171 -0
- data/test/unit/cloud_test.rb +145 -0
- data/test/unit/http/client_test.rb +74 -0
- data/test/unit/http/direct_test.rb +103 -0
- data/test/unit/http/method_builder_test.rb +133 -0
- data/test/unit/http/request_test.rb +123 -0
- data/test/unit/misty_test.rb +36 -0
- data/test/unit/openstack/APIs_test.rb +40 -0
- data/test/unit/openstack/microversion_test.rb +70 -0
- data/test/unit/service_helper.rb +25 -0
- data/test/unit/test_helper.rb +8 -0
- metadata +170 -5
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
VERBS = [ :COPY, :DELETE, :GET, :HEAD, :PATCH, :POST, :PUT ]
|
4
|
+
|
5
|
+
def api_valid?(api_entry)
|
6
|
+
api_entry.each do |path, requests|
|
7
|
+
path.must_be_kind_of String
|
8
|
+
requests.must_be_kind_of Hash
|
9
|
+
requests.each do |verb, names|
|
10
|
+
verb.must_be_kind_of Symbol
|
11
|
+
if VERBS.include? verb
|
12
|
+
names.must_be_kind_of Array
|
13
|
+
names.each do |name|
|
14
|
+
name.must_be_kind_of Symbol
|
15
|
+
name.to_s.wont_match /^id\d*/
|
16
|
+
end
|
17
|
+
else
|
18
|
+
verb.must_equal :version
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
# For each OpenStack project version, generates an equivalent of the following example:
|
25
|
+
# it "Nova v2.1 loads a valid api structure" do
|
26
|
+
# require "misty/openstack/nova/v2_1"
|
27
|
+
# api = Misty::Openstack::Nova::V2_1.api
|
28
|
+
# api_valid?(api)
|
29
|
+
# end
|
30
|
+
describe "Openstack API" do
|
31
|
+
Misty.services.each do |service|
|
32
|
+
service.versions.each do |version|
|
33
|
+
it "#{service.project} #{version} loads a valid api structure" do
|
34
|
+
require "misty/openstack/#{service.project}/#{Misty::Cloud.dot_to_underscore(version)}"
|
35
|
+
api = Object.const_get("Misty::Openstack::#{service.project.capitalize}::#{Misty::Cloud.dot_to_underscore(version).capitalize}").api
|
36
|
+
api_valid?(api)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
require 'auth_helper'
|
3
|
+
require 'misty/http/client'
|
4
|
+
require 'misty/openstack/microversion'
|
5
|
+
|
6
|
+
describe Misty::HTTP::Microversion do
|
7
|
+
let(:versions_data) do
|
8
|
+
{ 'versions' =>
|
9
|
+
[{ 'status' => 'SUPPORTED',
|
10
|
+
'updated' => '2011-01-21T11:33:21Z',
|
11
|
+
'links' => [{ 'href' => 'http://localhost/v2/', 'rel' => 'self' }],
|
12
|
+
'min_version' => '',
|
13
|
+
'version' => '',
|
14
|
+
'id' => 'v2.0' },
|
15
|
+
{ 'status' => 'CURRENT',
|
16
|
+
'updated' => '2013-07-23T11:33:21Z',
|
17
|
+
'links' => [{ 'href' => 'http://localhost/v2.1/', 'rel' => 'self' }],
|
18
|
+
'min_version' => '2.1',
|
19
|
+
'version' => '2.25',
|
20
|
+
'id' => 'v2.1' }] }
|
21
|
+
end
|
22
|
+
|
23
|
+
let(:microversion_service) do
|
24
|
+
auth = Minitest::Mock.new
|
25
|
+
|
26
|
+
def auth.get_endpoint(*args)
|
27
|
+
"http://localhost"
|
28
|
+
end
|
29
|
+
|
30
|
+
def auth.get_token
|
31
|
+
"token_id"
|
32
|
+
end
|
33
|
+
|
34
|
+
cloud = Misty::Cloud::Setup.new(auth, :ruby, Logger.new('/dev/null'))
|
35
|
+
|
36
|
+
stub_request(:get, "http://localhost/").
|
37
|
+
with(:headers => {'Accept'=>'application/json', 'Content-Type'=>'application/json'}).
|
38
|
+
to_return(:status => 200, :body => JSON.dump(versions_data), :headers => {})
|
39
|
+
|
40
|
+
Misty::Openstack::Nova::V2_1.new(cloud, {})
|
41
|
+
end
|
42
|
+
|
43
|
+
describe "#version_get" do
|
44
|
+
it "returns the version number" do
|
45
|
+
microversion_service.version_get("2.12").must_equal "2.12"
|
46
|
+
end
|
47
|
+
|
48
|
+
it "returns the version number" do
|
49
|
+
microversion_service.version_get("CURRENT").must_equal "2.25"
|
50
|
+
end
|
51
|
+
|
52
|
+
it "fails when version is not within supporterd interval" do
|
53
|
+
proc do
|
54
|
+
microversion_service.version_get("2.0")
|
55
|
+
end.must_raise Misty::HTTP::Microversion::VersionError
|
56
|
+
end
|
57
|
+
|
58
|
+
it "fails when LATEST version is not available" do
|
59
|
+
proc do
|
60
|
+
microversion_service.version_get("LATEST")
|
61
|
+
end.must_raise Misty::HTTP::Microversion::VersionError
|
62
|
+
end
|
63
|
+
|
64
|
+
it "fails when using an invalid version State" do
|
65
|
+
proc do
|
66
|
+
microversion_service.version_get("OTHER")
|
67
|
+
end.must_raise Misty::HTTP::Microversion::VersionError
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'misty/http/client'
|
2
|
+
|
3
|
+
def request_header
|
4
|
+
{'Accept'=>'application/json', 'Content-Type'=>'application/json'}
|
5
|
+
end
|
6
|
+
|
7
|
+
def service(content_type = :ruby)
|
8
|
+
auth = Minitest::Mock.new
|
9
|
+
|
10
|
+
def auth.get_endpoint(*args)
|
11
|
+
"http://localhost"
|
12
|
+
end
|
13
|
+
|
14
|
+
def auth.get_token
|
15
|
+
"token_id"
|
16
|
+
end
|
17
|
+
|
18
|
+
setup = Misty::Cloud::Setup.new(auth, content_type, Logger.new('/dev/null'))
|
19
|
+
|
20
|
+
stub_request(:get, "http://localhost/").
|
21
|
+
with(:headers => request_header).
|
22
|
+
to_return(:status => 200, :body => "", :headers => {})
|
23
|
+
|
24
|
+
Misty::Openstack::Neutron::V2_0.new(setup, {})
|
25
|
+
end
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: misty
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gilles Dubreuil
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-03-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: json
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.0'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: bundler
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -24,7 +38,79 @@ dependencies:
|
|
24
38
|
- - "~>"
|
25
39
|
- !ruby/object:Gem::Version
|
26
40
|
version: '1.10'
|
27
|
-
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: minitest
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '5.10'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '5.10'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: webmock
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '1.24'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '1.24'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: vcr
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '3.0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '3.0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: pry-byebug
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '3.4'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '3.4'
|
111
|
+
description: |-
|
112
|
+
Misty is a dedicated HTTP client for OpenStack APIs. Its aims is to provide a fast, flexible \
|
113
|
+
and exhaustive APIs experience
|
28
114
|
email:
|
29
115
|
- gilles@redhat.com
|
30
116
|
executables: []
|
@@ -35,7 +121,86 @@ extra_rdoc_files:
|
|
35
121
|
files:
|
36
122
|
- LICENSE.md
|
37
123
|
- README.md
|
124
|
+
- lib/misty.rb
|
125
|
+
- lib/misty/auth.rb
|
126
|
+
- lib/misty/auth/auth_v2.rb
|
127
|
+
- lib/misty/auth/auth_v3.rb
|
128
|
+
- lib/misty/autoload.rb
|
129
|
+
- lib/misty/cloud.rb
|
130
|
+
- lib/misty/http/client.rb
|
131
|
+
- lib/misty/http/direct.rb
|
132
|
+
- lib/misty/http/method_builder.rb
|
133
|
+
- lib/misty/http/request.rb
|
134
|
+
- lib/misty/misty.rb
|
135
|
+
- lib/misty/openstack/aodh/aodh_v2.rb
|
136
|
+
- lib/misty/openstack/aodh/v2.rb
|
137
|
+
- lib/misty/openstack/ceilometer/ceilometer_v2.rb
|
138
|
+
- lib/misty/openstack/ceilometer/v2.rb
|
139
|
+
- lib/misty/openstack/cinder/cinder_v1.rb
|
140
|
+
- lib/misty/openstack/cinder/cinder_v3.rb
|
141
|
+
- lib/misty/openstack/cinder/v1.rb
|
142
|
+
- lib/misty/openstack/cinder/v3.rb
|
143
|
+
- lib/misty/openstack/designate/designate_v2.rb
|
144
|
+
- lib/misty/openstack/designate/v2.rb
|
145
|
+
- lib/misty/openstack/glance/glance_v1.rb
|
146
|
+
- lib/misty/openstack/glance/glance_v2.rb
|
147
|
+
- lib/misty/openstack/glance/v1.rb
|
148
|
+
- lib/misty/openstack/glance/v2.rb
|
149
|
+
- lib/misty/openstack/heat/heat_v1.rb
|
150
|
+
- lib/misty/openstack/heat/v1.rb
|
151
|
+
- lib/misty/openstack/ironic/ironic_v1.rb
|
152
|
+
- lib/misty/openstack/ironic/v1.rb
|
153
|
+
- lib/misty/openstack/karbor/karbor_v1.rb
|
154
|
+
- lib/misty/openstack/karbor/v1.rb
|
155
|
+
- lib/misty/openstack/keystone/keystone_v2_0.rb
|
156
|
+
- lib/misty/openstack/keystone/keystone_v2_0_ext.rb
|
157
|
+
- lib/misty/openstack/keystone/keystone_v3.rb
|
158
|
+
- lib/misty/openstack/keystone/keystone_v3_ext.rb
|
159
|
+
- lib/misty/openstack/keystone/v2_0.rb
|
160
|
+
- lib/misty/openstack/keystone/v3.rb
|
161
|
+
- lib/misty/openstack/magnum/magnum_v1.rb
|
162
|
+
- lib/misty/openstack/magnum/v1.rb
|
163
|
+
- lib/misty/openstack/manila/manila_v2.rb
|
164
|
+
- lib/misty/openstack/manila/v2.rb
|
165
|
+
- lib/misty/openstack/microversion.rb
|
166
|
+
- lib/misty/openstack/neutron/neutron_v2_0.rb
|
167
|
+
- lib/misty/openstack/neutron/v2_0.rb
|
168
|
+
- lib/misty/openstack/nova/nova_v2_1.rb
|
169
|
+
- lib/misty/openstack/nova/v2_1.rb
|
170
|
+
- lib/misty/openstack/sahara/sahara_v1_1.rb
|
171
|
+
- lib/misty/openstack/sahara/v1_1.rb
|
172
|
+
- lib/misty/openstack/searchlight/searchlight_v1.rb
|
173
|
+
- lib/misty/openstack/searchlight/v1.rb
|
174
|
+
- lib/misty/openstack/senlin/senlin_v1.rb
|
175
|
+
- lib/misty/openstack/senlin/v1.rb
|
176
|
+
- lib/misty/openstack/swift/swift_v1.rb
|
177
|
+
- lib/misty/openstack/swift/v1.rb
|
178
|
+
- lib/misty/openstack/trove/trove_v1_0.rb
|
179
|
+
- lib/misty/openstack/trove/v1_0.rb
|
180
|
+
- lib/misty/openstack/zaqar/v2.rb
|
181
|
+
- lib/misty/openstack/zaqar/zaqar_v2.rb
|
38
182
|
- lib/misty/version.rb
|
183
|
+
- test/integration/compute_test.rb
|
184
|
+
- test/integration/network_test.rb
|
185
|
+
- test/integration/orchestration_test.rb
|
186
|
+
- test/integration/test_helper.rb
|
187
|
+
- test/integration/vcr/compute_using_nova_v2_1.yml
|
188
|
+
- test/integration/vcr/network_using_neutron_v2_0.yml
|
189
|
+
- test/integration/vcr/orchestration_using_heat_v1.yml
|
190
|
+
- test/unit/auth_helper.rb
|
191
|
+
- test/unit/auth_test.rb
|
192
|
+
- test/unit/cloud/requests_test.rb
|
193
|
+
- test/unit/cloud/services_test.rb
|
194
|
+
- test/unit/cloud_test.rb
|
195
|
+
- test/unit/http/client_test.rb
|
196
|
+
- test/unit/http/direct_test.rb
|
197
|
+
- test/unit/http/method_builder_test.rb
|
198
|
+
- test/unit/http/request_test.rb
|
199
|
+
- test/unit/misty_test.rb
|
200
|
+
- test/unit/openstack/APIs_test.rb
|
201
|
+
- test/unit/openstack/microversion_test.rb
|
202
|
+
- test/unit/service_helper.rb
|
203
|
+
- test/unit/test_helper.rb
|
39
204
|
homepage: https://github.com/flystack/misty
|
40
205
|
licenses:
|
41
206
|
- GPL-3.0
|
@@ -57,8 +222,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
57
222
|
version: '0'
|
58
223
|
requirements: []
|
59
224
|
rubyforge_project:
|
60
|
-
rubygems_version: 2.5.
|
225
|
+
rubygems_version: 2.5.2
|
61
226
|
signing_key:
|
62
227
|
specification_version: 4
|
63
|
-
summary:
|
228
|
+
summary: Misty is a dedicated HTTP client for OpenStack APIs.
|
64
229
|
test_files: []
|