Skip to content

Commit e439ee4

Browse files
committed
Add tests for non-suffix y->ies plurals ManageIQ#376
1 parent 55b8fe0 commit e439ee4

File tree

2 files changed

+229
-0
lines changed

2 files changed

+229
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,217 @@
1+
{
2+
"kind": "APIResourceList",
3+
"groupVersion": "extensions/v1beta1",
4+
"resources": [
5+
{
6+
"name": "daemonsets",
7+
"singularName": "",
8+
"namespaced": true,
9+
"kind": "DaemonSet",
10+
"verbs": [
11+
"create",
12+
"delete",
13+
"deletecollection",
14+
"get",
15+
"list",
16+
"patch",
17+
"update",
18+
"watch"
19+
],
20+
"shortNames": [
21+
"ds"
22+
]
23+
},
24+
{
25+
"name": "daemonsets/status",
26+
"singularName": "",
27+
"namespaced": true,
28+
"kind": "DaemonSet",
29+
"verbs": [
30+
"get",
31+
"patch",
32+
"update"
33+
]
34+
},
35+
{
36+
"name": "deployments",
37+
"singularName": "",
38+
"namespaced": true,
39+
"kind": "Deployment",
40+
"verbs": [
41+
"create",
42+
"delete",
43+
"deletecollection",
44+
"get",
45+
"list",
46+
"patch",
47+
"update",
48+
"watch"
49+
],
50+
"shortNames": [
51+
"deploy"
52+
]
53+
},
54+
{
55+
"name": "deployments/rollback",
56+
"singularName": "",
57+
"namespaced": true,
58+
"kind": "DeploymentRollback",
59+
"verbs": [
60+
"create"
61+
]
62+
},
63+
{
64+
"name": "deployments/scale",
65+
"singularName": "",
66+
"namespaced": true,
67+
"group": "extensions",
68+
"version": "v1beta1",
69+
"kind": "Scale",
70+
"verbs": [
71+
"get",
72+
"patch",
73+
"update"
74+
]
75+
},
76+
{
77+
"name": "deployments/status",
78+
"singularName": "",
79+
"namespaced": true,
80+
"kind": "Deployment",
81+
"verbs": [
82+
"get",
83+
"patch",
84+
"update"
85+
]
86+
},
87+
{
88+
"name": "ingresses",
89+
"singularName": "",
90+
"namespaced": true,
91+
"kind": "Ingress",
92+
"verbs": [
93+
"create",
94+
"delete",
95+
"deletecollection",
96+
"get",
97+
"list",
98+
"patch",
99+
"update",
100+
"watch"
101+
],
102+
"shortNames": [
103+
"ing"
104+
]
105+
},
106+
{
107+
"name": "ingresses/status",
108+
"singularName": "",
109+
"namespaced": true,
110+
"kind": "Ingress",
111+
"verbs": [
112+
"get",
113+
"patch",
114+
"update"
115+
]
116+
},
117+
{
118+
"name": "networkpolicies",
119+
"singularName": "",
120+
"namespaced": true,
121+
"kind": "NetworkPolicy",
122+
"verbs": [
123+
"create",
124+
"delete",
125+
"deletecollection",
126+
"get",
127+
"list",
128+
"patch",
129+
"update",
130+
"watch"
131+
],
132+
"shortNames": [
133+
"netpol"
134+
]
135+
},
136+
{
137+
"name": "podsecuritypolicies",
138+
"singularName": "",
139+
"namespaced": false,
140+
"kind": "PodSecurityPolicy",
141+
"verbs": [
142+
"create",
143+
"delete",
144+
"deletecollection",
145+
"get",
146+
"list",
147+
"patch",
148+
"update",
149+
"watch"
150+
],
151+
"shortNames": [
152+
"psp"
153+
]
154+
},
155+
{
156+
"name": "replicasets",
157+
"singularName": "",
158+
"namespaced": true,
159+
"kind": "ReplicaSet",
160+
"verbs": [
161+
"create",
162+
"delete",
163+
"deletecollection",
164+
"get",
165+
"list",
166+
"patch",
167+
"update",
168+
"watch"
169+
],
170+
"shortNames": [
171+
"rs"
172+
]
173+
},
174+
{
175+
"name": "replicasets/scale",
176+
"singularName": "",
177+
"namespaced": true,
178+
"group": "extensions",
179+
"version": "v1beta1",
180+
"kind": "Scale",
181+
"verbs": [
182+
"get",
183+
"patch",
184+
"update"
185+
]
186+
},
187+
{
188+
"name": "replicasets/status",
189+
"singularName": "",
190+
"namespaced": true,
191+
"kind": "ReplicaSet",
192+
"verbs": [
193+
"get",
194+
"patch",
195+
"update"
196+
]
197+
},
198+
{
199+
"name": "replicationcontrollers",
200+
"singularName": "",
201+
"namespaced": true,
202+
"kind": "ReplicationControllerDummy",
203+
"verbs": []
204+
},
205+
{
206+
"name": "replicationcontrollers/scale",
207+
"singularName": "",
208+
"namespaced": true,
209+
"kind": "Scale",
210+
"verbs": [
211+
"get",
212+
"patch",
213+
"update"
214+
]
215+
}
216+
]
217+
}

test/test_missing_methods.rb

+12
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,18 @@ def test_missing
4141
end
4242
end
4343

44+
def test_nonsuffix_plurals
45+
stub_request(:get, %r{/apis/extensions/v1beta1$}).to_return(
46+
body: open_test_file('extensions_v1beta1_api_resource_list.json'),
47+
status: 200
48+
)
49+
client = Kubeclient::Client.new('http://localhost:8080/apis/extensions', 'v1beta1')
50+
assert_equal(true, client.respond_to?(:get_network_policy))
51+
assert_equal(true, client.respond_to?(:get_network_policies))
52+
assert_equal(true, client.respond_to?(:get_pod_security_policy))
53+
assert_equal(true, client.respond_to?(:get_pod_security_policies))
54+
end
55+
4456
def test_irregular_names
4557
stub_core_api_list
4658
client = Kubeclient::Client.new('http://localhost:8080/api/', 'v1')

0 commit comments

Comments
 (0)