yao 0.13.0 → 0.13.1
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d6d9322e2d2c8af453bddcb207b1dcdb50c252745712f3d3f1e6f7f416f25da7
|
4
|
+
data.tar.gz: 11831fa1c4752f26306b72a1416767c56dc4eb238d16b9f593d4e9aa62736570
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 45d0473120a677f5b322dfa9746ce9ba63599f214372f1f7b163c15ad9c73670983ee6cd03cb8d5298c3a426a913fcaa0f616e41b7b2d7d9ed3ba90f3c8a8d9c
|
7
|
+
data.tar.gz: e7773888bb3c9ca1e0baaecc4ca8b58f003a00e254c554fd4a6bc745803a19fc7eeae8c4ea6a03b058a793d8f1289c06a3f867374015a0fabec79996b3d7377e
|
data/lib/yao/error.rb
CHANGED
@@ -211,6 +211,8 @@ module Yao::Resources
|
|
211
211
|
item = find_by_name(name)
|
212
212
|
if item.size > 1
|
213
213
|
raise Yao::TooManyItemFonud.new("More than one resource exists with the name '#{name}'")
|
214
|
+
elsif item.size.zero?
|
215
|
+
raise Yao::InvalidResponse.new("No resource exists with the name '#{name}'")
|
214
216
|
end
|
215
217
|
GET(create_url(item.first.id), query)
|
216
218
|
end
|
data/lib/yao/resources/role.rb
CHANGED
@@ -37,7 +37,7 @@ module Yao::Resources
|
|
37
37
|
def list_for_user(user_name, on:)
|
38
38
|
user = Yao::User.get(user_name)
|
39
39
|
tenant = if api_version_v2?
|
40
|
-
Yao::Tenant.
|
40
|
+
Yao::Tenant.get(on)
|
41
41
|
else
|
42
42
|
Yao::Project.get(on)
|
43
43
|
end
|
@@ -54,7 +54,7 @@ module Yao::Resources
|
|
54
54
|
role = Yao::Role.get(role_name)
|
55
55
|
user = Yao::User.get(to)
|
56
56
|
tenant = if api_version_v2?
|
57
|
-
Yao::Tenant.
|
57
|
+
Yao::Tenant.get(on)
|
58
58
|
else
|
59
59
|
Yao::Project.get(on)
|
60
60
|
end
|
@@ -71,7 +71,7 @@ module Yao::Resources
|
|
71
71
|
role = Yao::Role.get(role_name)
|
72
72
|
user = Yao::User.get(from)
|
73
73
|
tenant = if api_version_v2?
|
74
|
-
Yao::Tenant.
|
74
|
+
Yao::Tenant.get(on)
|
75
75
|
else
|
76
76
|
Yao::Project.get(on)
|
77
77
|
end
|
data/lib/yao/version.rb
CHANGED
@@ -66,6 +66,20 @@ class TestRestfullyAccesible < Test::Unit::TestCase
|
|
66
66
|
|
67
67
|
assert_equal("OK", Test.get(name))
|
68
68
|
end
|
69
|
+
|
70
|
+
test 'name (with no item JSON)' do
|
71
|
+
Test.return_single_on_querying = false
|
72
|
+
name = "dummy2"
|
73
|
+
uuid = "00112233-4455-6677-8899-aabbccddeeff"
|
74
|
+
body = {@resources_name => []}
|
75
|
+
|
76
|
+
stub_get_request_not_found([@url, @resources_name, name].join('/'))
|
77
|
+
stub_get_request_with_json_response([@url, "#{@resources_name}?name=#{name}"].join('/'), body)
|
78
|
+
|
79
|
+
assert_raise(Yao::InvalidResponse, "raise proper exception") do
|
80
|
+
Test.get(name)
|
81
|
+
end
|
82
|
+
end
|
69
83
|
end
|
70
84
|
|
71
85
|
sub_test_case 'get!' do
|
@@ -60,7 +60,7 @@ class TestRole < TestYaoResource
|
|
60
60
|
assert_equal("0123456789abcdef0123456789abcdef", roles.first.id)
|
61
61
|
assert_requested(stub)
|
62
62
|
end
|
63
|
-
|
63
|
+
|
64
64
|
def test_list_for_user
|
65
65
|
stub_user
|
66
66
|
stub_tenant
|
@@ -77,11 +77,11 @@ class TestRole < TestYaoResource
|
|
77
77
|
JSON
|
78
78
|
headers: {'Content-Type' => 'application/json'}
|
79
79
|
)
|
80
|
-
|
80
|
+
|
81
81
|
roles = Yao::Role.list_for_user("test_user", on:"admin")
|
82
82
|
assert_equal("0123456789abcdef0123456789abcdef", roles.first.id)
|
83
83
|
assert_received(Yao::User) { |subject| subject.get("test_user") }
|
84
|
-
assert_received(Yao::Tenant) { |subject| subject.
|
84
|
+
assert_received(Yao::Tenant) { |subject| subject.get("admin") }
|
85
85
|
assert_requested(stub)
|
86
86
|
end
|
87
87
|
|
@@ -99,7 +99,7 @@ class TestRole < TestYaoResource
|
|
99
99
|
Yao::Role.grant("test_role", to:"test_user", on:"admin")
|
100
100
|
assert_received(Yao::Role) { |subject| subject.get("test_role") }
|
101
101
|
assert_received(Yao::User) { |subject| subject.get("test_user") }
|
102
|
-
assert_received(Yao::Tenant) { |subject| subject.
|
102
|
+
assert_received(Yao::Tenant) { |subject| subject.get("admin") }
|
103
103
|
assert_requested(stub)
|
104
104
|
end
|
105
105
|
|
@@ -117,7 +117,7 @@ class TestRole < TestYaoResource
|
|
117
117
|
Yao::Role.revoke("test_role", from:"test_user", on:"admin")
|
118
118
|
assert_received(Yao::Role) { |subject| subject.get("test_role") }
|
119
119
|
assert_received(Yao::User) { |subject| subject.get("test_user") }
|
120
|
-
assert_received(Yao::Tenant) { |subject| subject.
|
120
|
+
assert_received(Yao::Tenant) { |subject| subject.get("admin") }
|
121
121
|
assert_requested(stub)
|
122
122
|
end
|
123
123
|
end
|
@@ -172,7 +172,7 @@ class TestRole < TestYaoResource
|
|
172
172
|
assert_equal("0123456789abcdef0123456789abcdef", roles.first.id)
|
173
173
|
assert_requested(stub)
|
174
174
|
end
|
175
|
-
|
175
|
+
|
176
176
|
def test_list_for_user
|
177
177
|
stub_user
|
178
178
|
stub_project
|
@@ -189,7 +189,7 @@ class TestRole < TestYaoResource
|
|
189
189
|
JSON
|
190
190
|
headers: {'Content-Type' => 'application/json'}
|
191
191
|
)
|
192
|
-
|
192
|
+
|
193
193
|
roles = Yao::Role.list_for_user("test_user", on:"admin")
|
194
194
|
assert_equal("0123456789abcdef0123456789abcdef", roles.first.id)
|
195
195
|
assert_received(Yao::Resources::User) { |subject| subject.get("test_user") }
|
@@ -249,9 +249,9 @@ class TestRole < TestYaoResource
|
|
249
249
|
"name" => "test_user",
|
250
250
|
}) }
|
251
251
|
end
|
252
|
-
|
252
|
+
|
253
253
|
def stub_tenant
|
254
|
-
stub(Yao::Tenant).
|
254
|
+
stub(Yao::Tenant).get { Yao::Tenant.new({
|
255
255
|
"id" => "0123456789abcdef0123456789abcdef",
|
256
256
|
"name" => "admin",
|
257
257
|
}) }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yao
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.13.
|
4
|
+
version: 0.13.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Uchio, KONDO
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-04-
|
11
|
+
date: 2020-04-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|