OLD | NEW |
1 library googleapis.cloudkms.v1.test; | 1 library googleapis.cloudkms.v1.test; |
2 | 2 |
3 import "dart:core" as core; | 3 import "dart:core" as core; |
4 import "dart:collection" as collection; | |
5 import "dart:async" as async; | 4 import "dart:async" as async; |
6 import "dart:convert" as convert; | 5 import "dart:convert" as convert; |
7 | 6 |
8 import 'package:http/http.dart' as http; | 7 import 'package:http/http.dart' as http; |
9 import 'package:http/testing.dart' as http_testing; | |
10 import 'package:test/test.dart' as unittest; | 8 import 'package:test/test.dart' as unittest; |
11 | 9 |
12 import 'package:googleapis/cloudkms/v1.dart' as api; | 10 import 'package:googleapis/cloudkms/v1.dart' as api; |
13 | 11 |
14 class HttpServerMock extends http.BaseClient { | 12 class HttpServerMock extends http.BaseClient { |
15 core.Function _callback; | 13 core.Function _callback; |
16 core.bool _expectJson; | 14 core.bool _expectJson; |
17 | 15 |
18 void register(core.Function callback, core.bool expectJson) { | 16 void register(core.Function callback, core.bool expectJson) { |
19 _callback = callback; | 17 _callback = callback; |
20 _expectJson = expectJson; | 18 _expectJson = expectJson; |
21 } | 19 } |
22 | 20 |
23 async.Future<http.StreamedResponse> send(http.BaseRequest request) { | 21 async.Future<http.StreamedResponse> send(http.BaseRequest request) { |
24 if (_expectJson) { | 22 if (_expectJson) { |
25 return request.finalize() | 23 return request |
| 24 .finalize() |
26 .transform(convert.UTF8.decoder) | 25 .transform(convert.UTF8.decoder) |
27 .join('') | 26 .join('') |
28 .then((core.String jsonString) { | 27 .then((core.String jsonString) { |
29 if (jsonString.isEmpty) { | 28 if (jsonString.isEmpty) { |
30 return _callback(request, null); | 29 return _callback(request, null); |
31 } else { | 30 } else { |
32 return _callback(request, convert.JSON.decode(jsonString)); | 31 return _callback(request, convert.JSON.decode(jsonString)); |
33 } | 32 } |
34 }); | 33 }); |
35 } else { | 34 } else { |
36 var stream = request.finalize(); | 35 var stream = request.finalize(); |
37 if (stream == null) { | 36 if (stream == null) { |
38 return _callback(request, []); | 37 return _callback(request, []); |
39 } else { | 38 } else { |
40 return stream.toBytes().then((data) { | 39 return stream.toBytes().then((data) { |
41 return _callback(request, data); | 40 return _callback(request, data); |
42 }); | 41 }); |
43 } | 42 } |
44 } | 43 } |
45 } | 44 } |
46 } | 45 } |
47 | 46 |
48 http.StreamedResponse stringResponse( | 47 http.StreamedResponse stringResponse(core.int status, |
49 core.int status, core.Map<core.String, core.String> headers, core.String bod
y) { | 48 core.Map<core.String, core.String> headers, core.String body) { |
50 var stream = new async.Stream.fromIterable([convert.UTF8.encode(body)]); | 49 var stream = new async.Stream.fromIterable([convert.UTF8.encode(body)]); |
51 return new http.StreamedResponse(stream, status, headers: headers); | 50 return new http.StreamedResponse(stream, status, headers: headers); |
52 } | 51 } |
53 | 52 |
54 buildUnnamed1387() { | 53 buildUnnamed1383() { |
55 var o = new core.List<api.AuditLogConfig>(); | 54 var o = new core.List<api.AuditLogConfig>(); |
56 o.add(buildAuditLogConfig()); | 55 o.add(buildAuditLogConfig()); |
57 o.add(buildAuditLogConfig()); | 56 o.add(buildAuditLogConfig()); |
58 return o; | 57 return o; |
59 } | 58 } |
60 | 59 |
61 checkUnnamed1387(core.List<api.AuditLogConfig> o) { | 60 checkUnnamed1383(core.List<api.AuditLogConfig> o) { |
62 unittest.expect(o, unittest.hasLength(2)); | 61 unittest.expect(o, unittest.hasLength(2)); |
63 checkAuditLogConfig(o[0]); | 62 checkAuditLogConfig(o[0]); |
64 checkAuditLogConfig(o[1]); | 63 checkAuditLogConfig(o[1]); |
65 } | 64 } |
66 | 65 |
67 buildUnnamed1388() { | 66 buildUnnamed1384() { |
68 var o = new core.List<core.String>(); | 67 var o = new core.List<core.String>(); |
69 o.add("foo"); | 68 o.add("foo"); |
70 o.add("foo"); | 69 o.add("foo"); |
71 return o; | 70 return o; |
72 } | 71 } |
73 | 72 |
74 checkUnnamed1388(core.List<core.String> o) { | 73 checkUnnamed1384(core.List<core.String> o) { |
75 unittest.expect(o, unittest.hasLength(2)); | 74 unittest.expect(o, unittest.hasLength(2)); |
76 unittest.expect(o[0], unittest.equals('foo')); | 75 unittest.expect(o[0], unittest.equals('foo')); |
77 unittest.expect(o[1], unittest.equals('foo')); | 76 unittest.expect(o[1], unittest.equals('foo')); |
78 } | 77 } |
79 | 78 |
80 core.int buildCounterAuditConfig = 0; | 79 core.int buildCounterAuditConfig = 0; |
81 buildAuditConfig() { | 80 buildAuditConfig() { |
82 var o = new api.AuditConfig(); | 81 var o = new api.AuditConfig(); |
83 buildCounterAuditConfig++; | 82 buildCounterAuditConfig++; |
84 if (buildCounterAuditConfig < 3) { | 83 if (buildCounterAuditConfig < 3) { |
85 o.auditLogConfigs = buildUnnamed1387(); | 84 o.auditLogConfigs = buildUnnamed1383(); |
86 o.exemptedMembers = buildUnnamed1388(); | 85 o.exemptedMembers = buildUnnamed1384(); |
87 o.service = "foo"; | 86 o.service = "foo"; |
88 } | 87 } |
89 buildCounterAuditConfig--; | 88 buildCounterAuditConfig--; |
90 return o; | 89 return o; |
91 } | 90 } |
92 | 91 |
93 checkAuditConfig(api.AuditConfig o) { | 92 checkAuditConfig(api.AuditConfig o) { |
94 buildCounterAuditConfig++; | 93 buildCounterAuditConfig++; |
95 if (buildCounterAuditConfig < 3) { | 94 if (buildCounterAuditConfig < 3) { |
96 checkUnnamed1387(o.auditLogConfigs); | 95 checkUnnamed1383(o.auditLogConfigs); |
97 checkUnnamed1388(o.exemptedMembers); | 96 checkUnnamed1384(o.exemptedMembers); |
98 unittest.expect(o.service, unittest.equals('foo')); | 97 unittest.expect(o.service, unittest.equals('foo')); |
99 } | 98 } |
100 buildCounterAuditConfig--; | 99 buildCounterAuditConfig--; |
101 } | 100 } |
102 | 101 |
103 buildUnnamed1389() { | 102 buildUnnamed1385() { |
104 var o = new core.List<core.String>(); | 103 var o = new core.List<core.String>(); |
105 o.add("foo"); | 104 o.add("foo"); |
106 o.add("foo"); | 105 o.add("foo"); |
107 return o; | 106 return o; |
108 } | 107 } |
109 | 108 |
110 checkUnnamed1389(core.List<core.String> o) { | 109 checkUnnamed1385(core.List<core.String> o) { |
111 unittest.expect(o, unittest.hasLength(2)); | 110 unittest.expect(o, unittest.hasLength(2)); |
112 unittest.expect(o[0], unittest.equals('foo')); | 111 unittest.expect(o[0], unittest.equals('foo')); |
113 unittest.expect(o[1], unittest.equals('foo')); | 112 unittest.expect(o[1], unittest.equals('foo')); |
114 } | 113 } |
115 | 114 |
116 core.int buildCounterAuditLogConfig = 0; | 115 core.int buildCounterAuditLogConfig = 0; |
117 buildAuditLogConfig() { | 116 buildAuditLogConfig() { |
118 var o = new api.AuditLogConfig(); | 117 var o = new api.AuditLogConfig(); |
119 buildCounterAuditLogConfig++; | 118 buildCounterAuditLogConfig++; |
120 if (buildCounterAuditLogConfig < 3) { | 119 if (buildCounterAuditLogConfig < 3) { |
121 o.exemptedMembers = buildUnnamed1389(); | 120 o.exemptedMembers = buildUnnamed1385(); |
122 o.logType = "foo"; | 121 o.logType = "foo"; |
123 } | 122 } |
124 buildCounterAuditLogConfig--; | 123 buildCounterAuditLogConfig--; |
125 return o; | 124 return o; |
126 } | 125 } |
127 | 126 |
128 checkAuditLogConfig(api.AuditLogConfig o) { | 127 checkAuditLogConfig(api.AuditLogConfig o) { |
129 buildCounterAuditLogConfig++; | 128 buildCounterAuditLogConfig++; |
130 if (buildCounterAuditLogConfig < 3) { | 129 if (buildCounterAuditLogConfig < 3) { |
131 checkUnnamed1389(o.exemptedMembers); | 130 checkUnnamed1385(o.exemptedMembers); |
132 unittest.expect(o.logType, unittest.equals('foo')); | 131 unittest.expect(o.logType, unittest.equals('foo')); |
133 } | 132 } |
134 buildCounterAuditLogConfig--; | 133 buildCounterAuditLogConfig--; |
135 } | 134 } |
136 | 135 |
137 buildUnnamed1390() { | 136 buildUnnamed1386() { |
138 var o = new core.List<core.String>(); | 137 var o = new core.List<core.String>(); |
139 o.add("foo"); | 138 o.add("foo"); |
140 o.add("foo"); | 139 o.add("foo"); |
141 return o; | 140 return o; |
142 } | 141 } |
143 | 142 |
144 checkUnnamed1390(core.List<core.String> o) { | 143 checkUnnamed1386(core.List<core.String> o) { |
145 unittest.expect(o, unittest.hasLength(2)); | 144 unittest.expect(o, unittest.hasLength(2)); |
146 unittest.expect(o[0], unittest.equals('foo')); | 145 unittest.expect(o[0], unittest.equals('foo')); |
147 unittest.expect(o[1], unittest.equals('foo')); | 146 unittest.expect(o[1], unittest.equals('foo')); |
148 } | 147 } |
149 | 148 |
150 core.int buildCounterBinding = 0; | 149 core.int buildCounterBinding = 0; |
151 buildBinding() { | 150 buildBinding() { |
152 var o = new api.Binding(); | 151 var o = new api.Binding(); |
153 buildCounterBinding++; | 152 buildCounterBinding++; |
154 if (buildCounterBinding < 3) { | 153 if (buildCounterBinding < 3) { |
155 o.condition = buildExpr(); | 154 o.condition = buildExpr(); |
156 o.members = buildUnnamed1390(); | 155 o.members = buildUnnamed1386(); |
157 o.role = "foo"; | 156 o.role = "foo"; |
158 } | 157 } |
159 buildCounterBinding--; | 158 buildCounterBinding--; |
160 return o; | 159 return o; |
161 } | 160 } |
162 | 161 |
163 checkBinding(api.Binding o) { | 162 checkBinding(api.Binding o) { |
164 buildCounterBinding++; | 163 buildCounterBinding++; |
165 if (buildCounterBinding < 3) { | 164 if (buildCounterBinding < 3) { |
166 checkExpr(o.condition); | 165 checkExpr(o.condition); |
167 checkUnnamed1390(o.members); | 166 checkUnnamed1386(o.members); |
168 unittest.expect(o.role, unittest.equals('foo')); | 167 unittest.expect(o.role, unittest.equals('foo')); |
169 } | 168 } |
170 buildCounterBinding--; | 169 buildCounterBinding--; |
171 } | 170 } |
172 | 171 |
173 core.int buildCounterCloudAuditOptions = 0; | 172 buildUnnamed1387() { |
174 buildCloudAuditOptions() { | 173 var o = new core.Map<core.String, core.String>(); |
175 var o = new api.CloudAuditOptions(); | 174 o["x"] = "foo"; |
176 buildCounterCloudAuditOptions++; | 175 o["y"] = "foo"; |
177 if (buildCounterCloudAuditOptions < 3) { | |
178 o.logName = "foo"; | |
179 } | |
180 buildCounterCloudAuditOptions--; | |
181 return o; | 176 return o; |
182 } | 177 } |
183 | 178 |
184 checkCloudAuditOptions(api.CloudAuditOptions o) { | 179 checkUnnamed1387(core.Map<core.String, core.String> o) { |
185 buildCounterCloudAuditOptions++; | |
186 if (buildCounterCloudAuditOptions < 3) { | |
187 unittest.expect(o.logName, unittest.equals('foo')); | |
188 } | |
189 buildCounterCloudAuditOptions--; | |
190 } | |
191 | |
192 buildUnnamed1391() { | |
193 var o = new core.List<core.String>(); | |
194 o.add("foo"); | |
195 o.add("foo"); | |
196 return o; | |
197 } | |
198 | |
199 checkUnnamed1391(core.List<core.String> o) { | |
200 unittest.expect(o, unittest.hasLength(2)); | 180 unittest.expect(o, unittest.hasLength(2)); |
201 unittest.expect(o[0], unittest.equals('foo')); | 181 unittest.expect(o["x"], unittest.equals('foo')); |
202 unittest.expect(o[1], unittest.equals('foo')); | 182 unittest.expect(o["y"], unittest.equals('foo')); |
203 } | |
204 | |
205 core.int buildCounterCondition = 0; | |
206 buildCondition() { | |
207 var o = new api.Condition(); | |
208 buildCounterCondition++; | |
209 if (buildCounterCondition < 3) { | |
210 o.iam = "foo"; | |
211 o.op = "foo"; | |
212 o.svc = "foo"; | |
213 o.sys = "foo"; | |
214 o.value = "foo"; | |
215 o.values = buildUnnamed1391(); | |
216 } | |
217 buildCounterCondition--; | |
218 return o; | |
219 } | |
220 | |
221 checkCondition(api.Condition o) { | |
222 buildCounterCondition++; | |
223 if (buildCounterCondition < 3) { | |
224 unittest.expect(o.iam, unittest.equals('foo')); | |
225 unittest.expect(o.op, unittest.equals('foo')); | |
226 unittest.expect(o.svc, unittest.equals('foo')); | |
227 unittest.expect(o.sys, unittest.equals('foo')); | |
228 unittest.expect(o.value, unittest.equals('foo')); | |
229 checkUnnamed1391(o.values); | |
230 } | |
231 buildCounterCondition--; | |
232 } | |
233 | |
234 core.int buildCounterCounterOptions = 0; | |
235 buildCounterOptions() { | |
236 var o = new api.CounterOptions(); | |
237 buildCounterCounterOptions++; | |
238 if (buildCounterCounterOptions < 3) { | |
239 o.field = "foo"; | |
240 o.metric = "foo"; | |
241 } | |
242 buildCounterCounterOptions--; | |
243 return o; | |
244 } | |
245 | |
246 checkCounterOptions(api.CounterOptions o) { | |
247 buildCounterCounterOptions++; | |
248 if (buildCounterCounterOptions < 3) { | |
249 unittest.expect(o.field, unittest.equals('foo')); | |
250 unittest.expect(o.metric, unittest.equals('foo')); | |
251 } | |
252 buildCounterCounterOptions--; | |
253 } | 183 } |
254 | 184 |
255 core.int buildCounterCryptoKey = 0; | 185 core.int buildCounterCryptoKey = 0; |
256 buildCryptoKey() { | 186 buildCryptoKey() { |
257 var o = new api.CryptoKey(); | 187 var o = new api.CryptoKey(); |
258 buildCounterCryptoKey++; | 188 buildCounterCryptoKey++; |
259 if (buildCounterCryptoKey < 3) { | 189 if (buildCounterCryptoKey < 3) { |
260 o.createTime = "foo"; | 190 o.createTime = "foo"; |
| 191 o.labels = buildUnnamed1387(); |
261 o.name = "foo"; | 192 o.name = "foo"; |
262 o.nextRotationTime = "foo"; | 193 o.nextRotationTime = "foo"; |
263 o.primary = buildCryptoKeyVersion(); | 194 o.primary = buildCryptoKeyVersion(); |
264 o.purpose = "foo"; | 195 o.purpose = "foo"; |
265 o.rotationPeriod = "foo"; | 196 o.rotationPeriod = "foo"; |
266 } | 197 } |
267 buildCounterCryptoKey--; | 198 buildCounterCryptoKey--; |
268 return o; | 199 return o; |
269 } | 200 } |
270 | 201 |
271 checkCryptoKey(api.CryptoKey o) { | 202 checkCryptoKey(api.CryptoKey o) { |
272 buildCounterCryptoKey++; | 203 buildCounterCryptoKey++; |
273 if (buildCounterCryptoKey < 3) { | 204 if (buildCounterCryptoKey < 3) { |
274 unittest.expect(o.createTime, unittest.equals('foo')); | 205 unittest.expect(o.createTime, unittest.equals('foo')); |
| 206 checkUnnamed1387(o.labels); |
275 unittest.expect(o.name, unittest.equals('foo')); | 207 unittest.expect(o.name, unittest.equals('foo')); |
276 unittest.expect(o.nextRotationTime, unittest.equals('foo')); | 208 unittest.expect(o.nextRotationTime, unittest.equals('foo')); |
277 checkCryptoKeyVersion(o.primary); | 209 checkCryptoKeyVersion(o.primary); |
278 unittest.expect(o.purpose, unittest.equals('foo')); | 210 unittest.expect(o.purpose, unittest.equals('foo')); |
279 unittest.expect(o.rotationPeriod, unittest.equals('foo')); | 211 unittest.expect(o.rotationPeriod, unittest.equals('foo')); |
280 } | 212 } |
281 buildCounterCryptoKey--; | 213 buildCounterCryptoKey--; |
282 } | 214 } |
283 | 215 |
284 core.int buildCounterCryptoKeyVersion = 0; | 216 core.int buildCounterCryptoKeyVersion = 0; |
(...skipping 16 matching lines...) Expand all Loading... |
301 if (buildCounterCryptoKeyVersion < 3) { | 233 if (buildCounterCryptoKeyVersion < 3) { |
302 unittest.expect(o.createTime, unittest.equals('foo')); | 234 unittest.expect(o.createTime, unittest.equals('foo')); |
303 unittest.expect(o.destroyEventTime, unittest.equals('foo')); | 235 unittest.expect(o.destroyEventTime, unittest.equals('foo')); |
304 unittest.expect(o.destroyTime, unittest.equals('foo')); | 236 unittest.expect(o.destroyTime, unittest.equals('foo')); |
305 unittest.expect(o.name, unittest.equals('foo')); | 237 unittest.expect(o.name, unittest.equals('foo')); |
306 unittest.expect(o.state, unittest.equals('foo')); | 238 unittest.expect(o.state, unittest.equals('foo')); |
307 } | 239 } |
308 buildCounterCryptoKeyVersion--; | 240 buildCounterCryptoKeyVersion--; |
309 } | 241 } |
310 | 242 |
311 core.int buildCounterDataAccessOptions = 0; | |
312 buildDataAccessOptions() { | |
313 var o = new api.DataAccessOptions(); | |
314 buildCounterDataAccessOptions++; | |
315 if (buildCounterDataAccessOptions < 3) { | |
316 o.logMode = "foo"; | |
317 } | |
318 buildCounterDataAccessOptions--; | |
319 return o; | |
320 } | |
321 | |
322 checkDataAccessOptions(api.DataAccessOptions o) { | |
323 buildCounterDataAccessOptions++; | |
324 if (buildCounterDataAccessOptions < 3) { | |
325 unittest.expect(o.logMode, unittest.equals('foo')); | |
326 } | |
327 buildCounterDataAccessOptions--; | |
328 } | |
329 | |
330 core.int buildCounterDecryptRequest = 0; | 243 core.int buildCounterDecryptRequest = 0; |
331 buildDecryptRequest() { | 244 buildDecryptRequest() { |
332 var o = new api.DecryptRequest(); | 245 var o = new api.DecryptRequest(); |
333 buildCounterDecryptRequest++; | 246 buildCounterDecryptRequest++; |
334 if (buildCounterDecryptRequest < 3) { | 247 if (buildCounterDecryptRequest < 3) { |
335 o.additionalAuthenticatedData = "foo"; | 248 o.additionalAuthenticatedData = "foo"; |
336 o.ciphertext = "foo"; | 249 o.ciphertext = "foo"; |
337 } | 250 } |
338 buildCounterDecryptRequest--; | 251 buildCounterDecryptRequest--; |
339 return o; | 252 return o; |
(...skipping 24 matching lines...) Expand all Loading... |
364 if (buildCounterDecryptResponse < 3) { | 277 if (buildCounterDecryptResponse < 3) { |
365 unittest.expect(o.plaintext, unittest.equals('foo')); | 278 unittest.expect(o.plaintext, unittest.equals('foo')); |
366 } | 279 } |
367 buildCounterDecryptResponse--; | 280 buildCounterDecryptResponse--; |
368 } | 281 } |
369 | 282 |
370 core.int buildCounterDestroyCryptoKeyVersionRequest = 0; | 283 core.int buildCounterDestroyCryptoKeyVersionRequest = 0; |
371 buildDestroyCryptoKeyVersionRequest() { | 284 buildDestroyCryptoKeyVersionRequest() { |
372 var o = new api.DestroyCryptoKeyVersionRequest(); | 285 var o = new api.DestroyCryptoKeyVersionRequest(); |
373 buildCounterDestroyCryptoKeyVersionRequest++; | 286 buildCounterDestroyCryptoKeyVersionRequest++; |
374 if (buildCounterDestroyCryptoKeyVersionRequest < 3) { | 287 if (buildCounterDestroyCryptoKeyVersionRequest < 3) {} |
375 } | |
376 buildCounterDestroyCryptoKeyVersionRequest--; | 288 buildCounterDestroyCryptoKeyVersionRequest--; |
377 return o; | 289 return o; |
378 } | 290 } |
379 | 291 |
380 checkDestroyCryptoKeyVersionRequest(api.DestroyCryptoKeyVersionRequest o) { | 292 checkDestroyCryptoKeyVersionRequest(api.DestroyCryptoKeyVersionRequest o) { |
381 buildCounterDestroyCryptoKeyVersionRequest++; | 293 buildCounterDestroyCryptoKeyVersionRequest++; |
382 if (buildCounterDestroyCryptoKeyVersionRequest < 3) { | 294 if (buildCounterDestroyCryptoKeyVersionRequest < 3) {} |
383 } | |
384 buildCounterDestroyCryptoKeyVersionRequest--; | 295 buildCounterDestroyCryptoKeyVersionRequest--; |
385 } | 296 } |
386 | 297 |
387 core.int buildCounterEncryptRequest = 0; | 298 core.int buildCounterEncryptRequest = 0; |
388 buildEncryptRequest() { | 299 buildEncryptRequest() { |
389 var o = new api.EncryptRequest(); | 300 var o = new api.EncryptRequest(); |
390 buildCounterEncryptRequest++; | 301 buildCounterEncryptRequest++; |
391 if (buildCounterEncryptRequest < 3) { | 302 if (buildCounterEncryptRequest < 3) { |
392 o.additionalAuthenticatedData = "foo"; | 303 o.additionalAuthenticatedData = "foo"; |
393 o.plaintext = "foo"; | 304 o.plaintext = "foo"; |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 | 376 |
466 checkKeyRing(api.KeyRing o) { | 377 checkKeyRing(api.KeyRing o) { |
467 buildCounterKeyRing++; | 378 buildCounterKeyRing++; |
468 if (buildCounterKeyRing < 3) { | 379 if (buildCounterKeyRing < 3) { |
469 unittest.expect(o.createTime, unittest.equals('foo')); | 380 unittest.expect(o.createTime, unittest.equals('foo')); |
470 unittest.expect(o.name, unittest.equals('foo')); | 381 unittest.expect(o.name, unittest.equals('foo')); |
471 } | 382 } |
472 buildCounterKeyRing--; | 383 buildCounterKeyRing--; |
473 } | 384 } |
474 | 385 |
475 buildUnnamed1392() { | 386 buildUnnamed1388() { |
476 var o = new core.List<api.CryptoKeyVersion>(); | 387 var o = new core.List<api.CryptoKeyVersion>(); |
477 o.add(buildCryptoKeyVersion()); | 388 o.add(buildCryptoKeyVersion()); |
478 o.add(buildCryptoKeyVersion()); | 389 o.add(buildCryptoKeyVersion()); |
479 return o; | 390 return o; |
480 } | 391 } |
481 | 392 |
482 checkUnnamed1392(core.List<api.CryptoKeyVersion> o) { | 393 checkUnnamed1388(core.List<api.CryptoKeyVersion> o) { |
483 unittest.expect(o, unittest.hasLength(2)); | 394 unittest.expect(o, unittest.hasLength(2)); |
484 checkCryptoKeyVersion(o[0]); | 395 checkCryptoKeyVersion(o[0]); |
485 checkCryptoKeyVersion(o[1]); | 396 checkCryptoKeyVersion(o[1]); |
486 } | 397 } |
487 | 398 |
488 core.int buildCounterListCryptoKeyVersionsResponse = 0; | 399 core.int buildCounterListCryptoKeyVersionsResponse = 0; |
489 buildListCryptoKeyVersionsResponse() { | 400 buildListCryptoKeyVersionsResponse() { |
490 var o = new api.ListCryptoKeyVersionsResponse(); | 401 var o = new api.ListCryptoKeyVersionsResponse(); |
491 buildCounterListCryptoKeyVersionsResponse++; | 402 buildCounterListCryptoKeyVersionsResponse++; |
492 if (buildCounterListCryptoKeyVersionsResponse < 3) { | 403 if (buildCounterListCryptoKeyVersionsResponse < 3) { |
493 o.cryptoKeyVersions = buildUnnamed1392(); | 404 o.cryptoKeyVersions = buildUnnamed1388(); |
494 o.nextPageToken = "foo"; | 405 o.nextPageToken = "foo"; |
495 o.totalSize = 42; | 406 o.totalSize = 42; |
496 } | 407 } |
497 buildCounterListCryptoKeyVersionsResponse--; | 408 buildCounterListCryptoKeyVersionsResponse--; |
498 return o; | 409 return o; |
499 } | 410 } |
500 | 411 |
501 checkListCryptoKeyVersionsResponse(api.ListCryptoKeyVersionsResponse o) { | 412 checkListCryptoKeyVersionsResponse(api.ListCryptoKeyVersionsResponse o) { |
502 buildCounterListCryptoKeyVersionsResponse++; | 413 buildCounterListCryptoKeyVersionsResponse++; |
503 if (buildCounterListCryptoKeyVersionsResponse < 3) { | 414 if (buildCounterListCryptoKeyVersionsResponse < 3) { |
504 checkUnnamed1392(o.cryptoKeyVersions); | 415 checkUnnamed1388(o.cryptoKeyVersions); |
505 unittest.expect(o.nextPageToken, unittest.equals('foo')); | 416 unittest.expect(o.nextPageToken, unittest.equals('foo')); |
506 unittest.expect(o.totalSize, unittest.equals(42)); | 417 unittest.expect(o.totalSize, unittest.equals(42)); |
507 } | 418 } |
508 buildCounterListCryptoKeyVersionsResponse--; | 419 buildCounterListCryptoKeyVersionsResponse--; |
509 } | 420 } |
510 | 421 |
511 buildUnnamed1393() { | 422 buildUnnamed1389() { |
512 var o = new core.List<api.CryptoKey>(); | 423 var o = new core.List<api.CryptoKey>(); |
513 o.add(buildCryptoKey()); | 424 o.add(buildCryptoKey()); |
514 o.add(buildCryptoKey()); | 425 o.add(buildCryptoKey()); |
515 return o; | 426 return o; |
516 } | 427 } |
517 | 428 |
518 checkUnnamed1393(core.List<api.CryptoKey> o) { | 429 checkUnnamed1389(core.List<api.CryptoKey> o) { |
519 unittest.expect(o, unittest.hasLength(2)); | 430 unittest.expect(o, unittest.hasLength(2)); |
520 checkCryptoKey(o[0]); | 431 checkCryptoKey(o[0]); |
521 checkCryptoKey(o[1]); | 432 checkCryptoKey(o[1]); |
522 } | 433 } |
523 | 434 |
524 core.int buildCounterListCryptoKeysResponse = 0; | 435 core.int buildCounterListCryptoKeysResponse = 0; |
525 buildListCryptoKeysResponse() { | 436 buildListCryptoKeysResponse() { |
526 var o = new api.ListCryptoKeysResponse(); | 437 var o = new api.ListCryptoKeysResponse(); |
527 buildCounterListCryptoKeysResponse++; | 438 buildCounterListCryptoKeysResponse++; |
528 if (buildCounterListCryptoKeysResponse < 3) { | 439 if (buildCounterListCryptoKeysResponse < 3) { |
529 o.cryptoKeys = buildUnnamed1393(); | 440 o.cryptoKeys = buildUnnamed1389(); |
530 o.nextPageToken = "foo"; | 441 o.nextPageToken = "foo"; |
531 o.totalSize = 42; | 442 o.totalSize = 42; |
532 } | 443 } |
533 buildCounterListCryptoKeysResponse--; | 444 buildCounterListCryptoKeysResponse--; |
534 return o; | 445 return o; |
535 } | 446 } |
536 | 447 |
537 checkListCryptoKeysResponse(api.ListCryptoKeysResponse o) { | 448 checkListCryptoKeysResponse(api.ListCryptoKeysResponse o) { |
538 buildCounterListCryptoKeysResponse++; | 449 buildCounterListCryptoKeysResponse++; |
539 if (buildCounterListCryptoKeysResponse < 3) { | 450 if (buildCounterListCryptoKeysResponse < 3) { |
540 checkUnnamed1393(o.cryptoKeys); | 451 checkUnnamed1389(o.cryptoKeys); |
541 unittest.expect(o.nextPageToken, unittest.equals('foo')); | 452 unittest.expect(o.nextPageToken, unittest.equals('foo')); |
542 unittest.expect(o.totalSize, unittest.equals(42)); | 453 unittest.expect(o.totalSize, unittest.equals(42)); |
543 } | 454 } |
544 buildCounterListCryptoKeysResponse--; | 455 buildCounterListCryptoKeysResponse--; |
545 } | 456 } |
546 | 457 |
547 buildUnnamed1394() { | 458 buildUnnamed1390() { |
548 var o = new core.List<api.KeyRing>(); | 459 var o = new core.List<api.KeyRing>(); |
549 o.add(buildKeyRing()); | 460 o.add(buildKeyRing()); |
550 o.add(buildKeyRing()); | 461 o.add(buildKeyRing()); |
551 return o; | 462 return o; |
552 } | 463 } |
553 | 464 |
554 checkUnnamed1394(core.List<api.KeyRing> o) { | 465 checkUnnamed1390(core.List<api.KeyRing> o) { |
555 unittest.expect(o, unittest.hasLength(2)); | 466 unittest.expect(o, unittest.hasLength(2)); |
556 checkKeyRing(o[0]); | 467 checkKeyRing(o[0]); |
557 checkKeyRing(o[1]); | 468 checkKeyRing(o[1]); |
558 } | 469 } |
559 | 470 |
560 core.int buildCounterListKeyRingsResponse = 0; | 471 core.int buildCounterListKeyRingsResponse = 0; |
561 buildListKeyRingsResponse() { | 472 buildListKeyRingsResponse() { |
562 var o = new api.ListKeyRingsResponse(); | 473 var o = new api.ListKeyRingsResponse(); |
563 buildCounterListKeyRingsResponse++; | 474 buildCounterListKeyRingsResponse++; |
564 if (buildCounterListKeyRingsResponse < 3) { | 475 if (buildCounterListKeyRingsResponse < 3) { |
565 o.keyRings = buildUnnamed1394(); | 476 o.keyRings = buildUnnamed1390(); |
566 o.nextPageToken = "foo"; | 477 o.nextPageToken = "foo"; |
567 o.totalSize = 42; | 478 o.totalSize = 42; |
568 } | 479 } |
569 buildCounterListKeyRingsResponse--; | 480 buildCounterListKeyRingsResponse--; |
570 return o; | 481 return o; |
571 } | 482 } |
572 | 483 |
573 checkListKeyRingsResponse(api.ListKeyRingsResponse o) { | 484 checkListKeyRingsResponse(api.ListKeyRingsResponse o) { |
574 buildCounterListKeyRingsResponse++; | 485 buildCounterListKeyRingsResponse++; |
575 if (buildCounterListKeyRingsResponse < 3) { | 486 if (buildCounterListKeyRingsResponse < 3) { |
576 checkUnnamed1394(o.keyRings); | 487 checkUnnamed1390(o.keyRings); |
577 unittest.expect(o.nextPageToken, unittest.equals('foo')); | 488 unittest.expect(o.nextPageToken, unittest.equals('foo')); |
578 unittest.expect(o.totalSize, unittest.equals(42)); | 489 unittest.expect(o.totalSize, unittest.equals(42)); |
579 } | 490 } |
580 buildCounterListKeyRingsResponse--; | 491 buildCounterListKeyRingsResponse--; |
581 } | 492 } |
582 | 493 |
583 buildUnnamed1395() { | 494 buildUnnamed1391() { |
584 var o = new core.List<api.Location>(); | 495 var o = new core.List<api.Location>(); |
585 o.add(buildLocation()); | 496 o.add(buildLocation()); |
586 o.add(buildLocation()); | 497 o.add(buildLocation()); |
587 return o; | 498 return o; |
588 } | 499 } |
589 | 500 |
590 checkUnnamed1395(core.List<api.Location> o) { | 501 checkUnnamed1391(core.List<api.Location> o) { |
591 unittest.expect(o, unittest.hasLength(2)); | 502 unittest.expect(o, unittest.hasLength(2)); |
592 checkLocation(o[0]); | 503 checkLocation(o[0]); |
593 checkLocation(o[1]); | 504 checkLocation(o[1]); |
594 } | 505 } |
595 | 506 |
596 core.int buildCounterListLocationsResponse = 0; | 507 core.int buildCounterListLocationsResponse = 0; |
597 buildListLocationsResponse() { | 508 buildListLocationsResponse() { |
598 var o = new api.ListLocationsResponse(); | 509 var o = new api.ListLocationsResponse(); |
599 buildCounterListLocationsResponse++; | 510 buildCounterListLocationsResponse++; |
600 if (buildCounterListLocationsResponse < 3) { | 511 if (buildCounterListLocationsResponse < 3) { |
601 o.locations = buildUnnamed1395(); | 512 o.locations = buildUnnamed1391(); |
602 o.nextPageToken = "foo"; | 513 o.nextPageToken = "foo"; |
603 } | 514 } |
604 buildCounterListLocationsResponse--; | 515 buildCounterListLocationsResponse--; |
605 return o; | 516 return o; |
606 } | 517 } |
607 | 518 |
608 checkListLocationsResponse(api.ListLocationsResponse o) { | 519 checkListLocationsResponse(api.ListLocationsResponse o) { |
609 buildCounterListLocationsResponse++; | 520 buildCounterListLocationsResponse++; |
610 if (buildCounterListLocationsResponse < 3) { | 521 if (buildCounterListLocationsResponse < 3) { |
611 checkUnnamed1395(o.locations); | 522 checkUnnamed1391(o.locations); |
612 unittest.expect(o.nextPageToken, unittest.equals('foo')); | 523 unittest.expect(o.nextPageToken, unittest.equals('foo')); |
613 } | 524 } |
614 buildCounterListLocationsResponse--; | 525 buildCounterListLocationsResponse--; |
615 } | 526 } |
616 | 527 |
617 buildUnnamed1396() { | 528 buildUnnamed1392() { |
618 var o = new core.Map<core.String, core.String>(); | 529 var o = new core.Map<core.String, core.String>(); |
619 o["x"] = "foo"; | 530 o["x"] = "foo"; |
620 o["y"] = "foo"; | 531 o["y"] = "foo"; |
621 return o; | 532 return o; |
622 } | 533 } |
623 | 534 |
624 checkUnnamed1396(core.Map<core.String, core.String> o) { | 535 checkUnnamed1392(core.Map<core.String, core.String> o) { |
625 unittest.expect(o, unittest.hasLength(2)); | 536 unittest.expect(o, unittest.hasLength(2)); |
626 unittest.expect(o["x"], unittest.equals('foo')); | 537 unittest.expect(o["x"], unittest.equals('foo')); |
627 unittest.expect(o["y"], unittest.equals('foo')); | 538 unittest.expect(o["y"], unittest.equals('foo')); |
628 } | 539 } |
629 | 540 |
630 buildUnnamed1397() { | 541 buildUnnamed1393() { |
631 var o = new core.Map<core.String, core.Object>(); | 542 var o = new core.Map<core.String, core.Object>(); |
632 o["x"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; | 543 o["x"] = { |
633 o["y"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; | 544 'list': [1, 2, 3], |
| 545 'bool': true, |
| 546 'string': 'foo' |
| 547 }; |
| 548 o["y"] = { |
| 549 'list': [1, 2, 3], |
| 550 'bool': true, |
| 551 'string': 'foo' |
| 552 }; |
634 return o; | 553 return o; |
635 } | 554 } |
636 | 555 |
637 checkUnnamed1397(core.Map<core.String, core.Object> o) { | 556 checkUnnamed1393(core.Map<core.String, core.Object> o) { |
638 unittest.expect(o, unittest.hasLength(2)); | 557 unittest.expect(o, unittest.hasLength(2)); |
639 var casted1 = (o["x"]) as core.Map; unittest.expect(casted1, unittest.hasLengt
h(3)); unittest.expect(casted1["list"], unittest.equals([1, 2, 3])); unittest.ex
pect(casted1["bool"], unittest.equals(true)); unittest.expect(casted1["string"],
unittest.equals('foo')); | 558 var casted1 = (o["x"]) as core.Map; |
640 var casted2 = (o["y"]) as core.Map; unittest.expect(casted2, unittest.hasLengt
h(3)); unittest.expect(casted2["list"], unittest.equals([1, 2, 3])); unittest.ex
pect(casted2["bool"], unittest.equals(true)); unittest.expect(casted2["string"],
unittest.equals('foo')); | 559 unittest.expect(casted1, unittest.hasLength(3)); |
| 560 unittest.expect(casted1["list"], unittest.equals([1, 2, 3])); |
| 561 unittest.expect(casted1["bool"], unittest.equals(true)); |
| 562 unittest.expect(casted1["string"], unittest.equals('foo')); |
| 563 var casted2 = (o["y"]) as core.Map; |
| 564 unittest.expect(casted2, unittest.hasLength(3)); |
| 565 unittest.expect(casted2["list"], unittest.equals([1, 2, 3])); |
| 566 unittest.expect(casted2["bool"], unittest.equals(true)); |
| 567 unittest.expect(casted2["string"], unittest.equals('foo')); |
641 } | 568 } |
642 | 569 |
643 core.int buildCounterLocation = 0; | 570 core.int buildCounterLocation = 0; |
644 buildLocation() { | 571 buildLocation() { |
645 var o = new api.Location(); | 572 var o = new api.Location(); |
646 buildCounterLocation++; | 573 buildCounterLocation++; |
647 if (buildCounterLocation < 3) { | 574 if (buildCounterLocation < 3) { |
648 o.labels = buildUnnamed1396(); | 575 o.labels = buildUnnamed1392(); |
649 o.locationId = "foo"; | 576 o.locationId = "foo"; |
650 o.metadata = buildUnnamed1397(); | 577 o.metadata = buildUnnamed1393(); |
651 o.name = "foo"; | 578 o.name = "foo"; |
652 } | 579 } |
653 buildCounterLocation--; | 580 buildCounterLocation--; |
654 return o; | 581 return o; |
655 } | 582 } |
656 | 583 |
657 checkLocation(api.Location o) { | 584 checkLocation(api.Location o) { |
658 buildCounterLocation++; | 585 buildCounterLocation++; |
659 if (buildCounterLocation < 3) { | 586 if (buildCounterLocation < 3) { |
660 checkUnnamed1396(o.labels); | 587 checkUnnamed1392(o.labels); |
661 unittest.expect(o.locationId, unittest.equals('foo')); | 588 unittest.expect(o.locationId, unittest.equals('foo')); |
662 checkUnnamed1397(o.metadata); | 589 checkUnnamed1393(o.metadata); |
663 unittest.expect(o.name, unittest.equals('foo')); | 590 unittest.expect(o.name, unittest.equals('foo')); |
664 } | 591 } |
665 buildCounterLocation--; | 592 buildCounterLocation--; |
666 } | 593 } |
667 | 594 |
668 core.int buildCounterLogConfig = 0; | 595 buildUnnamed1394() { |
669 buildLogConfig() { | |
670 var o = new api.LogConfig(); | |
671 buildCounterLogConfig++; | |
672 if (buildCounterLogConfig < 3) { | |
673 o.cloudAudit = buildCloudAuditOptions(); | |
674 o.counter = buildCounterOptions(); | |
675 o.dataAccess = buildDataAccessOptions(); | |
676 } | |
677 buildCounterLogConfig--; | |
678 return o; | |
679 } | |
680 | |
681 checkLogConfig(api.LogConfig o) { | |
682 buildCounterLogConfig++; | |
683 if (buildCounterLogConfig < 3) { | |
684 checkCloudAuditOptions(o.cloudAudit); | |
685 checkCounterOptions(o.counter); | |
686 checkDataAccessOptions(o.dataAccess); | |
687 } | |
688 buildCounterLogConfig--; | |
689 } | |
690 | |
691 buildUnnamed1398() { | |
692 var o = new core.List<api.AuditConfig>(); | 596 var o = new core.List<api.AuditConfig>(); |
693 o.add(buildAuditConfig()); | 597 o.add(buildAuditConfig()); |
694 o.add(buildAuditConfig()); | 598 o.add(buildAuditConfig()); |
695 return o; | 599 return o; |
696 } | 600 } |
697 | 601 |
698 checkUnnamed1398(core.List<api.AuditConfig> o) { | 602 checkUnnamed1394(core.List<api.AuditConfig> o) { |
699 unittest.expect(o, unittest.hasLength(2)); | 603 unittest.expect(o, unittest.hasLength(2)); |
700 checkAuditConfig(o[0]); | 604 checkAuditConfig(o[0]); |
701 checkAuditConfig(o[1]); | 605 checkAuditConfig(o[1]); |
702 } | 606 } |
703 | 607 |
704 buildUnnamed1399() { | 608 buildUnnamed1395() { |
705 var o = new core.List<api.Binding>(); | 609 var o = new core.List<api.Binding>(); |
706 o.add(buildBinding()); | 610 o.add(buildBinding()); |
707 o.add(buildBinding()); | 611 o.add(buildBinding()); |
708 return o; | 612 return o; |
709 } | 613 } |
710 | 614 |
711 checkUnnamed1399(core.List<api.Binding> o) { | 615 checkUnnamed1395(core.List<api.Binding> o) { |
712 unittest.expect(o, unittest.hasLength(2)); | 616 unittest.expect(o, unittest.hasLength(2)); |
713 checkBinding(o[0]); | 617 checkBinding(o[0]); |
714 checkBinding(o[1]); | 618 checkBinding(o[1]); |
715 } | 619 } |
716 | 620 |
717 buildUnnamed1400() { | |
718 var o = new core.List<api.Rule>(); | |
719 o.add(buildRule()); | |
720 o.add(buildRule()); | |
721 return o; | |
722 } | |
723 | |
724 checkUnnamed1400(core.List<api.Rule> o) { | |
725 unittest.expect(o, unittest.hasLength(2)); | |
726 checkRule(o[0]); | |
727 checkRule(o[1]); | |
728 } | |
729 | |
730 core.int buildCounterPolicy = 0; | 621 core.int buildCounterPolicy = 0; |
731 buildPolicy() { | 622 buildPolicy() { |
732 var o = new api.Policy(); | 623 var o = new api.Policy(); |
733 buildCounterPolicy++; | 624 buildCounterPolicy++; |
734 if (buildCounterPolicy < 3) { | 625 if (buildCounterPolicy < 3) { |
735 o.auditConfigs = buildUnnamed1398(); | 626 o.auditConfigs = buildUnnamed1394(); |
736 o.bindings = buildUnnamed1399(); | 627 o.bindings = buildUnnamed1395(); |
737 o.etag = "foo"; | 628 o.etag = "foo"; |
738 o.iamOwned = true; | 629 o.iamOwned = true; |
739 o.rules = buildUnnamed1400(); | |
740 o.version = 42; | 630 o.version = 42; |
741 } | 631 } |
742 buildCounterPolicy--; | 632 buildCounterPolicy--; |
743 return o; | 633 return o; |
744 } | 634 } |
745 | 635 |
746 checkPolicy(api.Policy o) { | 636 checkPolicy(api.Policy o) { |
747 buildCounterPolicy++; | 637 buildCounterPolicy++; |
748 if (buildCounterPolicy < 3) { | 638 if (buildCounterPolicy < 3) { |
749 checkUnnamed1398(o.auditConfigs); | 639 checkUnnamed1394(o.auditConfigs); |
750 checkUnnamed1399(o.bindings); | 640 checkUnnamed1395(o.bindings); |
751 unittest.expect(o.etag, unittest.equals('foo')); | 641 unittest.expect(o.etag, unittest.equals('foo')); |
752 unittest.expect(o.iamOwned, unittest.isTrue); | 642 unittest.expect(o.iamOwned, unittest.isTrue); |
753 checkUnnamed1400(o.rules); | |
754 unittest.expect(o.version, unittest.equals(42)); | 643 unittest.expect(o.version, unittest.equals(42)); |
755 } | 644 } |
756 buildCounterPolicy--; | 645 buildCounterPolicy--; |
757 } | 646 } |
758 | 647 |
759 core.int buildCounterRestoreCryptoKeyVersionRequest = 0; | 648 core.int buildCounterRestoreCryptoKeyVersionRequest = 0; |
760 buildRestoreCryptoKeyVersionRequest() { | 649 buildRestoreCryptoKeyVersionRequest() { |
761 var o = new api.RestoreCryptoKeyVersionRequest(); | 650 var o = new api.RestoreCryptoKeyVersionRequest(); |
762 buildCounterRestoreCryptoKeyVersionRequest++; | 651 buildCounterRestoreCryptoKeyVersionRequest++; |
763 if (buildCounterRestoreCryptoKeyVersionRequest < 3) { | 652 if (buildCounterRestoreCryptoKeyVersionRequest < 3) {} |
764 } | |
765 buildCounterRestoreCryptoKeyVersionRequest--; | 653 buildCounterRestoreCryptoKeyVersionRequest--; |
766 return o; | 654 return o; |
767 } | 655 } |
768 | 656 |
769 checkRestoreCryptoKeyVersionRequest(api.RestoreCryptoKeyVersionRequest o) { | 657 checkRestoreCryptoKeyVersionRequest(api.RestoreCryptoKeyVersionRequest o) { |
770 buildCounterRestoreCryptoKeyVersionRequest++; | 658 buildCounterRestoreCryptoKeyVersionRequest++; |
771 if (buildCounterRestoreCryptoKeyVersionRequest < 3) { | 659 if (buildCounterRestoreCryptoKeyVersionRequest < 3) {} |
772 } | |
773 buildCounterRestoreCryptoKeyVersionRequest--; | 660 buildCounterRestoreCryptoKeyVersionRequest--; |
774 } | 661 } |
775 | 662 |
776 buildUnnamed1401() { | |
777 var o = new core.List<api.Condition>(); | |
778 o.add(buildCondition()); | |
779 o.add(buildCondition()); | |
780 return o; | |
781 } | |
782 | |
783 checkUnnamed1401(core.List<api.Condition> o) { | |
784 unittest.expect(o, unittest.hasLength(2)); | |
785 checkCondition(o[0]); | |
786 checkCondition(o[1]); | |
787 } | |
788 | |
789 buildUnnamed1402() { | |
790 var o = new core.List<core.String>(); | |
791 o.add("foo"); | |
792 o.add("foo"); | |
793 return o; | |
794 } | |
795 | |
796 checkUnnamed1402(core.List<core.String> o) { | |
797 unittest.expect(o, unittest.hasLength(2)); | |
798 unittest.expect(o[0], unittest.equals('foo')); | |
799 unittest.expect(o[1], unittest.equals('foo')); | |
800 } | |
801 | |
802 buildUnnamed1403() { | |
803 var o = new core.List<api.LogConfig>(); | |
804 o.add(buildLogConfig()); | |
805 o.add(buildLogConfig()); | |
806 return o; | |
807 } | |
808 | |
809 checkUnnamed1403(core.List<api.LogConfig> o) { | |
810 unittest.expect(o, unittest.hasLength(2)); | |
811 checkLogConfig(o[0]); | |
812 checkLogConfig(o[1]); | |
813 } | |
814 | |
815 buildUnnamed1404() { | |
816 var o = new core.List<core.String>(); | |
817 o.add("foo"); | |
818 o.add("foo"); | |
819 return o; | |
820 } | |
821 | |
822 checkUnnamed1404(core.List<core.String> o) { | |
823 unittest.expect(o, unittest.hasLength(2)); | |
824 unittest.expect(o[0], unittest.equals('foo')); | |
825 unittest.expect(o[1], unittest.equals('foo')); | |
826 } | |
827 | |
828 buildUnnamed1405() { | |
829 var o = new core.List<core.String>(); | |
830 o.add("foo"); | |
831 o.add("foo"); | |
832 return o; | |
833 } | |
834 | |
835 checkUnnamed1405(core.List<core.String> o) { | |
836 unittest.expect(o, unittest.hasLength(2)); | |
837 unittest.expect(o[0], unittest.equals('foo')); | |
838 unittest.expect(o[1], unittest.equals('foo')); | |
839 } | |
840 | |
841 core.int buildCounterRule = 0; | |
842 buildRule() { | |
843 var o = new api.Rule(); | |
844 buildCounterRule++; | |
845 if (buildCounterRule < 3) { | |
846 o.action = "foo"; | |
847 o.conditions = buildUnnamed1401(); | |
848 o.description = "foo"; | |
849 o.in_ = buildUnnamed1402(); | |
850 o.logConfig = buildUnnamed1403(); | |
851 o.notIn = buildUnnamed1404(); | |
852 o.permissions = buildUnnamed1405(); | |
853 } | |
854 buildCounterRule--; | |
855 return o; | |
856 } | |
857 | |
858 checkRule(api.Rule o) { | |
859 buildCounterRule++; | |
860 if (buildCounterRule < 3) { | |
861 unittest.expect(o.action, unittest.equals('foo')); | |
862 checkUnnamed1401(o.conditions); | |
863 unittest.expect(o.description, unittest.equals('foo')); | |
864 checkUnnamed1402(o.in_); | |
865 checkUnnamed1403(o.logConfig); | |
866 checkUnnamed1404(o.notIn); | |
867 checkUnnamed1405(o.permissions); | |
868 } | |
869 buildCounterRule--; | |
870 } | |
871 | |
872 core.int buildCounterSetIamPolicyRequest = 0; | 663 core.int buildCounterSetIamPolicyRequest = 0; |
873 buildSetIamPolicyRequest() { | 664 buildSetIamPolicyRequest() { |
874 var o = new api.SetIamPolicyRequest(); | 665 var o = new api.SetIamPolicyRequest(); |
875 buildCounterSetIamPolicyRequest++; | 666 buildCounterSetIamPolicyRequest++; |
876 if (buildCounterSetIamPolicyRequest < 3) { | 667 if (buildCounterSetIamPolicyRequest < 3) { |
877 o.policy = buildPolicy(); | 668 o.policy = buildPolicy(); |
878 o.updateMask = "foo"; | 669 o.updateMask = "foo"; |
879 } | 670 } |
880 buildCounterSetIamPolicyRequest--; | 671 buildCounterSetIamPolicyRequest--; |
881 return o; | 672 return o; |
882 } | 673 } |
883 | 674 |
884 checkSetIamPolicyRequest(api.SetIamPolicyRequest o) { | 675 checkSetIamPolicyRequest(api.SetIamPolicyRequest o) { |
885 buildCounterSetIamPolicyRequest++; | 676 buildCounterSetIamPolicyRequest++; |
886 if (buildCounterSetIamPolicyRequest < 3) { | 677 if (buildCounterSetIamPolicyRequest < 3) { |
887 checkPolicy(o.policy); | 678 checkPolicy(o.policy); |
888 unittest.expect(o.updateMask, unittest.equals('foo')); | 679 unittest.expect(o.updateMask, unittest.equals('foo')); |
889 } | 680 } |
890 buildCounterSetIamPolicyRequest--; | 681 buildCounterSetIamPolicyRequest--; |
891 } | 682 } |
892 | 683 |
893 buildUnnamed1406() { | 684 buildUnnamed1396() { |
894 var o = new core.List<core.String>(); | 685 var o = new core.List<core.String>(); |
895 o.add("foo"); | 686 o.add("foo"); |
896 o.add("foo"); | 687 o.add("foo"); |
897 return o; | 688 return o; |
898 } | 689 } |
899 | 690 |
900 checkUnnamed1406(core.List<core.String> o) { | 691 checkUnnamed1396(core.List<core.String> o) { |
901 unittest.expect(o, unittest.hasLength(2)); | 692 unittest.expect(o, unittest.hasLength(2)); |
902 unittest.expect(o[0], unittest.equals('foo')); | 693 unittest.expect(o[0], unittest.equals('foo')); |
903 unittest.expect(o[1], unittest.equals('foo')); | 694 unittest.expect(o[1], unittest.equals('foo')); |
904 } | 695 } |
905 | 696 |
906 core.int buildCounterTestIamPermissionsRequest = 0; | 697 core.int buildCounterTestIamPermissionsRequest = 0; |
907 buildTestIamPermissionsRequest() { | 698 buildTestIamPermissionsRequest() { |
908 var o = new api.TestIamPermissionsRequest(); | 699 var o = new api.TestIamPermissionsRequest(); |
909 buildCounterTestIamPermissionsRequest++; | 700 buildCounterTestIamPermissionsRequest++; |
910 if (buildCounterTestIamPermissionsRequest < 3) { | 701 if (buildCounterTestIamPermissionsRequest < 3) { |
911 o.permissions = buildUnnamed1406(); | 702 o.permissions = buildUnnamed1396(); |
912 } | 703 } |
913 buildCounterTestIamPermissionsRequest--; | 704 buildCounterTestIamPermissionsRequest--; |
914 return o; | 705 return o; |
915 } | 706 } |
916 | 707 |
917 checkTestIamPermissionsRequest(api.TestIamPermissionsRequest o) { | 708 checkTestIamPermissionsRequest(api.TestIamPermissionsRequest o) { |
918 buildCounterTestIamPermissionsRequest++; | 709 buildCounterTestIamPermissionsRequest++; |
919 if (buildCounterTestIamPermissionsRequest < 3) { | 710 if (buildCounterTestIamPermissionsRequest < 3) { |
920 checkUnnamed1406(o.permissions); | 711 checkUnnamed1396(o.permissions); |
921 } | 712 } |
922 buildCounterTestIamPermissionsRequest--; | 713 buildCounterTestIamPermissionsRequest--; |
923 } | 714 } |
924 | 715 |
925 buildUnnamed1407() { | 716 buildUnnamed1397() { |
926 var o = new core.List<core.String>(); | 717 var o = new core.List<core.String>(); |
927 o.add("foo"); | 718 o.add("foo"); |
928 o.add("foo"); | 719 o.add("foo"); |
929 return o; | 720 return o; |
930 } | 721 } |
931 | 722 |
932 checkUnnamed1407(core.List<core.String> o) { | 723 checkUnnamed1397(core.List<core.String> o) { |
933 unittest.expect(o, unittest.hasLength(2)); | 724 unittest.expect(o, unittest.hasLength(2)); |
934 unittest.expect(o[0], unittest.equals('foo')); | 725 unittest.expect(o[0], unittest.equals('foo')); |
935 unittest.expect(o[1], unittest.equals('foo')); | 726 unittest.expect(o[1], unittest.equals('foo')); |
936 } | 727 } |
937 | 728 |
938 core.int buildCounterTestIamPermissionsResponse = 0; | 729 core.int buildCounterTestIamPermissionsResponse = 0; |
939 buildTestIamPermissionsResponse() { | 730 buildTestIamPermissionsResponse() { |
940 var o = new api.TestIamPermissionsResponse(); | 731 var o = new api.TestIamPermissionsResponse(); |
941 buildCounterTestIamPermissionsResponse++; | 732 buildCounterTestIamPermissionsResponse++; |
942 if (buildCounterTestIamPermissionsResponse < 3) { | 733 if (buildCounterTestIamPermissionsResponse < 3) { |
943 o.permissions = buildUnnamed1407(); | 734 o.permissions = buildUnnamed1397(); |
944 } | 735 } |
945 buildCounterTestIamPermissionsResponse--; | 736 buildCounterTestIamPermissionsResponse--; |
946 return o; | 737 return o; |
947 } | 738 } |
948 | 739 |
949 checkTestIamPermissionsResponse(api.TestIamPermissionsResponse o) { | 740 checkTestIamPermissionsResponse(api.TestIamPermissionsResponse o) { |
950 buildCounterTestIamPermissionsResponse++; | 741 buildCounterTestIamPermissionsResponse++; |
951 if (buildCounterTestIamPermissionsResponse < 3) { | 742 if (buildCounterTestIamPermissionsResponse < 3) { |
952 checkUnnamed1407(o.permissions); | 743 checkUnnamed1397(o.permissions); |
953 } | 744 } |
954 buildCounterTestIamPermissionsResponse--; | 745 buildCounterTestIamPermissionsResponse--; |
955 } | 746 } |
956 | 747 |
957 core.int buildCounterUpdateCryptoKeyPrimaryVersionRequest = 0; | 748 core.int buildCounterUpdateCryptoKeyPrimaryVersionRequest = 0; |
958 buildUpdateCryptoKeyPrimaryVersionRequest() { | 749 buildUpdateCryptoKeyPrimaryVersionRequest() { |
959 var o = new api.UpdateCryptoKeyPrimaryVersionRequest(); | 750 var o = new api.UpdateCryptoKeyPrimaryVersionRequest(); |
960 buildCounterUpdateCryptoKeyPrimaryVersionRequest++; | 751 buildCounterUpdateCryptoKeyPrimaryVersionRequest++; |
961 if (buildCounterUpdateCryptoKeyPrimaryVersionRequest < 3) { | 752 if (buildCounterUpdateCryptoKeyPrimaryVersionRequest < 3) { |
962 o.cryptoKeyVersionId = "foo"; | 753 o.cryptoKeyVersionId = "foo"; |
963 } | 754 } |
964 buildCounterUpdateCryptoKeyPrimaryVersionRequest--; | 755 buildCounterUpdateCryptoKeyPrimaryVersionRequest--; |
965 return o; | 756 return o; |
966 } | 757 } |
967 | 758 |
968 checkUpdateCryptoKeyPrimaryVersionRequest(api.UpdateCryptoKeyPrimaryVersionReque
st o) { | 759 checkUpdateCryptoKeyPrimaryVersionRequest( |
| 760 api.UpdateCryptoKeyPrimaryVersionRequest o) { |
969 buildCounterUpdateCryptoKeyPrimaryVersionRequest++; | 761 buildCounterUpdateCryptoKeyPrimaryVersionRequest++; |
970 if (buildCounterUpdateCryptoKeyPrimaryVersionRequest < 3) { | 762 if (buildCounterUpdateCryptoKeyPrimaryVersionRequest < 3) { |
971 unittest.expect(o.cryptoKeyVersionId, unittest.equals('foo')); | 763 unittest.expect(o.cryptoKeyVersionId, unittest.equals('foo')); |
972 } | 764 } |
973 buildCounterUpdateCryptoKeyPrimaryVersionRequest--; | 765 buildCounterUpdateCryptoKeyPrimaryVersionRequest--; |
974 } | 766 } |
975 | 767 |
976 | |
977 main() { | 768 main() { |
978 unittest.group("obj-schema-AuditConfig", () { | 769 unittest.group("obj-schema-AuditConfig", () { |
979 unittest.test("to-json--from-json", () { | 770 unittest.test("to-json--from-json", () { |
980 var o = buildAuditConfig(); | 771 var o = buildAuditConfig(); |
981 var od = new api.AuditConfig.fromJson(o.toJson()); | 772 var od = new api.AuditConfig.fromJson(o.toJson()); |
982 checkAuditConfig(od); | 773 checkAuditConfig(od); |
983 }); | 774 }); |
984 }); | 775 }); |
985 | 776 |
986 | |
987 unittest.group("obj-schema-AuditLogConfig", () { | 777 unittest.group("obj-schema-AuditLogConfig", () { |
988 unittest.test("to-json--from-json", () { | 778 unittest.test("to-json--from-json", () { |
989 var o = buildAuditLogConfig(); | 779 var o = buildAuditLogConfig(); |
990 var od = new api.AuditLogConfig.fromJson(o.toJson()); | 780 var od = new api.AuditLogConfig.fromJson(o.toJson()); |
991 checkAuditLogConfig(od); | 781 checkAuditLogConfig(od); |
992 }); | 782 }); |
993 }); | 783 }); |
994 | 784 |
995 | |
996 unittest.group("obj-schema-Binding", () { | 785 unittest.group("obj-schema-Binding", () { |
997 unittest.test("to-json--from-json", () { | 786 unittest.test("to-json--from-json", () { |
998 var o = buildBinding(); | 787 var o = buildBinding(); |
999 var od = new api.Binding.fromJson(o.toJson()); | 788 var od = new api.Binding.fromJson(o.toJson()); |
1000 checkBinding(od); | 789 checkBinding(od); |
1001 }); | 790 }); |
1002 }); | 791 }); |
1003 | 792 |
1004 | |
1005 unittest.group("obj-schema-CloudAuditOptions", () { | |
1006 unittest.test("to-json--from-json", () { | |
1007 var o = buildCloudAuditOptions(); | |
1008 var od = new api.CloudAuditOptions.fromJson(o.toJson()); | |
1009 checkCloudAuditOptions(od); | |
1010 }); | |
1011 }); | |
1012 | |
1013 | |
1014 unittest.group("obj-schema-Condition", () { | |
1015 unittest.test("to-json--from-json", () { | |
1016 var o = buildCondition(); | |
1017 var od = new api.Condition.fromJson(o.toJson()); | |
1018 checkCondition(od); | |
1019 }); | |
1020 }); | |
1021 | |
1022 | |
1023 unittest.group("obj-schema-CounterOptions", () { | |
1024 unittest.test("to-json--from-json", () { | |
1025 var o = buildCounterOptions(); | |
1026 var od = new api.CounterOptions.fromJson(o.toJson()); | |
1027 checkCounterOptions(od); | |
1028 }); | |
1029 }); | |
1030 | |
1031 | |
1032 unittest.group("obj-schema-CryptoKey", () { | 793 unittest.group("obj-schema-CryptoKey", () { |
1033 unittest.test("to-json--from-json", () { | 794 unittest.test("to-json--from-json", () { |
1034 var o = buildCryptoKey(); | 795 var o = buildCryptoKey(); |
1035 var od = new api.CryptoKey.fromJson(o.toJson()); | 796 var od = new api.CryptoKey.fromJson(o.toJson()); |
1036 checkCryptoKey(od); | 797 checkCryptoKey(od); |
1037 }); | 798 }); |
1038 }); | 799 }); |
1039 | 800 |
1040 | |
1041 unittest.group("obj-schema-CryptoKeyVersion", () { | 801 unittest.group("obj-schema-CryptoKeyVersion", () { |
1042 unittest.test("to-json--from-json", () { | 802 unittest.test("to-json--from-json", () { |
1043 var o = buildCryptoKeyVersion(); | 803 var o = buildCryptoKeyVersion(); |
1044 var od = new api.CryptoKeyVersion.fromJson(o.toJson()); | 804 var od = new api.CryptoKeyVersion.fromJson(o.toJson()); |
1045 checkCryptoKeyVersion(od); | 805 checkCryptoKeyVersion(od); |
1046 }); | 806 }); |
1047 }); | 807 }); |
1048 | 808 |
1049 | |
1050 unittest.group("obj-schema-DataAccessOptions", () { | |
1051 unittest.test("to-json--from-json", () { | |
1052 var o = buildDataAccessOptions(); | |
1053 var od = new api.DataAccessOptions.fromJson(o.toJson()); | |
1054 checkDataAccessOptions(od); | |
1055 }); | |
1056 }); | |
1057 | |
1058 | |
1059 unittest.group("obj-schema-DecryptRequest", () { | 809 unittest.group("obj-schema-DecryptRequest", () { |
1060 unittest.test("to-json--from-json", () { | 810 unittest.test("to-json--from-json", () { |
1061 var o = buildDecryptRequest(); | 811 var o = buildDecryptRequest(); |
1062 var od = new api.DecryptRequest.fromJson(o.toJson()); | 812 var od = new api.DecryptRequest.fromJson(o.toJson()); |
1063 checkDecryptRequest(od); | 813 checkDecryptRequest(od); |
1064 }); | 814 }); |
1065 }); | 815 }); |
1066 | 816 |
1067 | |
1068 unittest.group("obj-schema-DecryptResponse", () { | 817 unittest.group("obj-schema-DecryptResponse", () { |
1069 unittest.test("to-json--from-json", () { | 818 unittest.test("to-json--from-json", () { |
1070 var o = buildDecryptResponse(); | 819 var o = buildDecryptResponse(); |
1071 var od = new api.DecryptResponse.fromJson(o.toJson()); | 820 var od = new api.DecryptResponse.fromJson(o.toJson()); |
1072 checkDecryptResponse(od); | 821 checkDecryptResponse(od); |
1073 }); | 822 }); |
1074 }); | 823 }); |
1075 | 824 |
1076 | |
1077 unittest.group("obj-schema-DestroyCryptoKeyVersionRequest", () { | 825 unittest.group("obj-schema-DestroyCryptoKeyVersionRequest", () { |
1078 unittest.test("to-json--from-json", () { | 826 unittest.test("to-json--from-json", () { |
1079 var o = buildDestroyCryptoKeyVersionRequest(); | 827 var o = buildDestroyCryptoKeyVersionRequest(); |
1080 var od = new api.DestroyCryptoKeyVersionRequest.fromJson(o.toJson()); | 828 var od = new api.DestroyCryptoKeyVersionRequest.fromJson(o.toJson()); |
1081 checkDestroyCryptoKeyVersionRequest(od); | 829 checkDestroyCryptoKeyVersionRequest(od); |
1082 }); | 830 }); |
1083 }); | 831 }); |
1084 | 832 |
1085 | |
1086 unittest.group("obj-schema-EncryptRequest", () { | 833 unittest.group("obj-schema-EncryptRequest", () { |
1087 unittest.test("to-json--from-json", () { | 834 unittest.test("to-json--from-json", () { |
1088 var o = buildEncryptRequest(); | 835 var o = buildEncryptRequest(); |
1089 var od = new api.EncryptRequest.fromJson(o.toJson()); | 836 var od = new api.EncryptRequest.fromJson(o.toJson()); |
1090 checkEncryptRequest(od); | 837 checkEncryptRequest(od); |
1091 }); | 838 }); |
1092 }); | 839 }); |
1093 | 840 |
1094 | |
1095 unittest.group("obj-schema-EncryptResponse", () { | 841 unittest.group("obj-schema-EncryptResponse", () { |
1096 unittest.test("to-json--from-json", () { | 842 unittest.test("to-json--from-json", () { |
1097 var o = buildEncryptResponse(); | 843 var o = buildEncryptResponse(); |
1098 var od = new api.EncryptResponse.fromJson(o.toJson()); | 844 var od = new api.EncryptResponse.fromJson(o.toJson()); |
1099 checkEncryptResponse(od); | 845 checkEncryptResponse(od); |
1100 }); | 846 }); |
1101 }); | 847 }); |
1102 | 848 |
1103 | |
1104 unittest.group("obj-schema-Expr", () { | 849 unittest.group("obj-schema-Expr", () { |
1105 unittest.test("to-json--from-json", () { | 850 unittest.test("to-json--from-json", () { |
1106 var o = buildExpr(); | 851 var o = buildExpr(); |
1107 var od = new api.Expr.fromJson(o.toJson()); | 852 var od = new api.Expr.fromJson(o.toJson()); |
1108 checkExpr(od); | 853 checkExpr(od); |
1109 }); | 854 }); |
1110 }); | 855 }); |
1111 | 856 |
1112 | |
1113 unittest.group("obj-schema-KeyRing", () { | 857 unittest.group("obj-schema-KeyRing", () { |
1114 unittest.test("to-json--from-json", () { | 858 unittest.test("to-json--from-json", () { |
1115 var o = buildKeyRing(); | 859 var o = buildKeyRing(); |
1116 var od = new api.KeyRing.fromJson(o.toJson()); | 860 var od = new api.KeyRing.fromJson(o.toJson()); |
1117 checkKeyRing(od); | 861 checkKeyRing(od); |
1118 }); | 862 }); |
1119 }); | 863 }); |
1120 | 864 |
1121 | |
1122 unittest.group("obj-schema-ListCryptoKeyVersionsResponse", () { | 865 unittest.group("obj-schema-ListCryptoKeyVersionsResponse", () { |
1123 unittest.test("to-json--from-json", () { | 866 unittest.test("to-json--from-json", () { |
1124 var o = buildListCryptoKeyVersionsResponse(); | 867 var o = buildListCryptoKeyVersionsResponse(); |
1125 var od = new api.ListCryptoKeyVersionsResponse.fromJson(o.toJson()); | 868 var od = new api.ListCryptoKeyVersionsResponse.fromJson(o.toJson()); |
1126 checkListCryptoKeyVersionsResponse(od); | 869 checkListCryptoKeyVersionsResponse(od); |
1127 }); | 870 }); |
1128 }); | 871 }); |
1129 | 872 |
1130 | |
1131 unittest.group("obj-schema-ListCryptoKeysResponse", () { | 873 unittest.group("obj-schema-ListCryptoKeysResponse", () { |
1132 unittest.test("to-json--from-json", () { | 874 unittest.test("to-json--from-json", () { |
1133 var o = buildListCryptoKeysResponse(); | 875 var o = buildListCryptoKeysResponse(); |
1134 var od = new api.ListCryptoKeysResponse.fromJson(o.toJson()); | 876 var od = new api.ListCryptoKeysResponse.fromJson(o.toJson()); |
1135 checkListCryptoKeysResponse(od); | 877 checkListCryptoKeysResponse(od); |
1136 }); | 878 }); |
1137 }); | 879 }); |
1138 | 880 |
1139 | |
1140 unittest.group("obj-schema-ListKeyRingsResponse", () { | 881 unittest.group("obj-schema-ListKeyRingsResponse", () { |
1141 unittest.test("to-json--from-json", () { | 882 unittest.test("to-json--from-json", () { |
1142 var o = buildListKeyRingsResponse(); | 883 var o = buildListKeyRingsResponse(); |
1143 var od = new api.ListKeyRingsResponse.fromJson(o.toJson()); | 884 var od = new api.ListKeyRingsResponse.fromJson(o.toJson()); |
1144 checkListKeyRingsResponse(od); | 885 checkListKeyRingsResponse(od); |
1145 }); | 886 }); |
1146 }); | 887 }); |
1147 | 888 |
1148 | |
1149 unittest.group("obj-schema-ListLocationsResponse", () { | 889 unittest.group("obj-schema-ListLocationsResponse", () { |
1150 unittest.test("to-json--from-json", () { | 890 unittest.test("to-json--from-json", () { |
1151 var o = buildListLocationsResponse(); | 891 var o = buildListLocationsResponse(); |
1152 var od = new api.ListLocationsResponse.fromJson(o.toJson()); | 892 var od = new api.ListLocationsResponse.fromJson(o.toJson()); |
1153 checkListLocationsResponse(od); | 893 checkListLocationsResponse(od); |
1154 }); | 894 }); |
1155 }); | 895 }); |
1156 | 896 |
1157 | |
1158 unittest.group("obj-schema-Location", () { | 897 unittest.group("obj-schema-Location", () { |
1159 unittest.test("to-json--from-json", () { | 898 unittest.test("to-json--from-json", () { |
1160 var o = buildLocation(); | 899 var o = buildLocation(); |
1161 var od = new api.Location.fromJson(o.toJson()); | 900 var od = new api.Location.fromJson(o.toJson()); |
1162 checkLocation(od); | 901 checkLocation(od); |
1163 }); | 902 }); |
1164 }); | 903 }); |
1165 | 904 |
1166 | |
1167 unittest.group("obj-schema-LogConfig", () { | |
1168 unittest.test("to-json--from-json", () { | |
1169 var o = buildLogConfig(); | |
1170 var od = new api.LogConfig.fromJson(o.toJson()); | |
1171 checkLogConfig(od); | |
1172 }); | |
1173 }); | |
1174 | |
1175 | |
1176 unittest.group("obj-schema-Policy", () { | 905 unittest.group("obj-schema-Policy", () { |
1177 unittest.test("to-json--from-json", () { | 906 unittest.test("to-json--from-json", () { |
1178 var o = buildPolicy(); | 907 var o = buildPolicy(); |
1179 var od = new api.Policy.fromJson(o.toJson()); | 908 var od = new api.Policy.fromJson(o.toJson()); |
1180 checkPolicy(od); | 909 checkPolicy(od); |
1181 }); | 910 }); |
1182 }); | 911 }); |
1183 | 912 |
1184 | |
1185 unittest.group("obj-schema-RestoreCryptoKeyVersionRequest", () { | 913 unittest.group("obj-schema-RestoreCryptoKeyVersionRequest", () { |
1186 unittest.test("to-json--from-json", () { | 914 unittest.test("to-json--from-json", () { |
1187 var o = buildRestoreCryptoKeyVersionRequest(); | 915 var o = buildRestoreCryptoKeyVersionRequest(); |
1188 var od = new api.RestoreCryptoKeyVersionRequest.fromJson(o.toJson()); | 916 var od = new api.RestoreCryptoKeyVersionRequest.fromJson(o.toJson()); |
1189 checkRestoreCryptoKeyVersionRequest(od); | 917 checkRestoreCryptoKeyVersionRequest(od); |
1190 }); | 918 }); |
1191 }); | 919 }); |
1192 | 920 |
1193 | |
1194 unittest.group("obj-schema-Rule", () { | |
1195 unittest.test("to-json--from-json", () { | |
1196 var o = buildRule(); | |
1197 var od = new api.Rule.fromJson(o.toJson()); | |
1198 checkRule(od); | |
1199 }); | |
1200 }); | |
1201 | |
1202 | |
1203 unittest.group("obj-schema-SetIamPolicyRequest", () { | 921 unittest.group("obj-schema-SetIamPolicyRequest", () { |
1204 unittest.test("to-json--from-json", () { | 922 unittest.test("to-json--from-json", () { |
1205 var o = buildSetIamPolicyRequest(); | 923 var o = buildSetIamPolicyRequest(); |
1206 var od = new api.SetIamPolicyRequest.fromJson(o.toJson()); | 924 var od = new api.SetIamPolicyRequest.fromJson(o.toJson()); |
1207 checkSetIamPolicyRequest(od); | 925 checkSetIamPolicyRequest(od); |
1208 }); | 926 }); |
1209 }); | 927 }); |
1210 | 928 |
1211 | |
1212 unittest.group("obj-schema-TestIamPermissionsRequest", () { | 929 unittest.group("obj-schema-TestIamPermissionsRequest", () { |
1213 unittest.test("to-json--from-json", () { | 930 unittest.test("to-json--from-json", () { |
1214 var o = buildTestIamPermissionsRequest(); | 931 var o = buildTestIamPermissionsRequest(); |
1215 var od = new api.TestIamPermissionsRequest.fromJson(o.toJson()); | 932 var od = new api.TestIamPermissionsRequest.fromJson(o.toJson()); |
1216 checkTestIamPermissionsRequest(od); | 933 checkTestIamPermissionsRequest(od); |
1217 }); | 934 }); |
1218 }); | 935 }); |
1219 | 936 |
1220 | |
1221 unittest.group("obj-schema-TestIamPermissionsResponse", () { | 937 unittest.group("obj-schema-TestIamPermissionsResponse", () { |
1222 unittest.test("to-json--from-json", () { | 938 unittest.test("to-json--from-json", () { |
1223 var o = buildTestIamPermissionsResponse(); | 939 var o = buildTestIamPermissionsResponse(); |
1224 var od = new api.TestIamPermissionsResponse.fromJson(o.toJson()); | 940 var od = new api.TestIamPermissionsResponse.fromJson(o.toJson()); |
1225 checkTestIamPermissionsResponse(od); | 941 checkTestIamPermissionsResponse(od); |
1226 }); | 942 }); |
1227 }); | 943 }); |
1228 | 944 |
1229 | |
1230 unittest.group("obj-schema-UpdateCryptoKeyPrimaryVersionRequest", () { | 945 unittest.group("obj-schema-UpdateCryptoKeyPrimaryVersionRequest", () { |
1231 unittest.test("to-json--from-json", () { | 946 unittest.test("to-json--from-json", () { |
1232 var o = buildUpdateCryptoKeyPrimaryVersionRequest(); | 947 var o = buildUpdateCryptoKeyPrimaryVersionRequest(); |
1233 var od = new api.UpdateCryptoKeyPrimaryVersionRequest.fromJson(o.toJson())
; | 948 var od = |
| 949 new api.UpdateCryptoKeyPrimaryVersionRequest.fromJson(o.toJson()); |
1234 checkUpdateCryptoKeyPrimaryVersionRequest(od); | 950 checkUpdateCryptoKeyPrimaryVersionRequest(od); |
1235 }); | 951 }); |
1236 }); | 952 }); |
1237 | 953 |
1238 | |
1239 unittest.group("resource-ProjectsLocationsResourceApi", () { | 954 unittest.group("resource-ProjectsLocationsResourceApi", () { |
1240 unittest.test("method--get", () { | 955 unittest.test("method--get", () { |
1241 | |
1242 var mock = new HttpServerMock(); | 956 var mock = new HttpServerMock(); |
1243 api.ProjectsLocationsResourceApi res = new api.CloudkmsApi(mock).projects.
locations; | 957 api.ProjectsLocationsResourceApi res = |
| 958 new api.CloudkmsApi(mock).projects.locations; |
1244 var arg_name = "foo"; | 959 var arg_name = "foo"; |
1245 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 960 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
1246 var path = (req.url).path; | 961 var path = (req.url).path; |
1247 var pathOffset = 0; | 962 var pathOffset = 0; |
1248 var index; | 963 var index; |
1249 var subPart; | 964 var subPart; |
1250 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 965 unittest.expect( |
| 966 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
1251 pathOffset += 1; | 967 pathOffset += 1; |
1252 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); | 968 unittest.expect( |
| 969 path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/")); |
1253 pathOffset += 3; | 970 pathOffset += 3; |
1254 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 971 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
1255 | 972 |
1256 var query = (req.url).query; | 973 var query = (req.url).query; |
1257 var queryOffset = 0; | 974 var queryOffset = 0; |
1258 var queryMap = {}; | 975 var queryMap = {}; |
1259 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 976 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
1260 parseBool(n) { | 977 parseBool(n) { |
1261 if (n == "true") return true; | 978 if (n == "true") return true; |
1262 if (n == "false") return false; | 979 if (n == "false") return false; |
1263 if (n == null) return null; | 980 if (n == null) return null; |
1264 throw new core.ArgumentError("Invalid boolean: $n"); | 981 throw new core.ArgumentError("Invalid boolean: $n"); |
1265 } | 982 } |
| 983 |
1266 if (query.length > 0) { | 984 if (query.length > 0) { |
1267 for (var part in query.split("&")) { | 985 for (var part in query.split("&")) { |
1268 var keyvalue = part.split("="); | 986 var keyvalue = part.split("="); |
1269 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 987 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 988 core.Uri.decodeQueryComponent(keyvalue[1])); |
1270 } | 989 } |
1271 } | 990 } |
1272 | 991 |
1273 | |
1274 var h = { | 992 var h = { |
1275 "content-type" : "application/json; charset=utf-8", | 993 "content-type": "application/json; charset=utf-8", |
1276 }; | 994 }; |
1277 var resp = convert.JSON.encode(buildLocation()); | 995 var resp = convert.JSON.encode(buildLocation()); |
1278 return new async.Future.value(stringResponse(200, h, resp)); | 996 return new async.Future.value(stringResponse(200, h, resp)); |
1279 }), true); | 997 }), true); |
1280 res.get(arg_name).then(unittest.expectAsync1(((api.Location response) { | 998 res.get(arg_name).then(unittest.expectAsync1(((api.Location response) { |
1281 checkLocation(response); | 999 checkLocation(response); |
1282 }))); | 1000 }))); |
1283 }); | 1001 }); |
1284 | 1002 |
1285 unittest.test("method--list", () { | 1003 unittest.test("method--list", () { |
1286 | |
1287 var mock = new HttpServerMock(); | 1004 var mock = new HttpServerMock(); |
1288 api.ProjectsLocationsResourceApi res = new api.CloudkmsApi(mock).projects.
locations; | 1005 api.ProjectsLocationsResourceApi res = |
| 1006 new api.CloudkmsApi(mock).projects.locations; |
1289 var arg_name = "foo"; | 1007 var arg_name = "foo"; |
1290 var arg_pageSize = 42; | |
1291 var arg_filter = "foo"; | 1008 var arg_filter = "foo"; |
1292 var arg_pageToken = "foo"; | 1009 var arg_pageToken = "foo"; |
| 1010 var arg_pageSize = 42; |
1293 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1011 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
1294 var path = (req.url).path; | 1012 var path = (req.url).path; |
1295 var pathOffset = 0; | 1013 var pathOffset = 0; |
1296 var index; | 1014 var index; |
1297 var subPart; | 1015 var subPart; |
1298 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1016 unittest.expect( |
| 1017 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
1299 pathOffset += 1; | 1018 pathOffset += 1; |
1300 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); | 1019 unittest.expect( |
| 1020 path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/")); |
1301 pathOffset += 3; | 1021 pathOffset += 3; |
1302 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 1022 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
1303 | 1023 |
1304 var query = (req.url).query; | 1024 var query = (req.url).query; |
1305 var queryOffset = 0; | 1025 var queryOffset = 0; |
1306 var queryMap = {}; | 1026 var queryMap = {}; |
1307 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1027 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
1308 parseBool(n) { | 1028 parseBool(n) { |
1309 if (n == "true") return true; | 1029 if (n == "true") return true; |
1310 if (n == "false") return false; | 1030 if (n == "false") return false; |
1311 if (n == null) return null; | 1031 if (n == null) return null; |
1312 throw new core.ArgumentError("Invalid boolean: $n"); | 1032 throw new core.ArgumentError("Invalid boolean: $n"); |
1313 } | 1033 } |
| 1034 |
1314 if (query.length > 0) { | 1035 if (query.length > 0) { |
1315 for (var part in query.split("&")) { | 1036 for (var part in query.split("&")) { |
1316 var keyvalue = part.split("="); | 1037 var keyvalue = part.split("="); |
1317 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1038 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1039 core.Uri.decodeQueryComponent(keyvalue[1])); |
1318 } | 1040 } |
1319 } | 1041 } |
1320 unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equ
als(arg_pageSize)); | |
1321 unittest.expect(queryMap["filter"].first, unittest.equals(arg_filter)); | 1042 unittest.expect(queryMap["filter"].first, unittest.equals(arg_filter)); |
1322 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); | 1043 unittest.expect( |
1323 | 1044 queryMap["pageToken"].first, unittest.equals(arg_pageToken)); |
| 1045 unittest.expect(core.int.parse(queryMap["pageSize"].first), |
| 1046 unittest.equals(arg_pageSize)); |
1324 | 1047 |
1325 var h = { | 1048 var h = { |
1326 "content-type" : "application/json; charset=utf-8", | 1049 "content-type": "application/json; charset=utf-8", |
1327 }; | 1050 }; |
1328 var resp = convert.JSON.encode(buildListLocationsResponse()); | 1051 var resp = convert.JSON.encode(buildListLocationsResponse()); |
1329 return new async.Future.value(stringResponse(200, h, resp)); | 1052 return new async.Future.value(stringResponse(200, h, resp)); |
1330 }), true); | 1053 }), true); |
1331 res.list(arg_name, pageSize: arg_pageSize, filter: arg_filter, pageToken:
arg_pageToken).then(unittest.expectAsync1(((api.ListLocationsResponse response)
{ | 1054 res |
| 1055 .list(arg_name, |
| 1056 filter: arg_filter, |
| 1057 pageToken: arg_pageToken, |
| 1058 pageSize: arg_pageSize) |
| 1059 .then(unittest.expectAsync1(((api.ListLocationsResponse response) { |
1332 checkListLocationsResponse(response); | 1060 checkListLocationsResponse(response); |
1333 }))); | 1061 }))); |
1334 }); | 1062 }); |
1335 | |
1336 }); | 1063 }); |
1337 | 1064 |
1338 | |
1339 unittest.group("resource-ProjectsLocationsKeyRingsResourceApi", () { | 1065 unittest.group("resource-ProjectsLocationsKeyRingsResourceApi", () { |
1340 unittest.test("method--create", () { | 1066 unittest.test("method--create", () { |
1341 | |
1342 var mock = new HttpServerMock(); | 1067 var mock = new HttpServerMock(); |
1343 api.ProjectsLocationsKeyRingsResourceApi res = new api.CloudkmsApi(mock).p
rojects.locations.keyRings; | 1068 api.ProjectsLocationsKeyRingsResourceApi res = |
| 1069 new api.CloudkmsApi(mock).projects.locations.keyRings; |
1344 var arg_request = buildKeyRing(); | 1070 var arg_request = buildKeyRing(); |
1345 var arg_parent = "foo"; | 1071 var arg_parent = "foo"; |
1346 var arg_keyRingId = "foo"; | 1072 var arg_keyRingId = "foo"; |
1347 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1073 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
1348 var obj = new api.KeyRing.fromJson(json); | 1074 var obj = new api.KeyRing.fromJson(json); |
1349 checkKeyRing(obj); | 1075 checkKeyRing(obj); |
1350 | 1076 |
1351 var path = (req.url).path; | 1077 var path = (req.url).path; |
1352 var pathOffset = 0; | 1078 var pathOffset = 0; |
1353 var index; | 1079 var index; |
1354 var subPart; | 1080 var subPart; |
1355 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1081 unittest.expect( |
| 1082 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
1356 pathOffset += 1; | 1083 pathOffset += 1; |
1357 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); | 1084 unittest.expect( |
| 1085 path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/")); |
1358 pathOffset += 3; | 1086 pathOffset += 3; |
1359 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 1087 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
1360 | 1088 |
1361 var query = (req.url).query; | 1089 var query = (req.url).query; |
1362 var queryOffset = 0; | 1090 var queryOffset = 0; |
1363 var queryMap = {}; | 1091 var queryMap = {}; |
1364 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1092 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
1365 parseBool(n) { | 1093 parseBool(n) { |
1366 if (n == "true") return true; | 1094 if (n == "true") return true; |
1367 if (n == "false") return false; | 1095 if (n == "false") return false; |
1368 if (n == null) return null; | 1096 if (n == null) return null; |
1369 throw new core.ArgumentError("Invalid boolean: $n"); | 1097 throw new core.ArgumentError("Invalid boolean: $n"); |
1370 } | 1098 } |
| 1099 |
1371 if (query.length > 0) { | 1100 if (query.length > 0) { |
1372 for (var part in query.split("&")) { | 1101 for (var part in query.split("&")) { |
1373 var keyvalue = part.split("="); | 1102 var keyvalue = part.split("="); |
1374 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1103 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1104 core.Uri.decodeQueryComponent(keyvalue[1])); |
1375 } | 1105 } |
1376 } | 1106 } |
1377 unittest.expect(queryMap["keyRingId"].first, unittest.equals(arg_keyRing
Id)); | 1107 unittest.expect( |
1378 | 1108 queryMap["keyRingId"].first, unittest.equals(arg_keyRingId)); |
1379 | 1109 |
1380 var h = { | 1110 var h = { |
1381 "content-type" : "application/json; charset=utf-8", | 1111 "content-type": "application/json; charset=utf-8", |
1382 }; | 1112 }; |
1383 var resp = convert.JSON.encode(buildKeyRing()); | 1113 var resp = convert.JSON.encode(buildKeyRing()); |
1384 return new async.Future.value(stringResponse(200, h, resp)); | 1114 return new async.Future.value(stringResponse(200, h, resp)); |
1385 }), true); | 1115 }), true); |
1386 res.create(arg_request, arg_parent, keyRingId: arg_keyRingId).then(unittes
t.expectAsync1(((api.KeyRing response) { | 1116 res |
| 1117 .create(arg_request, arg_parent, keyRingId: arg_keyRingId) |
| 1118 .then(unittest.expectAsync1(((api.KeyRing response) { |
1387 checkKeyRing(response); | 1119 checkKeyRing(response); |
1388 }))); | 1120 }))); |
1389 }); | 1121 }); |
1390 | 1122 |
1391 unittest.test("method--get", () { | 1123 unittest.test("method--get", () { |
1392 | |
1393 var mock = new HttpServerMock(); | 1124 var mock = new HttpServerMock(); |
1394 api.ProjectsLocationsKeyRingsResourceApi res = new api.CloudkmsApi(mock).p
rojects.locations.keyRings; | 1125 api.ProjectsLocationsKeyRingsResourceApi res = |
| 1126 new api.CloudkmsApi(mock).projects.locations.keyRings; |
1395 var arg_name = "foo"; | 1127 var arg_name = "foo"; |
1396 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1128 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
1397 var path = (req.url).path; | 1129 var path = (req.url).path; |
1398 var pathOffset = 0; | 1130 var pathOffset = 0; |
1399 var index; | 1131 var index; |
1400 var subPart; | 1132 var subPart; |
1401 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1133 unittest.expect( |
| 1134 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
1402 pathOffset += 1; | 1135 pathOffset += 1; |
1403 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); | 1136 unittest.expect( |
| 1137 path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/")); |
1404 pathOffset += 3; | 1138 pathOffset += 3; |
1405 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 1139 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
1406 | 1140 |
1407 var query = (req.url).query; | 1141 var query = (req.url).query; |
1408 var queryOffset = 0; | 1142 var queryOffset = 0; |
1409 var queryMap = {}; | 1143 var queryMap = {}; |
1410 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1144 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
1411 parseBool(n) { | 1145 parseBool(n) { |
1412 if (n == "true") return true; | 1146 if (n == "true") return true; |
1413 if (n == "false") return false; | 1147 if (n == "false") return false; |
1414 if (n == null) return null; | 1148 if (n == null) return null; |
1415 throw new core.ArgumentError("Invalid boolean: $n"); | 1149 throw new core.ArgumentError("Invalid boolean: $n"); |
1416 } | 1150 } |
| 1151 |
1417 if (query.length > 0) { | 1152 if (query.length > 0) { |
1418 for (var part in query.split("&")) { | 1153 for (var part in query.split("&")) { |
1419 var keyvalue = part.split("="); | 1154 var keyvalue = part.split("="); |
1420 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1155 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1156 core.Uri.decodeQueryComponent(keyvalue[1])); |
1421 } | 1157 } |
1422 } | 1158 } |
1423 | 1159 |
1424 | |
1425 var h = { | 1160 var h = { |
1426 "content-type" : "application/json; charset=utf-8", | 1161 "content-type": "application/json; charset=utf-8", |
1427 }; | 1162 }; |
1428 var resp = convert.JSON.encode(buildKeyRing()); | 1163 var resp = convert.JSON.encode(buildKeyRing()); |
1429 return new async.Future.value(stringResponse(200, h, resp)); | 1164 return new async.Future.value(stringResponse(200, h, resp)); |
1430 }), true); | 1165 }), true); |
1431 res.get(arg_name).then(unittest.expectAsync1(((api.KeyRing response) { | 1166 res.get(arg_name).then(unittest.expectAsync1(((api.KeyRing response) { |
1432 checkKeyRing(response); | 1167 checkKeyRing(response); |
1433 }))); | 1168 }))); |
1434 }); | 1169 }); |
1435 | 1170 |
1436 unittest.test("method--getIamPolicy", () { | 1171 unittest.test("method--getIamPolicy", () { |
1437 | |
1438 var mock = new HttpServerMock(); | 1172 var mock = new HttpServerMock(); |
1439 api.ProjectsLocationsKeyRingsResourceApi res = new api.CloudkmsApi(mock).p
rojects.locations.keyRings; | 1173 api.ProjectsLocationsKeyRingsResourceApi res = |
| 1174 new api.CloudkmsApi(mock).projects.locations.keyRings; |
1440 var arg_resource = "foo"; | 1175 var arg_resource = "foo"; |
1441 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1176 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
1442 var path = (req.url).path; | 1177 var path = (req.url).path; |
1443 var pathOffset = 0; | 1178 var pathOffset = 0; |
1444 var index; | 1179 var index; |
1445 var subPart; | 1180 var subPart; |
1446 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1181 unittest.expect( |
| 1182 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
1447 pathOffset += 1; | 1183 pathOffset += 1; |
1448 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); | 1184 unittest.expect( |
| 1185 path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/")); |
1449 pathOffset += 3; | 1186 pathOffset += 3; |
1450 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 1187 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
1451 | 1188 |
1452 var query = (req.url).query; | 1189 var query = (req.url).query; |
1453 var queryOffset = 0; | 1190 var queryOffset = 0; |
1454 var queryMap = {}; | 1191 var queryMap = {}; |
1455 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1192 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
1456 parseBool(n) { | 1193 parseBool(n) { |
1457 if (n == "true") return true; | 1194 if (n == "true") return true; |
1458 if (n == "false") return false; | 1195 if (n == "false") return false; |
1459 if (n == null) return null; | 1196 if (n == null) return null; |
1460 throw new core.ArgumentError("Invalid boolean: $n"); | 1197 throw new core.ArgumentError("Invalid boolean: $n"); |
1461 } | 1198 } |
| 1199 |
1462 if (query.length > 0) { | 1200 if (query.length > 0) { |
1463 for (var part in query.split("&")) { | 1201 for (var part in query.split("&")) { |
1464 var keyvalue = part.split("="); | 1202 var keyvalue = part.split("="); |
1465 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1203 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1204 core.Uri.decodeQueryComponent(keyvalue[1])); |
1466 } | 1205 } |
1467 } | 1206 } |
1468 | 1207 |
1469 | |
1470 var h = { | 1208 var h = { |
1471 "content-type" : "application/json; charset=utf-8", | 1209 "content-type": "application/json; charset=utf-8", |
1472 }; | 1210 }; |
1473 var resp = convert.JSON.encode(buildPolicy()); | 1211 var resp = convert.JSON.encode(buildPolicy()); |
1474 return new async.Future.value(stringResponse(200, h, resp)); | 1212 return new async.Future.value(stringResponse(200, h, resp)); |
1475 }), true); | 1213 }), true); |
1476 res.getIamPolicy(arg_resource).then(unittest.expectAsync1(((api.Policy res
ponse) { | 1214 res |
| 1215 .getIamPolicy(arg_resource) |
| 1216 .then(unittest.expectAsync1(((api.Policy response) { |
1477 checkPolicy(response); | 1217 checkPolicy(response); |
1478 }))); | 1218 }))); |
1479 }); | 1219 }); |
1480 | 1220 |
1481 unittest.test("method--list", () { | 1221 unittest.test("method--list", () { |
1482 | |
1483 var mock = new HttpServerMock(); | 1222 var mock = new HttpServerMock(); |
1484 api.ProjectsLocationsKeyRingsResourceApi res = new api.CloudkmsApi(mock).p
rojects.locations.keyRings; | 1223 api.ProjectsLocationsKeyRingsResourceApi res = |
| 1224 new api.CloudkmsApi(mock).projects.locations.keyRings; |
1485 var arg_parent = "foo"; | 1225 var arg_parent = "foo"; |
| 1226 var arg_pageToken = "foo"; |
1486 var arg_pageSize = 42; | 1227 var arg_pageSize = 42; |
1487 var arg_pageToken = "foo"; | |
1488 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1228 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
1489 var path = (req.url).path; | 1229 var path = (req.url).path; |
1490 var pathOffset = 0; | 1230 var pathOffset = 0; |
1491 var index; | 1231 var index; |
1492 var subPart; | 1232 var subPart; |
1493 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1233 unittest.expect( |
| 1234 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
1494 pathOffset += 1; | 1235 pathOffset += 1; |
1495 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); | 1236 unittest.expect( |
| 1237 path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/")); |
1496 pathOffset += 3; | 1238 pathOffset += 3; |
1497 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 1239 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
1498 | 1240 |
1499 var query = (req.url).query; | 1241 var query = (req.url).query; |
1500 var queryOffset = 0; | 1242 var queryOffset = 0; |
1501 var queryMap = {}; | 1243 var queryMap = {}; |
1502 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1244 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
1503 parseBool(n) { | 1245 parseBool(n) { |
1504 if (n == "true") return true; | 1246 if (n == "true") return true; |
1505 if (n == "false") return false; | 1247 if (n == "false") return false; |
1506 if (n == null) return null; | 1248 if (n == null) return null; |
1507 throw new core.ArgumentError("Invalid boolean: $n"); | 1249 throw new core.ArgumentError("Invalid boolean: $n"); |
1508 } | 1250 } |
| 1251 |
1509 if (query.length > 0) { | 1252 if (query.length > 0) { |
1510 for (var part in query.split("&")) { | 1253 for (var part in query.split("&")) { |
1511 var keyvalue = part.split("="); | 1254 var keyvalue = part.split("="); |
1512 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1255 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1256 core.Uri.decodeQueryComponent(keyvalue[1])); |
1513 } | 1257 } |
1514 } | 1258 } |
1515 unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equ
als(arg_pageSize)); | 1259 unittest.expect( |
1516 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); | 1260 queryMap["pageToken"].first, unittest.equals(arg_pageToken)); |
1517 | 1261 unittest.expect(core.int.parse(queryMap["pageSize"].first), |
| 1262 unittest.equals(arg_pageSize)); |
1518 | 1263 |
1519 var h = { | 1264 var h = { |
1520 "content-type" : "application/json; charset=utf-8", | 1265 "content-type": "application/json; charset=utf-8", |
1521 }; | 1266 }; |
1522 var resp = convert.JSON.encode(buildListKeyRingsResponse()); | 1267 var resp = convert.JSON.encode(buildListKeyRingsResponse()); |
1523 return new async.Future.value(stringResponse(200, h, resp)); | 1268 return new async.Future.value(stringResponse(200, h, resp)); |
1524 }), true); | 1269 }), true); |
1525 res.list(arg_parent, pageSize: arg_pageSize, pageToken: arg_pageToken).the
n(unittest.expectAsync1(((api.ListKeyRingsResponse response) { | 1270 res |
| 1271 .list(arg_parent, pageToken: arg_pageToken, pageSize: arg_pageSize) |
| 1272 .then(unittest.expectAsync1(((api.ListKeyRingsResponse response) { |
1526 checkListKeyRingsResponse(response); | 1273 checkListKeyRingsResponse(response); |
1527 }))); | 1274 }))); |
1528 }); | 1275 }); |
1529 | 1276 |
1530 unittest.test("method--setIamPolicy", () { | 1277 unittest.test("method--setIamPolicy", () { |
1531 | |
1532 var mock = new HttpServerMock(); | 1278 var mock = new HttpServerMock(); |
1533 api.ProjectsLocationsKeyRingsResourceApi res = new api.CloudkmsApi(mock).p
rojects.locations.keyRings; | 1279 api.ProjectsLocationsKeyRingsResourceApi res = |
| 1280 new api.CloudkmsApi(mock).projects.locations.keyRings; |
1534 var arg_request = buildSetIamPolicyRequest(); | 1281 var arg_request = buildSetIamPolicyRequest(); |
1535 var arg_resource = "foo"; | 1282 var arg_resource = "foo"; |
1536 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1283 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
1537 var obj = new api.SetIamPolicyRequest.fromJson(json); | 1284 var obj = new api.SetIamPolicyRequest.fromJson(json); |
1538 checkSetIamPolicyRequest(obj); | 1285 checkSetIamPolicyRequest(obj); |
1539 | 1286 |
1540 var path = (req.url).path; | 1287 var path = (req.url).path; |
1541 var pathOffset = 0; | 1288 var pathOffset = 0; |
1542 var index; | 1289 var index; |
1543 var subPart; | 1290 var subPart; |
1544 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1291 unittest.expect( |
| 1292 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
1545 pathOffset += 1; | 1293 pathOffset += 1; |
1546 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); | 1294 unittest.expect( |
| 1295 path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/")); |
1547 pathOffset += 3; | 1296 pathOffset += 3; |
1548 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 1297 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
1549 | 1298 |
1550 var query = (req.url).query; | 1299 var query = (req.url).query; |
1551 var queryOffset = 0; | 1300 var queryOffset = 0; |
1552 var queryMap = {}; | 1301 var queryMap = {}; |
1553 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1302 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
1554 parseBool(n) { | 1303 parseBool(n) { |
1555 if (n == "true") return true; | 1304 if (n == "true") return true; |
1556 if (n == "false") return false; | 1305 if (n == "false") return false; |
1557 if (n == null) return null; | 1306 if (n == null) return null; |
1558 throw new core.ArgumentError("Invalid boolean: $n"); | 1307 throw new core.ArgumentError("Invalid boolean: $n"); |
1559 } | 1308 } |
| 1309 |
1560 if (query.length > 0) { | 1310 if (query.length > 0) { |
1561 for (var part in query.split("&")) { | 1311 for (var part in query.split("&")) { |
1562 var keyvalue = part.split("="); | 1312 var keyvalue = part.split("="); |
1563 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1313 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1314 core.Uri.decodeQueryComponent(keyvalue[1])); |
1564 } | 1315 } |
1565 } | 1316 } |
1566 | 1317 |
1567 | |
1568 var h = { | 1318 var h = { |
1569 "content-type" : "application/json; charset=utf-8", | 1319 "content-type": "application/json; charset=utf-8", |
1570 }; | 1320 }; |
1571 var resp = convert.JSON.encode(buildPolicy()); | 1321 var resp = convert.JSON.encode(buildPolicy()); |
1572 return new async.Future.value(stringResponse(200, h, resp)); | 1322 return new async.Future.value(stringResponse(200, h, resp)); |
1573 }), true); | 1323 }), true); |
1574 res.setIamPolicy(arg_request, arg_resource).then(unittest.expectAsync1(((a
pi.Policy response) { | 1324 res |
| 1325 .setIamPolicy(arg_request, arg_resource) |
| 1326 .then(unittest.expectAsync1(((api.Policy response) { |
1575 checkPolicy(response); | 1327 checkPolicy(response); |
1576 }))); | 1328 }))); |
1577 }); | 1329 }); |
1578 | 1330 |
1579 unittest.test("method--testIamPermissions", () { | 1331 unittest.test("method--testIamPermissions", () { |
1580 | |
1581 var mock = new HttpServerMock(); | 1332 var mock = new HttpServerMock(); |
1582 api.ProjectsLocationsKeyRingsResourceApi res = new api.CloudkmsApi(mock).p
rojects.locations.keyRings; | 1333 api.ProjectsLocationsKeyRingsResourceApi res = |
| 1334 new api.CloudkmsApi(mock).projects.locations.keyRings; |
1583 var arg_request = buildTestIamPermissionsRequest(); | 1335 var arg_request = buildTestIamPermissionsRequest(); |
1584 var arg_resource = "foo"; | 1336 var arg_resource = "foo"; |
1585 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1337 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
1586 var obj = new api.TestIamPermissionsRequest.fromJson(json); | 1338 var obj = new api.TestIamPermissionsRequest.fromJson(json); |
1587 checkTestIamPermissionsRequest(obj); | 1339 checkTestIamPermissionsRequest(obj); |
1588 | 1340 |
1589 var path = (req.url).path; | 1341 var path = (req.url).path; |
1590 var pathOffset = 0; | 1342 var pathOffset = 0; |
1591 var index; | 1343 var index; |
1592 var subPart; | 1344 var subPart; |
1593 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1345 unittest.expect( |
| 1346 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
1594 pathOffset += 1; | 1347 pathOffset += 1; |
1595 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); | 1348 unittest.expect( |
| 1349 path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/")); |
1596 pathOffset += 3; | 1350 pathOffset += 3; |
1597 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 1351 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
1598 | 1352 |
1599 var query = (req.url).query; | 1353 var query = (req.url).query; |
1600 var queryOffset = 0; | 1354 var queryOffset = 0; |
1601 var queryMap = {}; | 1355 var queryMap = {}; |
1602 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1356 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
1603 parseBool(n) { | 1357 parseBool(n) { |
1604 if (n == "true") return true; | 1358 if (n == "true") return true; |
1605 if (n == "false") return false; | 1359 if (n == "false") return false; |
1606 if (n == null) return null; | 1360 if (n == null) return null; |
1607 throw new core.ArgumentError("Invalid boolean: $n"); | 1361 throw new core.ArgumentError("Invalid boolean: $n"); |
1608 } | 1362 } |
| 1363 |
1609 if (query.length > 0) { | 1364 if (query.length > 0) { |
1610 for (var part in query.split("&")) { | 1365 for (var part in query.split("&")) { |
1611 var keyvalue = part.split("="); | 1366 var keyvalue = part.split("="); |
1612 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1367 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1368 core.Uri.decodeQueryComponent(keyvalue[1])); |
1613 } | 1369 } |
1614 } | 1370 } |
1615 | 1371 |
1616 | |
1617 var h = { | 1372 var h = { |
1618 "content-type" : "application/json; charset=utf-8", | 1373 "content-type": "application/json; charset=utf-8", |
1619 }; | 1374 }; |
1620 var resp = convert.JSON.encode(buildTestIamPermissionsResponse()); | 1375 var resp = convert.JSON.encode(buildTestIamPermissionsResponse()); |
1621 return new async.Future.value(stringResponse(200, h, resp)); | 1376 return new async.Future.value(stringResponse(200, h, resp)); |
1622 }), true); | 1377 }), true); |
1623 res.testIamPermissions(arg_request, arg_resource).then(unittest.expectAsyn
c1(((api.TestIamPermissionsResponse response) { | 1378 res.testIamPermissions(arg_request, arg_resource).then( |
| 1379 unittest.expectAsync1(((api.TestIamPermissionsResponse response) { |
1624 checkTestIamPermissionsResponse(response); | 1380 checkTestIamPermissionsResponse(response); |
1625 }))); | 1381 }))); |
1626 }); | 1382 }); |
1627 | |
1628 }); | 1383 }); |
1629 | 1384 |
1630 | |
1631 unittest.group("resource-ProjectsLocationsKeyRingsCryptoKeysResourceApi", () { | 1385 unittest.group("resource-ProjectsLocationsKeyRingsCryptoKeysResourceApi", () { |
1632 unittest.test("method--create", () { | 1386 unittest.test("method--create", () { |
1633 | |
1634 var mock = new HttpServerMock(); | 1387 var mock = new HttpServerMock(); |
1635 api.ProjectsLocationsKeyRingsCryptoKeysResourceApi res = new api.CloudkmsA
pi(mock).projects.locations.keyRings.cryptoKeys; | 1388 api.ProjectsLocationsKeyRingsCryptoKeysResourceApi res = |
| 1389 new api.CloudkmsApi(mock).projects.locations.keyRings.cryptoKeys; |
1636 var arg_request = buildCryptoKey(); | 1390 var arg_request = buildCryptoKey(); |
1637 var arg_parent = "foo"; | 1391 var arg_parent = "foo"; |
1638 var arg_cryptoKeyId = "foo"; | 1392 var arg_cryptoKeyId = "foo"; |
1639 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1393 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
1640 var obj = new api.CryptoKey.fromJson(json); | 1394 var obj = new api.CryptoKey.fromJson(json); |
1641 checkCryptoKey(obj); | 1395 checkCryptoKey(obj); |
1642 | 1396 |
1643 var path = (req.url).path; | 1397 var path = (req.url).path; |
1644 var pathOffset = 0; | 1398 var pathOffset = 0; |
1645 var index; | 1399 var index; |
1646 var subPart; | 1400 var subPart; |
1647 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1401 unittest.expect( |
| 1402 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
1648 pathOffset += 1; | 1403 pathOffset += 1; |
1649 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); | 1404 unittest.expect( |
| 1405 path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/")); |
1650 pathOffset += 3; | 1406 pathOffset += 3; |
1651 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 1407 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
1652 | 1408 |
1653 var query = (req.url).query; | 1409 var query = (req.url).query; |
1654 var queryOffset = 0; | 1410 var queryOffset = 0; |
1655 var queryMap = {}; | 1411 var queryMap = {}; |
1656 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1412 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
1657 parseBool(n) { | 1413 parseBool(n) { |
1658 if (n == "true") return true; | 1414 if (n == "true") return true; |
1659 if (n == "false") return false; | 1415 if (n == "false") return false; |
1660 if (n == null) return null; | 1416 if (n == null) return null; |
1661 throw new core.ArgumentError("Invalid boolean: $n"); | 1417 throw new core.ArgumentError("Invalid boolean: $n"); |
1662 } | 1418 } |
| 1419 |
1663 if (query.length > 0) { | 1420 if (query.length > 0) { |
1664 for (var part in query.split("&")) { | 1421 for (var part in query.split("&")) { |
1665 var keyvalue = part.split("="); | 1422 var keyvalue = part.split("="); |
1666 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1423 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1424 core.Uri.decodeQueryComponent(keyvalue[1])); |
1667 } | 1425 } |
1668 } | 1426 } |
1669 unittest.expect(queryMap["cryptoKeyId"].first, unittest.equals(arg_crypt
oKeyId)); | 1427 unittest.expect( |
1670 | 1428 queryMap["cryptoKeyId"].first, unittest.equals(arg_cryptoKeyId)); |
1671 | 1429 |
1672 var h = { | 1430 var h = { |
1673 "content-type" : "application/json; charset=utf-8", | 1431 "content-type": "application/json; charset=utf-8", |
1674 }; | 1432 }; |
1675 var resp = convert.JSON.encode(buildCryptoKey()); | 1433 var resp = convert.JSON.encode(buildCryptoKey()); |
1676 return new async.Future.value(stringResponse(200, h, resp)); | 1434 return new async.Future.value(stringResponse(200, h, resp)); |
1677 }), true); | 1435 }), true); |
1678 res.create(arg_request, arg_parent, cryptoKeyId: arg_cryptoKeyId).then(uni
ttest.expectAsync1(((api.CryptoKey response) { | 1436 res |
| 1437 .create(arg_request, arg_parent, cryptoKeyId: arg_cryptoKeyId) |
| 1438 .then(unittest.expectAsync1(((api.CryptoKey response) { |
1679 checkCryptoKey(response); | 1439 checkCryptoKey(response); |
1680 }))); | 1440 }))); |
1681 }); | 1441 }); |
1682 | 1442 |
1683 unittest.test("method--decrypt", () { | 1443 unittest.test("method--decrypt", () { |
1684 | |
1685 var mock = new HttpServerMock(); | 1444 var mock = new HttpServerMock(); |
1686 api.ProjectsLocationsKeyRingsCryptoKeysResourceApi res = new api.CloudkmsA
pi(mock).projects.locations.keyRings.cryptoKeys; | 1445 api.ProjectsLocationsKeyRingsCryptoKeysResourceApi res = |
| 1446 new api.CloudkmsApi(mock).projects.locations.keyRings.cryptoKeys; |
1687 var arg_request = buildDecryptRequest(); | 1447 var arg_request = buildDecryptRequest(); |
1688 var arg_name = "foo"; | 1448 var arg_name = "foo"; |
1689 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1449 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
1690 var obj = new api.DecryptRequest.fromJson(json); | 1450 var obj = new api.DecryptRequest.fromJson(json); |
1691 checkDecryptRequest(obj); | 1451 checkDecryptRequest(obj); |
1692 | 1452 |
1693 var path = (req.url).path; | 1453 var path = (req.url).path; |
1694 var pathOffset = 0; | 1454 var pathOffset = 0; |
1695 var index; | 1455 var index; |
1696 var subPart; | 1456 var subPart; |
1697 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1457 unittest.expect( |
| 1458 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
1698 pathOffset += 1; | 1459 pathOffset += 1; |
1699 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); | 1460 unittest.expect( |
| 1461 path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/")); |
1700 pathOffset += 3; | 1462 pathOffset += 3; |
1701 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 1463 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
1702 | 1464 |
1703 var query = (req.url).query; | 1465 var query = (req.url).query; |
1704 var queryOffset = 0; | 1466 var queryOffset = 0; |
1705 var queryMap = {}; | 1467 var queryMap = {}; |
1706 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1468 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
1707 parseBool(n) { | 1469 parseBool(n) { |
1708 if (n == "true") return true; | 1470 if (n == "true") return true; |
1709 if (n == "false") return false; | 1471 if (n == "false") return false; |
1710 if (n == null) return null; | 1472 if (n == null) return null; |
1711 throw new core.ArgumentError("Invalid boolean: $n"); | 1473 throw new core.ArgumentError("Invalid boolean: $n"); |
1712 } | 1474 } |
| 1475 |
1713 if (query.length > 0) { | 1476 if (query.length > 0) { |
1714 for (var part in query.split("&")) { | 1477 for (var part in query.split("&")) { |
1715 var keyvalue = part.split("="); | 1478 var keyvalue = part.split("="); |
1716 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1479 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1480 core.Uri.decodeQueryComponent(keyvalue[1])); |
1717 } | 1481 } |
1718 } | 1482 } |
1719 | 1483 |
1720 | |
1721 var h = { | 1484 var h = { |
1722 "content-type" : "application/json; charset=utf-8", | 1485 "content-type": "application/json; charset=utf-8", |
1723 }; | 1486 }; |
1724 var resp = convert.JSON.encode(buildDecryptResponse()); | 1487 var resp = convert.JSON.encode(buildDecryptResponse()); |
1725 return new async.Future.value(stringResponse(200, h, resp)); | 1488 return new async.Future.value(stringResponse(200, h, resp)); |
1726 }), true); | 1489 }), true); |
1727 res.decrypt(arg_request, arg_name).then(unittest.expectAsync1(((api.Decryp
tResponse response) { | 1490 res |
| 1491 .decrypt(arg_request, arg_name) |
| 1492 .then(unittest.expectAsync1(((api.DecryptResponse response) { |
1728 checkDecryptResponse(response); | 1493 checkDecryptResponse(response); |
1729 }))); | 1494 }))); |
1730 }); | 1495 }); |
1731 | 1496 |
1732 unittest.test("method--encrypt", () { | 1497 unittest.test("method--encrypt", () { |
1733 | |
1734 var mock = new HttpServerMock(); | 1498 var mock = new HttpServerMock(); |
1735 api.ProjectsLocationsKeyRingsCryptoKeysResourceApi res = new api.CloudkmsA
pi(mock).projects.locations.keyRings.cryptoKeys; | 1499 api.ProjectsLocationsKeyRingsCryptoKeysResourceApi res = |
| 1500 new api.CloudkmsApi(mock).projects.locations.keyRings.cryptoKeys; |
1736 var arg_request = buildEncryptRequest(); | 1501 var arg_request = buildEncryptRequest(); |
1737 var arg_name = "foo"; | 1502 var arg_name = "foo"; |
1738 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1503 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
1739 var obj = new api.EncryptRequest.fromJson(json); | 1504 var obj = new api.EncryptRequest.fromJson(json); |
1740 checkEncryptRequest(obj); | 1505 checkEncryptRequest(obj); |
1741 | 1506 |
1742 var path = (req.url).path; | 1507 var path = (req.url).path; |
1743 var pathOffset = 0; | 1508 var pathOffset = 0; |
1744 var index; | 1509 var index; |
1745 var subPart; | 1510 var subPart; |
1746 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1511 unittest.expect( |
| 1512 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
1747 pathOffset += 1; | 1513 pathOffset += 1; |
1748 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); | 1514 unittest.expect( |
| 1515 path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/")); |
1749 pathOffset += 3; | 1516 pathOffset += 3; |
1750 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 1517 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
1751 | 1518 |
1752 var query = (req.url).query; | 1519 var query = (req.url).query; |
1753 var queryOffset = 0; | 1520 var queryOffset = 0; |
1754 var queryMap = {}; | 1521 var queryMap = {}; |
1755 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1522 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
1756 parseBool(n) { | 1523 parseBool(n) { |
1757 if (n == "true") return true; | 1524 if (n == "true") return true; |
1758 if (n == "false") return false; | 1525 if (n == "false") return false; |
1759 if (n == null) return null; | 1526 if (n == null) return null; |
1760 throw new core.ArgumentError("Invalid boolean: $n"); | 1527 throw new core.ArgumentError("Invalid boolean: $n"); |
1761 } | 1528 } |
| 1529 |
1762 if (query.length > 0) { | 1530 if (query.length > 0) { |
1763 for (var part in query.split("&")) { | 1531 for (var part in query.split("&")) { |
1764 var keyvalue = part.split("="); | 1532 var keyvalue = part.split("="); |
1765 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1533 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1534 core.Uri.decodeQueryComponent(keyvalue[1])); |
1766 } | 1535 } |
1767 } | 1536 } |
1768 | 1537 |
1769 | |
1770 var h = { | 1538 var h = { |
1771 "content-type" : "application/json; charset=utf-8", | 1539 "content-type": "application/json; charset=utf-8", |
1772 }; | 1540 }; |
1773 var resp = convert.JSON.encode(buildEncryptResponse()); | 1541 var resp = convert.JSON.encode(buildEncryptResponse()); |
1774 return new async.Future.value(stringResponse(200, h, resp)); | 1542 return new async.Future.value(stringResponse(200, h, resp)); |
1775 }), true); | 1543 }), true); |
1776 res.encrypt(arg_request, arg_name).then(unittest.expectAsync1(((api.Encryp
tResponse response) { | 1544 res |
| 1545 .encrypt(arg_request, arg_name) |
| 1546 .then(unittest.expectAsync1(((api.EncryptResponse response) { |
1777 checkEncryptResponse(response); | 1547 checkEncryptResponse(response); |
1778 }))); | 1548 }))); |
1779 }); | 1549 }); |
1780 | 1550 |
1781 unittest.test("method--get", () { | 1551 unittest.test("method--get", () { |
1782 | |
1783 var mock = new HttpServerMock(); | 1552 var mock = new HttpServerMock(); |
1784 api.ProjectsLocationsKeyRingsCryptoKeysResourceApi res = new api.CloudkmsA
pi(mock).projects.locations.keyRings.cryptoKeys; | 1553 api.ProjectsLocationsKeyRingsCryptoKeysResourceApi res = |
| 1554 new api.CloudkmsApi(mock).projects.locations.keyRings.cryptoKeys; |
1785 var arg_name = "foo"; | 1555 var arg_name = "foo"; |
1786 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1556 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
1787 var path = (req.url).path; | 1557 var path = (req.url).path; |
1788 var pathOffset = 0; | 1558 var pathOffset = 0; |
1789 var index; | 1559 var index; |
1790 var subPart; | 1560 var subPart; |
1791 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1561 unittest.expect( |
| 1562 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
1792 pathOffset += 1; | 1563 pathOffset += 1; |
1793 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); | 1564 unittest.expect( |
| 1565 path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/")); |
1794 pathOffset += 3; | 1566 pathOffset += 3; |
1795 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 1567 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
1796 | 1568 |
1797 var query = (req.url).query; | 1569 var query = (req.url).query; |
1798 var queryOffset = 0; | 1570 var queryOffset = 0; |
1799 var queryMap = {}; | 1571 var queryMap = {}; |
1800 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1572 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
1801 parseBool(n) { | 1573 parseBool(n) { |
1802 if (n == "true") return true; | 1574 if (n == "true") return true; |
1803 if (n == "false") return false; | 1575 if (n == "false") return false; |
1804 if (n == null) return null; | 1576 if (n == null) return null; |
1805 throw new core.ArgumentError("Invalid boolean: $n"); | 1577 throw new core.ArgumentError("Invalid boolean: $n"); |
1806 } | 1578 } |
| 1579 |
1807 if (query.length > 0) { | 1580 if (query.length > 0) { |
1808 for (var part in query.split("&")) { | 1581 for (var part in query.split("&")) { |
1809 var keyvalue = part.split("="); | 1582 var keyvalue = part.split("="); |
1810 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1583 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1584 core.Uri.decodeQueryComponent(keyvalue[1])); |
1811 } | 1585 } |
1812 } | 1586 } |
1813 | 1587 |
1814 | |
1815 var h = { | 1588 var h = { |
1816 "content-type" : "application/json; charset=utf-8", | 1589 "content-type": "application/json; charset=utf-8", |
1817 }; | 1590 }; |
1818 var resp = convert.JSON.encode(buildCryptoKey()); | 1591 var resp = convert.JSON.encode(buildCryptoKey()); |
1819 return new async.Future.value(stringResponse(200, h, resp)); | 1592 return new async.Future.value(stringResponse(200, h, resp)); |
1820 }), true); | 1593 }), true); |
1821 res.get(arg_name).then(unittest.expectAsync1(((api.CryptoKey response) { | 1594 res.get(arg_name).then(unittest.expectAsync1(((api.CryptoKey response) { |
1822 checkCryptoKey(response); | 1595 checkCryptoKey(response); |
1823 }))); | 1596 }))); |
1824 }); | 1597 }); |
1825 | 1598 |
1826 unittest.test("method--getIamPolicy", () { | 1599 unittest.test("method--getIamPolicy", () { |
1827 | |
1828 var mock = new HttpServerMock(); | 1600 var mock = new HttpServerMock(); |
1829 api.ProjectsLocationsKeyRingsCryptoKeysResourceApi res = new api.CloudkmsA
pi(mock).projects.locations.keyRings.cryptoKeys; | 1601 api.ProjectsLocationsKeyRingsCryptoKeysResourceApi res = |
| 1602 new api.CloudkmsApi(mock).projects.locations.keyRings.cryptoKeys; |
1830 var arg_resource = "foo"; | 1603 var arg_resource = "foo"; |
1831 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1604 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
1832 var path = (req.url).path; | 1605 var path = (req.url).path; |
1833 var pathOffset = 0; | 1606 var pathOffset = 0; |
1834 var index; | 1607 var index; |
1835 var subPart; | 1608 var subPart; |
1836 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1609 unittest.expect( |
| 1610 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
1837 pathOffset += 1; | 1611 pathOffset += 1; |
1838 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); | 1612 unittest.expect( |
| 1613 path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/")); |
1839 pathOffset += 3; | 1614 pathOffset += 3; |
1840 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 1615 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
1841 | 1616 |
1842 var query = (req.url).query; | 1617 var query = (req.url).query; |
1843 var queryOffset = 0; | 1618 var queryOffset = 0; |
1844 var queryMap = {}; | 1619 var queryMap = {}; |
1845 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1620 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
1846 parseBool(n) { | 1621 parseBool(n) { |
1847 if (n == "true") return true; | 1622 if (n == "true") return true; |
1848 if (n == "false") return false; | 1623 if (n == "false") return false; |
1849 if (n == null) return null; | 1624 if (n == null) return null; |
1850 throw new core.ArgumentError("Invalid boolean: $n"); | 1625 throw new core.ArgumentError("Invalid boolean: $n"); |
1851 } | 1626 } |
| 1627 |
1852 if (query.length > 0) { | 1628 if (query.length > 0) { |
1853 for (var part in query.split("&")) { | 1629 for (var part in query.split("&")) { |
1854 var keyvalue = part.split("="); | 1630 var keyvalue = part.split("="); |
1855 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1631 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1632 core.Uri.decodeQueryComponent(keyvalue[1])); |
1856 } | 1633 } |
1857 } | 1634 } |
1858 | 1635 |
1859 | |
1860 var h = { | 1636 var h = { |
1861 "content-type" : "application/json; charset=utf-8", | 1637 "content-type": "application/json; charset=utf-8", |
1862 }; | 1638 }; |
1863 var resp = convert.JSON.encode(buildPolicy()); | 1639 var resp = convert.JSON.encode(buildPolicy()); |
1864 return new async.Future.value(stringResponse(200, h, resp)); | 1640 return new async.Future.value(stringResponse(200, h, resp)); |
1865 }), true); | 1641 }), true); |
1866 res.getIamPolicy(arg_resource).then(unittest.expectAsync1(((api.Policy res
ponse) { | 1642 res |
| 1643 .getIamPolicy(arg_resource) |
| 1644 .then(unittest.expectAsync1(((api.Policy response) { |
1867 checkPolicy(response); | 1645 checkPolicy(response); |
1868 }))); | 1646 }))); |
1869 }); | 1647 }); |
1870 | 1648 |
1871 unittest.test("method--list", () { | 1649 unittest.test("method--list", () { |
1872 | |
1873 var mock = new HttpServerMock(); | 1650 var mock = new HttpServerMock(); |
1874 api.ProjectsLocationsKeyRingsCryptoKeysResourceApi res = new api.CloudkmsA
pi(mock).projects.locations.keyRings.cryptoKeys; | 1651 api.ProjectsLocationsKeyRingsCryptoKeysResourceApi res = |
| 1652 new api.CloudkmsApi(mock).projects.locations.keyRings.cryptoKeys; |
1875 var arg_parent = "foo"; | 1653 var arg_parent = "foo"; |
| 1654 var arg_pageToken = "foo"; |
1876 var arg_pageSize = 42; | 1655 var arg_pageSize = 42; |
1877 var arg_pageToken = "foo"; | |
1878 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1656 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
1879 var path = (req.url).path; | 1657 var path = (req.url).path; |
1880 var pathOffset = 0; | 1658 var pathOffset = 0; |
1881 var index; | 1659 var index; |
1882 var subPart; | 1660 var subPart; |
1883 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1661 unittest.expect( |
| 1662 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
1884 pathOffset += 1; | 1663 pathOffset += 1; |
1885 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); | 1664 unittest.expect( |
| 1665 path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/")); |
1886 pathOffset += 3; | 1666 pathOffset += 3; |
1887 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 1667 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
1888 | 1668 |
1889 var query = (req.url).query; | 1669 var query = (req.url).query; |
1890 var queryOffset = 0; | 1670 var queryOffset = 0; |
1891 var queryMap = {}; | 1671 var queryMap = {}; |
1892 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1672 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
1893 parseBool(n) { | 1673 parseBool(n) { |
1894 if (n == "true") return true; | 1674 if (n == "true") return true; |
1895 if (n == "false") return false; | 1675 if (n == "false") return false; |
1896 if (n == null) return null; | 1676 if (n == null) return null; |
1897 throw new core.ArgumentError("Invalid boolean: $n"); | 1677 throw new core.ArgumentError("Invalid boolean: $n"); |
1898 } | 1678 } |
| 1679 |
1899 if (query.length > 0) { | 1680 if (query.length > 0) { |
1900 for (var part in query.split("&")) { | 1681 for (var part in query.split("&")) { |
1901 var keyvalue = part.split("="); | 1682 var keyvalue = part.split("="); |
1902 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1683 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1684 core.Uri.decodeQueryComponent(keyvalue[1])); |
1903 } | 1685 } |
1904 } | 1686 } |
1905 unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equ
als(arg_pageSize)); | 1687 unittest.expect( |
1906 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); | 1688 queryMap["pageToken"].first, unittest.equals(arg_pageToken)); |
1907 | 1689 unittest.expect(core.int.parse(queryMap["pageSize"].first), |
| 1690 unittest.equals(arg_pageSize)); |
1908 | 1691 |
1909 var h = { | 1692 var h = { |
1910 "content-type" : "application/json; charset=utf-8", | 1693 "content-type": "application/json; charset=utf-8", |
1911 }; | 1694 }; |
1912 var resp = convert.JSON.encode(buildListCryptoKeysResponse()); | 1695 var resp = convert.JSON.encode(buildListCryptoKeysResponse()); |
1913 return new async.Future.value(stringResponse(200, h, resp)); | 1696 return new async.Future.value(stringResponse(200, h, resp)); |
1914 }), true); | 1697 }), true); |
1915 res.list(arg_parent, pageSize: arg_pageSize, pageToken: arg_pageToken).the
n(unittest.expectAsync1(((api.ListCryptoKeysResponse response) { | 1698 res |
| 1699 .list(arg_parent, pageToken: arg_pageToken, pageSize: arg_pageSize) |
| 1700 .then(unittest.expectAsync1(((api.ListCryptoKeysResponse response) { |
1916 checkListCryptoKeysResponse(response); | 1701 checkListCryptoKeysResponse(response); |
1917 }))); | 1702 }))); |
1918 }); | 1703 }); |
1919 | 1704 |
1920 unittest.test("method--patch", () { | 1705 unittest.test("method--patch", () { |
1921 | |
1922 var mock = new HttpServerMock(); | 1706 var mock = new HttpServerMock(); |
1923 api.ProjectsLocationsKeyRingsCryptoKeysResourceApi res = new api.CloudkmsA
pi(mock).projects.locations.keyRings.cryptoKeys; | 1707 api.ProjectsLocationsKeyRingsCryptoKeysResourceApi res = |
| 1708 new api.CloudkmsApi(mock).projects.locations.keyRings.cryptoKeys; |
1924 var arg_request = buildCryptoKey(); | 1709 var arg_request = buildCryptoKey(); |
1925 var arg_name = "foo"; | 1710 var arg_name = "foo"; |
1926 var arg_updateMask = "foo"; | 1711 var arg_updateMask = "foo"; |
1927 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1712 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
1928 var obj = new api.CryptoKey.fromJson(json); | 1713 var obj = new api.CryptoKey.fromJson(json); |
1929 checkCryptoKey(obj); | 1714 checkCryptoKey(obj); |
1930 | 1715 |
1931 var path = (req.url).path; | 1716 var path = (req.url).path; |
1932 var pathOffset = 0; | 1717 var pathOffset = 0; |
1933 var index; | 1718 var index; |
1934 var subPart; | 1719 var subPart; |
1935 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1720 unittest.expect( |
| 1721 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
1936 pathOffset += 1; | 1722 pathOffset += 1; |
1937 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); | 1723 unittest.expect( |
| 1724 path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/")); |
1938 pathOffset += 3; | 1725 pathOffset += 3; |
1939 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 1726 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
1940 | 1727 |
1941 var query = (req.url).query; | 1728 var query = (req.url).query; |
1942 var queryOffset = 0; | 1729 var queryOffset = 0; |
1943 var queryMap = {}; | 1730 var queryMap = {}; |
1944 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1731 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
1945 parseBool(n) { | 1732 parseBool(n) { |
1946 if (n == "true") return true; | 1733 if (n == "true") return true; |
1947 if (n == "false") return false; | 1734 if (n == "false") return false; |
1948 if (n == null) return null; | 1735 if (n == null) return null; |
1949 throw new core.ArgumentError("Invalid boolean: $n"); | 1736 throw new core.ArgumentError("Invalid boolean: $n"); |
1950 } | 1737 } |
| 1738 |
1951 if (query.length > 0) { | 1739 if (query.length > 0) { |
1952 for (var part in query.split("&")) { | 1740 for (var part in query.split("&")) { |
1953 var keyvalue = part.split("="); | 1741 var keyvalue = part.split("="); |
1954 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1742 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1743 core.Uri.decodeQueryComponent(keyvalue[1])); |
1955 } | 1744 } |
1956 } | 1745 } |
1957 unittest.expect(queryMap["updateMask"].first, unittest.equals(arg_update
Mask)); | 1746 unittest.expect( |
1958 | 1747 queryMap["updateMask"].first, unittest.equals(arg_updateMask)); |
1959 | 1748 |
1960 var h = { | 1749 var h = { |
1961 "content-type" : "application/json; charset=utf-8", | 1750 "content-type": "application/json; charset=utf-8", |
1962 }; | 1751 }; |
1963 var resp = convert.JSON.encode(buildCryptoKey()); | 1752 var resp = convert.JSON.encode(buildCryptoKey()); |
1964 return new async.Future.value(stringResponse(200, h, resp)); | 1753 return new async.Future.value(stringResponse(200, h, resp)); |
1965 }), true); | 1754 }), true); |
1966 res.patch(arg_request, arg_name, updateMask: arg_updateMask).then(unittest
.expectAsync1(((api.CryptoKey response) { | 1755 res |
| 1756 .patch(arg_request, arg_name, updateMask: arg_updateMask) |
| 1757 .then(unittest.expectAsync1(((api.CryptoKey response) { |
1967 checkCryptoKey(response); | 1758 checkCryptoKey(response); |
1968 }))); | 1759 }))); |
1969 }); | 1760 }); |
1970 | 1761 |
1971 unittest.test("method--setIamPolicy", () { | 1762 unittest.test("method--setIamPolicy", () { |
1972 | |
1973 var mock = new HttpServerMock(); | 1763 var mock = new HttpServerMock(); |
1974 api.ProjectsLocationsKeyRingsCryptoKeysResourceApi res = new api.CloudkmsA
pi(mock).projects.locations.keyRings.cryptoKeys; | 1764 api.ProjectsLocationsKeyRingsCryptoKeysResourceApi res = |
| 1765 new api.CloudkmsApi(mock).projects.locations.keyRings.cryptoKeys; |
1975 var arg_request = buildSetIamPolicyRequest(); | 1766 var arg_request = buildSetIamPolicyRequest(); |
1976 var arg_resource = "foo"; | 1767 var arg_resource = "foo"; |
1977 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1768 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
1978 var obj = new api.SetIamPolicyRequest.fromJson(json); | 1769 var obj = new api.SetIamPolicyRequest.fromJson(json); |
1979 checkSetIamPolicyRequest(obj); | 1770 checkSetIamPolicyRequest(obj); |
1980 | 1771 |
1981 var path = (req.url).path; | 1772 var path = (req.url).path; |
1982 var pathOffset = 0; | 1773 var pathOffset = 0; |
1983 var index; | 1774 var index; |
1984 var subPart; | 1775 var subPart; |
1985 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1776 unittest.expect( |
| 1777 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
1986 pathOffset += 1; | 1778 pathOffset += 1; |
1987 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); | 1779 unittest.expect( |
| 1780 path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/")); |
1988 pathOffset += 3; | 1781 pathOffset += 3; |
1989 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 1782 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
1990 | 1783 |
1991 var query = (req.url).query; | 1784 var query = (req.url).query; |
1992 var queryOffset = 0; | 1785 var queryOffset = 0; |
1993 var queryMap = {}; | 1786 var queryMap = {}; |
1994 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1787 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
1995 parseBool(n) { | 1788 parseBool(n) { |
1996 if (n == "true") return true; | 1789 if (n == "true") return true; |
1997 if (n == "false") return false; | 1790 if (n == "false") return false; |
1998 if (n == null) return null; | 1791 if (n == null) return null; |
1999 throw new core.ArgumentError("Invalid boolean: $n"); | 1792 throw new core.ArgumentError("Invalid boolean: $n"); |
2000 } | 1793 } |
| 1794 |
2001 if (query.length > 0) { | 1795 if (query.length > 0) { |
2002 for (var part in query.split("&")) { | 1796 for (var part in query.split("&")) { |
2003 var keyvalue = part.split("="); | 1797 var keyvalue = part.split("="); |
2004 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1798 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1799 core.Uri.decodeQueryComponent(keyvalue[1])); |
2005 } | 1800 } |
2006 } | 1801 } |
2007 | 1802 |
2008 | |
2009 var h = { | 1803 var h = { |
2010 "content-type" : "application/json; charset=utf-8", | 1804 "content-type": "application/json; charset=utf-8", |
2011 }; | 1805 }; |
2012 var resp = convert.JSON.encode(buildPolicy()); | 1806 var resp = convert.JSON.encode(buildPolicy()); |
2013 return new async.Future.value(stringResponse(200, h, resp)); | 1807 return new async.Future.value(stringResponse(200, h, resp)); |
2014 }), true); | 1808 }), true); |
2015 res.setIamPolicy(arg_request, arg_resource).then(unittest.expectAsync1(((a
pi.Policy response) { | 1809 res |
| 1810 .setIamPolicy(arg_request, arg_resource) |
| 1811 .then(unittest.expectAsync1(((api.Policy response) { |
2016 checkPolicy(response); | 1812 checkPolicy(response); |
2017 }))); | 1813 }))); |
2018 }); | 1814 }); |
2019 | 1815 |
2020 unittest.test("method--testIamPermissions", () { | 1816 unittest.test("method--testIamPermissions", () { |
2021 | |
2022 var mock = new HttpServerMock(); | 1817 var mock = new HttpServerMock(); |
2023 api.ProjectsLocationsKeyRingsCryptoKeysResourceApi res = new api.CloudkmsA
pi(mock).projects.locations.keyRings.cryptoKeys; | 1818 api.ProjectsLocationsKeyRingsCryptoKeysResourceApi res = |
| 1819 new api.CloudkmsApi(mock).projects.locations.keyRings.cryptoKeys; |
2024 var arg_request = buildTestIamPermissionsRequest(); | 1820 var arg_request = buildTestIamPermissionsRequest(); |
2025 var arg_resource = "foo"; | 1821 var arg_resource = "foo"; |
2026 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1822 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
2027 var obj = new api.TestIamPermissionsRequest.fromJson(json); | 1823 var obj = new api.TestIamPermissionsRequest.fromJson(json); |
2028 checkTestIamPermissionsRequest(obj); | 1824 checkTestIamPermissionsRequest(obj); |
2029 | 1825 |
2030 var path = (req.url).path; | 1826 var path = (req.url).path; |
2031 var pathOffset = 0; | 1827 var pathOffset = 0; |
2032 var index; | 1828 var index; |
2033 var subPart; | 1829 var subPart; |
2034 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1830 unittest.expect( |
| 1831 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
2035 pathOffset += 1; | 1832 pathOffset += 1; |
2036 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); | 1833 unittest.expect( |
| 1834 path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/")); |
2037 pathOffset += 3; | 1835 pathOffset += 3; |
2038 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 1836 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
2039 | 1837 |
2040 var query = (req.url).query; | 1838 var query = (req.url).query; |
2041 var queryOffset = 0; | 1839 var queryOffset = 0; |
2042 var queryMap = {}; | 1840 var queryMap = {}; |
2043 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1841 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
2044 parseBool(n) { | 1842 parseBool(n) { |
2045 if (n == "true") return true; | 1843 if (n == "true") return true; |
2046 if (n == "false") return false; | 1844 if (n == "false") return false; |
2047 if (n == null) return null; | 1845 if (n == null) return null; |
2048 throw new core.ArgumentError("Invalid boolean: $n"); | 1846 throw new core.ArgumentError("Invalid boolean: $n"); |
2049 } | 1847 } |
| 1848 |
2050 if (query.length > 0) { | 1849 if (query.length > 0) { |
2051 for (var part in query.split("&")) { | 1850 for (var part in query.split("&")) { |
2052 var keyvalue = part.split("="); | 1851 var keyvalue = part.split("="); |
2053 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1852 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1853 core.Uri.decodeQueryComponent(keyvalue[1])); |
2054 } | 1854 } |
2055 } | 1855 } |
2056 | 1856 |
2057 | |
2058 var h = { | 1857 var h = { |
2059 "content-type" : "application/json; charset=utf-8", | 1858 "content-type": "application/json; charset=utf-8", |
2060 }; | 1859 }; |
2061 var resp = convert.JSON.encode(buildTestIamPermissionsResponse()); | 1860 var resp = convert.JSON.encode(buildTestIamPermissionsResponse()); |
2062 return new async.Future.value(stringResponse(200, h, resp)); | 1861 return new async.Future.value(stringResponse(200, h, resp)); |
2063 }), true); | 1862 }), true); |
2064 res.testIamPermissions(arg_request, arg_resource).then(unittest.expectAsyn
c1(((api.TestIamPermissionsResponse response) { | 1863 res.testIamPermissions(arg_request, arg_resource).then( |
| 1864 unittest.expectAsync1(((api.TestIamPermissionsResponse response) { |
2065 checkTestIamPermissionsResponse(response); | 1865 checkTestIamPermissionsResponse(response); |
2066 }))); | 1866 }))); |
2067 }); | 1867 }); |
2068 | 1868 |
2069 unittest.test("method--updatePrimaryVersion", () { | 1869 unittest.test("method--updatePrimaryVersion", () { |
2070 | |
2071 var mock = new HttpServerMock(); | 1870 var mock = new HttpServerMock(); |
2072 api.ProjectsLocationsKeyRingsCryptoKeysResourceApi res = new api.CloudkmsA
pi(mock).projects.locations.keyRings.cryptoKeys; | 1871 api.ProjectsLocationsKeyRingsCryptoKeysResourceApi res = |
| 1872 new api.CloudkmsApi(mock).projects.locations.keyRings.cryptoKeys; |
2073 var arg_request = buildUpdateCryptoKeyPrimaryVersionRequest(); | 1873 var arg_request = buildUpdateCryptoKeyPrimaryVersionRequest(); |
2074 var arg_name = "foo"; | 1874 var arg_name = "foo"; |
2075 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1875 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
2076 var obj = new api.UpdateCryptoKeyPrimaryVersionRequest.fromJson(json); | 1876 var obj = new api.UpdateCryptoKeyPrimaryVersionRequest.fromJson(json); |
2077 checkUpdateCryptoKeyPrimaryVersionRequest(obj); | 1877 checkUpdateCryptoKeyPrimaryVersionRequest(obj); |
2078 | 1878 |
2079 var path = (req.url).path; | 1879 var path = (req.url).path; |
2080 var pathOffset = 0; | 1880 var pathOffset = 0; |
2081 var index; | 1881 var index; |
2082 var subPart; | 1882 var subPart; |
2083 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1883 unittest.expect( |
| 1884 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
2084 pathOffset += 1; | 1885 pathOffset += 1; |
2085 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); | 1886 unittest.expect( |
| 1887 path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/")); |
2086 pathOffset += 3; | 1888 pathOffset += 3; |
2087 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 1889 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
2088 | 1890 |
2089 var query = (req.url).query; | 1891 var query = (req.url).query; |
2090 var queryOffset = 0; | 1892 var queryOffset = 0; |
2091 var queryMap = {}; | 1893 var queryMap = {}; |
2092 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1894 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
2093 parseBool(n) { | 1895 parseBool(n) { |
2094 if (n == "true") return true; | 1896 if (n == "true") return true; |
2095 if (n == "false") return false; | 1897 if (n == "false") return false; |
2096 if (n == null) return null; | 1898 if (n == null) return null; |
2097 throw new core.ArgumentError("Invalid boolean: $n"); | 1899 throw new core.ArgumentError("Invalid boolean: $n"); |
2098 } | 1900 } |
| 1901 |
2099 if (query.length > 0) { | 1902 if (query.length > 0) { |
2100 for (var part in query.split("&")) { | 1903 for (var part in query.split("&")) { |
2101 var keyvalue = part.split("="); | 1904 var keyvalue = part.split("="); |
2102 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1905 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1906 core.Uri.decodeQueryComponent(keyvalue[1])); |
2103 } | 1907 } |
2104 } | 1908 } |
2105 | 1909 |
2106 | |
2107 var h = { | 1910 var h = { |
2108 "content-type" : "application/json; charset=utf-8", | 1911 "content-type": "application/json; charset=utf-8", |
2109 }; | 1912 }; |
2110 var resp = convert.JSON.encode(buildCryptoKey()); | 1913 var resp = convert.JSON.encode(buildCryptoKey()); |
2111 return new async.Future.value(stringResponse(200, h, resp)); | 1914 return new async.Future.value(stringResponse(200, h, resp)); |
2112 }), true); | 1915 }), true); |
2113 res.updatePrimaryVersion(arg_request, arg_name).then(unittest.expectAsync1
(((api.CryptoKey response) { | 1916 res |
| 1917 .updatePrimaryVersion(arg_request, arg_name) |
| 1918 .then(unittest.expectAsync1(((api.CryptoKey response) { |
2114 checkCryptoKey(response); | 1919 checkCryptoKey(response); |
2115 }))); | 1920 }))); |
2116 }); | 1921 }); |
2117 | |
2118 }); | 1922 }); |
2119 | 1923 |
2120 | 1924 unittest.group( |
2121 unittest.group("resource-ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsR
esourceApi", () { | 1925 "resource-ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsResourceApi"
, |
| 1926 () { |
2122 unittest.test("method--create", () { | 1927 unittest.test("method--create", () { |
2123 | |
2124 var mock = new HttpServerMock(); | 1928 var mock = new HttpServerMock(); |
2125 api.ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsResourceApi res =
new api.CloudkmsApi(mock).projects.locations.keyRings.cryptoKeys.cryptoKeyVersio
ns; | 1929 api.ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsResourceApi res = |
| 1930 new api.CloudkmsApi(mock) |
| 1931 .projects |
| 1932 .locations |
| 1933 .keyRings |
| 1934 .cryptoKeys |
| 1935 .cryptoKeyVersions; |
2126 var arg_request = buildCryptoKeyVersion(); | 1936 var arg_request = buildCryptoKeyVersion(); |
2127 var arg_parent = "foo"; | 1937 var arg_parent = "foo"; |
2128 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1938 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
2129 var obj = new api.CryptoKeyVersion.fromJson(json); | 1939 var obj = new api.CryptoKeyVersion.fromJson(json); |
2130 checkCryptoKeyVersion(obj); | 1940 checkCryptoKeyVersion(obj); |
2131 | 1941 |
2132 var path = (req.url).path; | 1942 var path = (req.url).path; |
2133 var pathOffset = 0; | 1943 var pathOffset = 0; |
2134 var index; | 1944 var index; |
2135 var subPart; | 1945 var subPart; |
2136 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1946 unittest.expect( |
| 1947 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
2137 pathOffset += 1; | 1948 pathOffset += 1; |
2138 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); | 1949 unittest.expect( |
| 1950 path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/")); |
2139 pathOffset += 3; | 1951 pathOffset += 3; |
2140 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 1952 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
2141 | 1953 |
2142 var query = (req.url).query; | 1954 var query = (req.url).query; |
2143 var queryOffset = 0; | 1955 var queryOffset = 0; |
2144 var queryMap = {}; | 1956 var queryMap = {}; |
2145 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1957 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
2146 parseBool(n) { | 1958 parseBool(n) { |
2147 if (n == "true") return true; | 1959 if (n == "true") return true; |
2148 if (n == "false") return false; | 1960 if (n == "false") return false; |
2149 if (n == null) return null; | 1961 if (n == null) return null; |
2150 throw new core.ArgumentError("Invalid boolean: $n"); | 1962 throw new core.ArgumentError("Invalid boolean: $n"); |
2151 } | 1963 } |
| 1964 |
2152 if (query.length > 0) { | 1965 if (query.length > 0) { |
2153 for (var part in query.split("&")) { | 1966 for (var part in query.split("&")) { |
2154 var keyvalue = part.split("="); | 1967 var keyvalue = part.split("="); |
2155 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1968 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1969 core.Uri.decodeQueryComponent(keyvalue[1])); |
2156 } | 1970 } |
2157 } | 1971 } |
2158 | 1972 |
2159 | |
2160 var h = { | 1973 var h = { |
2161 "content-type" : "application/json; charset=utf-8", | 1974 "content-type": "application/json; charset=utf-8", |
2162 }; | 1975 }; |
2163 var resp = convert.JSON.encode(buildCryptoKeyVersion()); | 1976 var resp = convert.JSON.encode(buildCryptoKeyVersion()); |
2164 return new async.Future.value(stringResponse(200, h, resp)); | 1977 return new async.Future.value(stringResponse(200, h, resp)); |
2165 }), true); | 1978 }), true); |
2166 res.create(arg_request, arg_parent).then(unittest.expectAsync1(((api.Crypt
oKeyVersion response) { | 1979 res |
| 1980 .create(arg_request, arg_parent) |
| 1981 .then(unittest.expectAsync1(((api.CryptoKeyVersion response) { |
2167 checkCryptoKeyVersion(response); | 1982 checkCryptoKeyVersion(response); |
2168 }))); | 1983 }))); |
2169 }); | 1984 }); |
2170 | 1985 |
2171 unittest.test("method--destroy", () { | 1986 unittest.test("method--destroy", () { |
2172 | |
2173 var mock = new HttpServerMock(); | 1987 var mock = new HttpServerMock(); |
2174 api.ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsResourceApi res =
new api.CloudkmsApi(mock).projects.locations.keyRings.cryptoKeys.cryptoKeyVersio
ns; | 1988 api.ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsResourceApi res = |
| 1989 new api.CloudkmsApi(mock) |
| 1990 .projects |
| 1991 .locations |
| 1992 .keyRings |
| 1993 .cryptoKeys |
| 1994 .cryptoKeyVersions; |
2175 var arg_request = buildDestroyCryptoKeyVersionRequest(); | 1995 var arg_request = buildDestroyCryptoKeyVersionRequest(); |
2176 var arg_name = "foo"; | 1996 var arg_name = "foo"; |
2177 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1997 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
2178 var obj = new api.DestroyCryptoKeyVersionRequest.fromJson(json); | 1998 var obj = new api.DestroyCryptoKeyVersionRequest.fromJson(json); |
2179 checkDestroyCryptoKeyVersionRequest(obj); | 1999 checkDestroyCryptoKeyVersionRequest(obj); |
2180 | 2000 |
2181 var path = (req.url).path; | 2001 var path = (req.url).path; |
2182 var pathOffset = 0; | 2002 var pathOffset = 0; |
2183 var index; | 2003 var index; |
2184 var subPart; | 2004 var subPart; |
2185 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 2005 unittest.expect( |
| 2006 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
2186 pathOffset += 1; | 2007 pathOffset += 1; |
2187 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); | 2008 unittest.expect( |
| 2009 path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/")); |
2188 pathOffset += 3; | 2010 pathOffset += 3; |
2189 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 2011 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
2190 | 2012 |
2191 var query = (req.url).query; | 2013 var query = (req.url).query; |
2192 var queryOffset = 0; | 2014 var queryOffset = 0; |
2193 var queryMap = {}; | 2015 var queryMap = {}; |
2194 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 2016 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
2195 parseBool(n) { | 2017 parseBool(n) { |
2196 if (n == "true") return true; | 2018 if (n == "true") return true; |
2197 if (n == "false") return false; | 2019 if (n == "false") return false; |
2198 if (n == null) return null; | 2020 if (n == null) return null; |
2199 throw new core.ArgumentError("Invalid boolean: $n"); | 2021 throw new core.ArgumentError("Invalid boolean: $n"); |
2200 } | 2022 } |
| 2023 |
2201 if (query.length > 0) { | 2024 if (query.length > 0) { |
2202 for (var part in query.split("&")) { | 2025 for (var part in query.split("&")) { |
2203 var keyvalue = part.split("="); | 2026 var keyvalue = part.split("="); |
2204 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 2027 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 2028 core.Uri.decodeQueryComponent(keyvalue[1])); |
2205 } | 2029 } |
2206 } | 2030 } |
2207 | 2031 |
2208 | |
2209 var h = { | 2032 var h = { |
2210 "content-type" : "application/json; charset=utf-8", | 2033 "content-type": "application/json; charset=utf-8", |
2211 }; | 2034 }; |
2212 var resp = convert.JSON.encode(buildCryptoKeyVersion()); | 2035 var resp = convert.JSON.encode(buildCryptoKeyVersion()); |
2213 return new async.Future.value(stringResponse(200, h, resp)); | 2036 return new async.Future.value(stringResponse(200, h, resp)); |
2214 }), true); | 2037 }), true); |
2215 res.destroy(arg_request, arg_name).then(unittest.expectAsync1(((api.Crypto
KeyVersion response) { | 2038 res |
| 2039 .destroy(arg_request, arg_name) |
| 2040 .then(unittest.expectAsync1(((api.CryptoKeyVersion response) { |
2216 checkCryptoKeyVersion(response); | 2041 checkCryptoKeyVersion(response); |
2217 }))); | 2042 }))); |
2218 }); | 2043 }); |
2219 | 2044 |
2220 unittest.test("method--get", () { | 2045 unittest.test("method--get", () { |
2221 | |
2222 var mock = new HttpServerMock(); | 2046 var mock = new HttpServerMock(); |
2223 api.ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsResourceApi res =
new api.CloudkmsApi(mock).projects.locations.keyRings.cryptoKeys.cryptoKeyVersio
ns; | 2047 api.ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsResourceApi res = |
| 2048 new api.CloudkmsApi(mock) |
| 2049 .projects |
| 2050 .locations |
| 2051 .keyRings |
| 2052 .cryptoKeys |
| 2053 .cryptoKeyVersions; |
2224 var arg_name = "foo"; | 2054 var arg_name = "foo"; |
2225 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 2055 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
2226 var path = (req.url).path; | 2056 var path = (req.url).path; |
2227 var pathOffset = 0; | 2057 var pathOffset = 0; |
2228 var index; | 2058 var index; |
2229 var subPart; | 2059 var subPart; |
2230 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 2060 unittest.expect( |
| 2061 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
2231 pathOffset += 1; | 2062 pathOffset += 1; |
2232 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); | 2063 unittest.expect( |
| 2064 path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/")); |
2233 pathOffset += 3; | 2065 pathOffset += 3; |
2234 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 2066 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
2235 | 2067 |
2236 var query = (req.url).query; | 2068 var query = (req.url).query; |
2237 var queryOffset = 0; | 2069 var queryOffset = 0; |
2238 var queryMap = {}; | 2070 var queryMap = {}; |
2239 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 2071 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
2240 parseBool(n) { | 2072 parseBool(n) { |
2241 if (n == "true") return true; | 2073 if (n == "true") return true; |
2242 if (n == "false") return false; | 2074 if (n == "false") return false; |
2243 if (n == null) return null; | 2075 if (n == null) return null; |
2244 throw new core.ArgumentError("Invalid boolean: $n"); | 2076 throw new core.ArgumentError("Invalid boolean: $n"); |
2245 } | 2077 } |
| 2078 |
2246 if (query.length > 0) { | 2079 if (query.length > 0) { |
2247 for (var part in query.split("&")) { | 2080 for (var part in query.split("&")) { |
2248 var keyvalue = part.split("="); | 2081 var keyvalue = part.split("="); |
2249 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 2082 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 2083 core.Uri.decodeQueryComponent(keyvalue[1])); |
2250 } | 2084 } |
2251 } | 2085 } |
2252 | 2086 |
2253 | |
2254 var h = { | 2087 var h = { |
2255 "content-type" : "application/json; charset=utf-8", | 2088 "content-type": "application/json; charset=utf-8", |
2256 }; | 2089 }; |
2257 var resp = convert.JSON.encode(buildCryptoKeyVersion()); | 2090 var resp = convert.JSON.encode(buildCryptoKeyVersion()); |
2258 return new async.Future.value(stringResponse(200, h, resp)); | 2091 return new async.Future.value(stringResponse(200, h, resp)); |
2259 }), true); | 2092 }), true); |
2260 res.get(arg_name).then(unittest.expectAsync1(((api.CryptoKeyVersion respon
se) { | 2093 res |
| 2094 .get(arg_name) |
| 2095 .then(unittest.expectAsync1(((api.CryptoKeyVersion response) { |
2261 checkCryptoKeyVersion(response); | 2096 checkCryptoKeyVersion(response); |
2262 }))); | 2097 }))); |
2263 }); | 2098 }); |
2264 | 2099 |
2265 unittest.test("method--list", () { | 2100 unittest.test("method--list", () { |
2266 | |
2267 var mock = new HttpServerMock(); | 2101 var mock = new HttpServerMock(); |
2268 api.ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsResourceApi res =
new api.CloudkmsApi(mock).projects.locations.keyRings.cryptoKeys.cryptoKeyVersio
ns; | 2102 api.ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsResourceApi res = |
| 2103 new api.CloudkmsApi(mock) |
| 2104 .projects |
| 2105 .locations |
| 2106 .keyRings |
| 2107 .cryptoKeys |
| 2108 .cryptoKeyVersions; |
2269 var arg_parent = "foo"; | 2109 var arg_parent = "foo"; |
| 2110 var arg_pageToken = "foo"; |
2270 var arg_pageSize = 42; | 2111 var arg_pageSize = 42; |
2271 var arg_pageToken = "foo"; | |
2272 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 2112 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
2273 var path = (req.url).path; | 2113 var path = (req.url).path; |
2274 var pathOffset = 0; | 2114 var pathOffset = 0; |
2275 var index; | 2115 var index; |
2276 var subPart; | 2116 var subPart; |
2277 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 2117 unittest.expect( |
| 2118 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
2278 pathOffset += 1; | 2119 pathOffset += 1; |
2279 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); | 2120 unittest.expect( |
| 2121 path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/")); |
2280 pathOffset += 3; | 2122 pathOffset += 3; |
2281 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 2123 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
2282 | 2124 |
2283 var query = (req.url).query; | 2125 var query = (req.url).query; |
2284 var queryOffset = 0; | 2126 var queryOffset = 0; |
2285 var queryMap = {}; | 2127 var queryMap = {}; |
2286 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 2128 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
2287 parseBool(n) { | 2129 parseBool(n) { |
2288 if (n == "true") return true; | 2130 if (n == "true") return true; |
2289 if (n == "false") return false; | 2131 if (n == "false") return false; |
2290 if (n == null) return null; | 2132 if (n == null) return null; |
2291 throw new core.ArgumentError("Invalid boolean: $n"); | 2133 throw new core.ArgumentError("Invalid boolean: $n"); |
2292 } | 2134 } |
| 2135 |
2293 if (query.length > 0) { | 2136 if (query.length > 0) { |
2294 for (var part in query.split("&")) { | 2137 for (var part in query.split("&")) { |
2295 var keyvalue = part.split("="); | 2138 var keyvalue = part.split("="); |
2296 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 2139 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 2140 core.Uri.decodeQueryComponent(keyvalue[1])); |
2297 } | 2141 } |
2298 } | 2142 } |
2299 unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equ
als(arg_pageSize)); | 2143 unittest.expect( |
2300 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); | 2144 queryMap["pageToken"].first, unittest.equals(arg_pageToken)); |
2301 | 2145 unittest.expect(core.int.parse(queryMap["pageSize"].first), |
| 2146 unittest.equals(arg_pageSize)); |
2302 | 2147 |
2303 var h = { | 2148 var h = { |
2304 "content-type" : "application/json; charset=utf-8", | 2149 "content-type": "application/json; charset=utf-8", |
2305 }; | 2150 }; |
2306 var resp = convert.JSON.encode(buildListCryptoKeyVersionsResponse()); | 2151 var resp = convert.JSON.encode(buildListCryptoKeyVersionsResponse()); |
2307 return new async.Future.value(stringResponse(200, h, resp)); | 2152 return new async.Future.value(stringResponse(200, h, resp)); |
2308 }), true); | 2153 }), true); |
2309 res.list(arg_parent, pageSize: arg_pageSize, pageToken: arg_pageToken).the
n(unittest.expectAsync1(((api.ListCryptoKeyVersionsResponse response) { | 2154 res |
| 2155 .list(arg_parent, pageToken: arg_pageToken, pageSize: arg_pageSize) |
| 2156 .then(unittest |
| 2157 .expectAsync1(((api.ListCryptoKeyVersionsResponse response) { |
2310 checkListCryptoKeyVersionsResponse(response); | 2158 checkListCryptoKeyVersionsResponse(response); |
2311 }))); | 2159 }))); |
2312 }); | 2160 }); |
2313 | 2161 |
2314 unittest.test("method--patch", () { | 2162 unittest.test("method--patch", () { |
2315 | |
2316 var mock = new HttpServerMock(); | 2163 var mock = new HttpServerMock(); |
2317 api.ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsResourceApi res =
new api.CloudkmsApi(mock).projects.locations.keyRings.cryptoKeys.cryptoKeyVersio
ns; | 2164 api.ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsResourceApi res = |
| 2165 new api.CloudkmsApi(mock) |
| 2166 .projects |
| 2167 .locations |
| 2168 .keyRings |
| 2169 .cryptoKeys |
| 2170 .cryptoKeyVersions; |
2318 var arg_request = buildCryptoKeyVersion(); | 2171 var arg_request = buildCryptoKeyVersion(); |
2319 var arg_name = "foo"; | 2172 var arg_name = "foo"; |
2320 var arg_updateMask = "foo"; | 2173 var arg_updateMask = "foo"; |
2321 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 2174 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
2322 var obj = new api.CryptoKeyVersion.fromJson(json); | 2175 var obj = new api.CryptoKeyVersion.fromJson(json); |
2323 checkCryptoKeyVersion(obj); | 2176 checkCryptoKeyVersion(obj); |
2324 | 2177 |
2325 var path = (req.url).path; | 2178 var path = (req.url).path; |
2326 var pathOffset = 0; | 2179 var pathOffset = 0; |
2327 var index; | 2180 var index; |
2328 var subPart; | 2181 var subPart; |
2329 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 2182 unittest.expect( |
| 2183 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
2330 pathOffset += 1; | 2184 pathOffset += 1; |
2331 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); | 2185 unittest.expect( |
| 2186 path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/")); |
2332 pathOffset += 3; | 2187 pathOffset += 3; |
2333 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 2188 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
2334 | 2189 |
2335 var query = (req.url).query; | 2190 var query = (req.url).query; |
2336 var queryOffset = 0; | 2191 var queryOffset = 0; |
2337 var queryMap = {}; | 2192 var queryMap = {}; |
2338 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 2193 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
2339 parseBool(n) { | 2194 parseBool(n) { |
2340 if (n == "true") return true; | 2195 if (n == "true") return true; |
2341 if (n == "false") return false; | 2196 if (n == "false") return false; |
2342 if (n == null) return null; | 2197 if (n == null) return null; |
2343 throw new core.ArgumentError("Invalid boolean: $n"); | 2198 throw new core.ArgumentError("Invalid boolean: $n"); |
2344 } | 2199 } |
| 2200 |
2345 if (query.length > 0) { | 2201 if (query.length > 0) { |
2346 for (var part in query.split("&")) { | 2202 for (var part in query.split("&")) { |
2347 var keyvalue = part.split("="); | 2203 var keyvalue = part.split("="); |
2348 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 2204 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 2205 core.Uri.decodeQueryComponent(keyvalue[1])); |
2349 } | 2206 } |
2350 } | 2207 } |
2351 unittest.expect(queryMap["updateMask"].first, unittest.equals(arg_update
Mask)); | 2208 unittest.expect( |
2352 | 2209 queryMap["updateMask"].first, unittest.equals(arg_updateMask)); |
2353 | 2210 |
2354 var h = { | 2211 var h = { |
2355 "content-type" : "application/json; charset=utf-8", | 2212 "content-type": "application/json; charset=utf-8", |
2356 }; | 2213 }; |
2357 var resp = convert.JSON.encode(buildCryptoKeyVersion()); | 2214 var resp = convert.JSON.encode(buildCryptoKeyVersion()); |
2358 return new async.Future.value(stringResponse(200, h, resp)); | 2215 return new async.Future.value(stringResponse(200, h, resp)); |
2359 }), true); | 2216 }), true); |
2360 res.patch(arg_request, arg_name, updateMask: arg_updateMask).then(unittest
.expectAsync1(((api.CryptoKeyVersion response) { | 2217 res |
| 2218 .patch(arg_request, arg_name, updateMask: arg_updateMask) |
| 2219 .then(unittest.expectAsync1(((api.CryptoKeyVersion response) { |
2361 checkCryptoKeyVersion(response); | 2220 checkCryptoKeyVersion(response); |
2362 }))); | 2221 }))); |
2363 }); | 2222 }); |
2364 | 2223 |
2365 unittest.test("method--restore", () { | 2224 unittest.test("method--restore", () { |
2366 | |
2367 var mock = new HttpServerMock(); | 2225 var mock = new HttpServerMock(); |
2368 api.ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsResourceApi res =
new api.CloudkmsApi(mock).projects.locations.keyRings.cryptoKeys.cryptoKeyVersio
ns; | 2226 api.ProjectsLocationsKeyRingsCryptoKeysCryptoKeyVersionsResourceApi res = |
| 2227 new api.CloudkmsApi(mock) |
| 2228 .projects |
| 2229 .locations |
| 2230 .keyRings |
| 2231 .cryptoKeys |
| 2232 .cryptoKeyVersions; |
2369 var arg_request = buildRestoreCryptoKeyVersionRequest(); | 2233 var arg_request = buildRestoreCryptoKeyVersionRequest(); |
2370 var arg_name = "foo"; | 2234 var arg_name = "foo"; |
2371 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 2235 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
2372 var obj = new api.RestoreCryptoKeyVersionRequest.fromJson(json); | 2236 var obj = new api.RestoreCryptoKeyVersionRequest.fromJson(json); |
2373 checkRestoreCryptoKeyVersionRequest(obj); | 2237 checkRestoreCryptoKeyVersionRequest(obj); |
2374 | 2238 |
2375 var path = (req.url).path; | 2239 var path = (req.url).path; |
2376 var pathOffset = 0; | 2240 var pathOffset = 0; |
2377 var index; | 2241 var index; |
2378 var subPart; | 2242 var subPart; |
2379 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 2243 unittest.expect( |
| 2244 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
2380 pathOffset += 1; | 2245 pathOffset += 1; |
2381 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); | 2246 unittest.expect( |
| 2247 path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/")); |
2382 pathOffset += 3; | 2248 pathOffset += 3; |
2383 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 2249 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
2384 | 2250 |
2385 var query = (req.url).query; | 2251 var query = (req.url).query; |
2386 var queryOffset = 0; | 2252 var queryOffset = 0; |
2387 var queryMap = {}; | 2253 var queryMap = {}; |
2388 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 2254 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
2389 parseBool(n) { | 2255 parseBool(n) { |
2390 if (n == "true") return true; | 2256 if (n == "true") return true; |
2391 if (n == "false") return false; | 2257 if (n == "false") return false; |
2392 if (n == null) return null; | 2258 if (n == null) return null; |
2393 throw new core.ArgumentError("Invalid boolean: $n"); | 2259 throw new core.ArgumentError("Invalid boolean: $n"); |
2394 } | 2260 } |
| 2261 |
2395 if (query.length > 0) { | 2262 if (query.length > 0) { |
2396 for (var part in query.split("&")) { | 2263 for (var part in query.split("&")) { |
2397 var keyvalue = part.split("="); | 2264 var keyvalue = part.split("="); |
2398 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 2265 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 2266 core.Uri.decodeQueryComponent(keyvalue[1])); |
2399 } | 2267 } |
2400 } | 2268 } |
2401 | 2269 |
2402 | |
2403 var h = { | 2270 var h = { |
2404 "content-type" : "application/json; charset=utf-8", | 2271 "content-type": "application/json; charset=utf-8", |
2405 }; | 2272 }; |
2406 var resp = convert.JSON.encode(buildCryptoKeyVersion()); | 2273 var resp = convert.JSON.encode(buildCryptoKeyVersion()); |
2407 return new async.Future.value(stringResponse(200, h, resp)); | 2274 return new async.Future.value(stringResponse(200, h, resp)); |
2408 }), true); | 2275 }), true); |
2409 res.restore(arg_request, arg_name).then(unittest.expectAsync1(((api.Crypto
KeyVersion response) { | 2276 res |
| 2277 .restore(arg_request, arg_name) |
| 2278 .then(unittest.expectAsync1(((api.CryptoKeyVersion response) { |
2410 checkCryptoKeyVersion(response); | 2279 checkCryptoKeyVersion(response); |
2411 }))); | 2280 }))); |
2412 }); | 2281 }); |
2413 | |
2414 }); | 2282 }); |
2415 | |
2416 | |
2417 } | 2283 } |
2418 | |
OLD | NEW |