blob: 80dd706a3cae817e484b7bfd736e3e6d6dfcf22e [file] [log] [blame]
Kevin Mooreaf84e102021-02-25 10:29:32 -08001// ignore_for_file: avoid_returning_null
Kevin Moore6d21e902021-01-15 06:41:08 -08002// ignore_for_file: camel_case_types
Kevin Mooreaf84e102021-02-25 10:29:32 -08003// ignore_for_file: cascade_invocations
Kevin Moore6d21e902021-01-15 06:41:08 -08004// ignore_for_file: comment_references
Kevin Moore1ad61ef2021-01-22 17:52:58 -08005// ignore_for_file: file_names
Kevin Moore6d21e902021-01-15 06:41:08 -08006// ignore_for_file: library_names
7// ignore_for_file: lines_longer_than_80_chars
8// ignore_for_file: non_constant_identifier_names
Kevin Moore1ad61ef2021-01-22 17:52:58 -08009// ignore_for_file: prefer_expression_function_bodies
Kevin Mooreaf84e102021-02-25 10:29:32 -080010// ignore_for_file: prefer_final_locals
Kevin Moore6d21e902021-01-15 06:41:08 -080011// ignore_for_file: prefer_interpolation_to_compose_strings
Kevin Mooreaf84e102021-02-25 10:29:32 -080012// ignore_for_file: prefer_single_quotes
Kevin Moore6d21e902021-01-15 06:41:08 -080013// ignore_for_file: unnecessary_brace_in_string_interps
14// ignore_for_file: unnecessary_cast
Kevin Moore1ad61ef2021-01-22 17:52:58 -080015// ignore_for_file: unnecessary_lambdas
Kevin Moore6d21e902021-01-15 06:41:08 -080016// ignore_for_file: unnecessary_parenthesis
17// ignore_for_file: unnecessary_string_interpolations
Kevin Moore6d21e902021-01-15 06:41:08 -080018// ignore_for_file: unused_local_variable
19
Kevin Moore2282df32021-01-27 19:15:24 -080020import 'dart:async' as async;
21import 'dart:convert' as convert;
22import 'dart:core' as core;
Martin Kustermannf6325572016-03-14 14:25:28 +010023
24import 'package:http/http.dart' as http;
Martin Kustermann3953f0d2017-06-12 16:59:53 +020025import 'package:test/test.dart' as unittest;
Martin Kustermannf6325572016-03-14 14:25:28 +010026import 'package:googleapis/cloudresourcemanager/v1.dart' as api;
27
Kevin Moore2282df32021-01-27 19:15:24 -080028import '../test_shared.dart';
Martin Kustermannf6325572016-03-14 14:25:28 +010029
Martin Kustermannb25a7842016-12-13 16:42:27 +010030core.int buildCounterAncestor = 0;
Kevin Moore6d21e902021-01-15 06:41:08 -080031api.Ancestor buildAncestor() {
32 var o = api.Ancestor();
Martin Kustermannb25a7842016-12-13 16:42:27 +010033 buildCounterAncestor++;
34 if (buildCounterAncestor < 3) {
35 o.resourceId = buildResourceId();
36 }
37 buildCounterAncestor--;
38 return o;
39}
40
Kevin Moore6d21e902021-01-15 06:41:08 -080041void checkAncestor(api.Ancestor o) {
Martin Kustermannb25a7842016-12-13 16:42:27 +010042 buildCounterAncestor++;
43 if (buildCounterAncestor < 3) {
Kevin Moore58e22332021-02-25 10:11:41 -080044 checkResourceId(o.resourceId! as api.ResourceId);
Martin Kustermannb25a7842016-12-13 16:42:27 +010045 }
46 buildCounterAncestor--;
47}
48
Kevin Moore64f78622021-03-01 17:42:54 -080049core.List<api.AuditLogConfig> buildUnnamed3272() {
Kevin Moore6d21e902021-01-15 06:41:08 -080050 var o = <api.AuditLogConfig>[];
Martin Kustermanna6d0a322017-03-27 13:52:31 +020051 o.add(buildAuditLogConfig());
52 o.add(buildAuditLogConfig());
53 return o;
54}
55
Kevin Moore64f78622021-03-01 17:42:54 -080056void checkUnnamed3272(core.List<api.AuditLogConfig> o) {
Martin Kustermanna6d0a322017-03-27 13:52:31 +020057 unittest.expect(o, unittest.hasLength(2));
Kevin Moorec4dbd8e2021-01-26 14:40:35 -080058 checkAuditLogConfig(o[0] as api.AuditLogConfig);
59 checkAuditLogConfig(o[1] as api.AuditLogConfig);
Martin Kustermanna6d0a322017-03-27 13:52:31 +020060}
61
62core.int buildCounterAuditConfig = 0;
Kevin Moore6d21e902021-01-15 06:41:08 -080063api.AuditConfig buildAuditConfig() {
64 var o = api.AuditConfig();
Martin Kustermanna6d0a322017-03-27 13:52:31 +020065 buildCounterAuditConfig++;
66 if (buildCounterAuditConfig < 3) {
Kevin Moore64f78622021-03-01 17:42:54 -080067 o.auditLogConfigs = buildUnnamed3272();
Kevin Moored0251702021-01-15 06:41:08 -080068 o.service = 'foo';
Martin Kustermanna6d0a322017-03-27 13:52:31 +020069 }
70 buildCounterAuditConfig--;
71 return o;
72}
73
Kevin Moore6d21e902021-01-15 06:41:08 -080074void checkAuditConfig(api.AuditConfig o) {
Martin Kustermanna6d0a322017-03-27 13:52:31 +020075 buildCounterAuditConfig++;
76 if (buildCounterAuditConfig < 3) {
Kevin Moore64f78622021-03-01 17:42:54 -080077 checkUnnamed3272(o.auditLogConfigs!);
Kevin Moore58e22332021-02-25 10:11:41 -080078 unittest.expect(
79 o.service!,
80 unittest.equals('foo'),
81 );
Martin Kustermanna6d0a322017-03-27 13:52:31 +020082 }
83 buildCounterAuditConfig--;
84}
85
Kevin Mooreb3758bc2021-02-25 10:03:59 -080086core.List<core.String> buildUnnamed3273() {
Kevin Moore6d21e902021-01-15 06:41:08 -080087 var o = <core.String>[];
Kevin Moored0251702021-01-15 06:41:08 -080088 o.add('foo');
89 o.add('foo');
Martin Kustermannc95693d2017-04-18 12:30:00 +020090 return o;
91}
92
Kevin Mooreb3758bc2021-02-25 10:03:59 -080093void checkUnnamed3273(core.List<core.String> o) {
Martin Kustermannc95693d2017-04-18 12:30:00 +020094 unittest.expect(o, unittest.hasLength(2));
Kevin Moore58e22332021-02-25 10:11:41 -080095 unittest.expect(
96 o[0],
97 unittest.equals('foo'),
98 );
99 unittest.expect(
100 o[1],
101 unittest.equals('foo'),
102 );
Martin Kustermannc95693d2017-04-18 12:30:00 +0200103}
104
Kevin Moore64f78622021-03-01 17:42:54 -0800105core.int buildCounterAuditLogConfig = 0;
106api.AuditLogConfig buildAuditLogConfig() {
107 var o = api.AuditLogConfig();
108 buildCounterAuditLogConfig++;
109 if (buildCounterAuditLogConfig < 3) {
110 o.exemptedMembers = buildUnnamed3273();
111 o.logType = 'foo';
112 }
113 buildCounterAuditLogConfig--;
114 return o;
115}
116
117void checkAuditLogConfig(api.AuditLogConfig o) {
118 buildCounterAuditLogConfig++;
119 if (buildCounterAuditLogConfig < 3) {
120 checkUnnamed3273(o.exemptedMembers!);
121 unittest.expect(
122 o.logType!,
123 unittest.equals('foo'),
124 );
125 }
126 buildCounterAuditLogConfig--;
127}
128
129core.List<core.String> buildUnnamed3274() {
130 var o = <core.String>[];
131 o.add('foo');
132 o.add('foo');
133 return o;
134}
135
136void checkUnnamed3274(core.List<core.String> o) {
137 unittest.expect(o, unittest.hasLength(2));
138 unittest.expect(
139 o[0],
140 unittest.equals('foo'),
141 );
142 unittest.expect(
143 o[1],
144 unittest.equals('foo'),
145 );
146}
147
Martin Kustermannf6325572016-03-14 14:25:28 +0100148core.int buildCounterBinding = 0;
Kevin Moore6d21e902021-01-15 06:41:08 -0800149api.Binding buildBinding() {
150 var o = api.Binding();
Martin Kustermannf6325572016-03-14 14:25:28 +0100151 buildCounterBinding++;
152 if (buildCounterBinding < 3) {
Martin Kustermann12cdd522018-08-27 10:46:50 +0200153 o.condition = buildExpr();
Kevin Moore64f78622021-03-01 17:42:54 -0800154 o.members = buildUnnamed3274();
Kevin Moored0251702021-01-15 06:41:08 -0800155 o.role = 'foo';
Martin Kustermannf6325572016-03-14 14:25:28 +0100156 }
157 buildCounterBinding--;
158 return o;
159}
160
Kevin Moore6d21e902021-01-15 06:41:08 -0800161void checkBinding(api.Binding o) {
Martin Kustermannf6325572016-03-14 14:25:28 +0100162 buildCounterBinding++;
163 if (buildCounterBinding < 3) {
Kevin Moore58e22332021-02-25 10:11:41 -0800164 checkExpr(o.condition! as api.Expr);
Kevin Moore64f78622021-03-01 17:42:54 -0800165 checkUnnamed3274(o.members!);
Kevin Moore58e22332021-02-25 10:11:41 -0800166 unittest.expect(
167 o.role!,
168 unittest.equals('foo'),
169 );
Martin Kustermannf6325572016-03-14 14:25:28 +0100170 }
171 buildCounterBinding--;
172}
173
Martin Kustermanna6d0a322017-03-27 13:52:31 +0200174core.int buildCounterBooleanConstraint = 0;
Kevin Moore6d21e902021-01-15 06:41:08 -0800175api.BooleanConstraint buildBooleanConstraint() {
176 var o = api.BooleanConstraint();
Martin Kustermanna6d0a322017-03-27 13:52:31 +0200177 buildCounterBooleanConstraint++;
Martin Kustermann5eb85c12017-09-11 12:35:54 +0200178 if (buildCounterBooleanConstraint < 3) {}
Martin Kustermanna6d0a322017-03-27 13:52:31 +0200179 buildCounterBooleanConstraint--;
180 return o;
181}
182
Kevin Moore6d21e902021-01-15 06:41:08 -0800183void checkBooleanConstraint(api.BooleanConstraint o) {
Martin Kustermanna6d0a322017-03-27 13:52:31 +0200184 buildCounterBooleanConstraint++;
Martin Kustermann5eb85c12017-09-11 12:35:54 +0200185 if (buildCounterBooleanConstraint < 3) {}
Martin Kustermanna6d0a322017-03-27 13:52:31 +0200186 buildCounterBooleanConstraint--;
187}
188
189core.int buildCounterBooleanPolicy = 0;
Kevin Moore6d21e902021-01-15 06:41:08 -0800190api.BooleanPolicy buildBooleanPolicy() {
191 var o = api.BooleanPolicy();
Martin Kustermanna6d0a322017-03-27 13:52:31 +0200192 buildCounterBooleanPolicy++;
193 if (buildCounterBooleanPolicy < 3) {
194 o.enforced = true;
195 }
196 buildCounterBooleanPolicy--;
197 return o;
198}
199
Kevin Moore6d21e902021-01-15 06:41:08 -0800200void checkBooleanPolicy(api.BooleanPolicy o) {
Martin Kustermanna6d0a322017-03-27 13:52:31 +0200201 buildCounterBooleanPolicy++;
202 if (buildCounterBooleanPolicy < 3) {
Kevin Moore58e22332021-02-25 10:11:41 -0800203 unittest.expect(o.enforced!, unittest.isTrue);
Martin Kustermanna6d0a322017-03-27 13:52:31 +0200204 }
205 buildCounterBooleanPolicy--;
206}
207
208core.int buildCounterClearOrgPolicyRequest = 0;
Kevin Moore6d21e902021-01-15 06:41:08 -0800209api.ClearOrgPolicyRequest buildClearOrgPolicyRequest() {
210 var o = api.ClearOrgPolicyRequest();
Martin Kustermanna6d0a322017-03-27 13:52:31 +0200211 buildCounterClearOrgPolicyRequest++;
212 if (buildCounterClearOrgPolicyRequest < 3) {
Kevin Moored0251702021-01-15 06:41:08 -0800213 o.constraint = 'foo';
214 o.etag = 'foo';
Martin Kustermanna6d0a322017-03-27 13:52:31 +0200215 }
216 buildCounterClearOrgPolicyRequest--;
217 return o;
218}
219
Kevin Moore6d21e902021-01-15 06:41:08 -0800220void checkClearOrgPolicyRequest(api.ClearOrgPolicyRequest o) {
Martin Kustermanna6d0a322017-03-27 13:52:31 +0200221 buildCounterClearOrgPolicyRequest++;
222 if (buildCounterClearOrgPolicyRequest < 3) {
Kevin Moore58e22332021-02-25 10:11:41 -0800223 unittest.expect(
224 o.constraint!,
225 unittest.equals('foo'),
226 );
227 unittest.expect(
228 o.etag!,
229 unittest.equals('foo'),
230 );
Martin Kustermanna6d0a322017-03-27 13:52:31 +0200231 }
232 buildCounterClearOrgPolicyRequest--;
233}
234
Kevin Moore0946dce2021-02-04 09:58:04 -0800235core.int
236 buildCounterCloudresourcemanagerGoogleCloudResourcemanagerV2alpha1FolderOperation =
237 0;
238api.CloudresourcemanagerGoogleCloudResourcemanagerV2alpha1FolderOperation
239 buildCloudresourcemanagerGoogleCloudResourcemanagerV2alpha1FolderOperation() {
240 var o = api
241 .CloudresourcemanagerGoogleCloudResourcemanagerV2alpha1FolderOperation();
242 buildCounterCloudresourcemanagerGoogleCloudResourcemanagerV2alpha1FolderOperation++;
243 if (buildCounterCloudresourcemanagerGoogleCloudResourcemanagerV2alpha1FolderOperation <
244 3) {
245 o.destinationParent = 'foo';
246 o.displayName = 'foo';
247 o.operationType = 'foo';
248 o.sourceParent = 'foo';
249 }
250 buildCounterCloudresourcemanagerGoogleCloudResourcemanagerV2alpha1FolderOperation--;
251 return o;
252}
253
254void checkCloudresourcemanagerGoogleCloudResourcemanagerV2alpha1FolderOperation(
255 api.CloudresourcemanagerGoogleCloudResourcemanagerV2alpha1FolderOperation
256 o) {
257 buildCounterCloudresourcemanagerGoogleCloudResourcemanagerV2alpha1FolderOperation++;
258 if (buildCounterCloudresourcemanagerGoogleCloudResourcemanagerV2alpha1FolderOperation <
259 3) {
Kevin Moore58e22332021-02-25 10:11:41 -0800260 unittest.expect(
261 o.destinationParent!,
262 unittest.equals('foo'),
263 );
264 unittest.expect(
265 o.displayName!,
266 unittest.equals('foo'),
267 );
268 unittest.expect(
269 o.operationType!,
270 unittest.equals('foo'),
271 );
272 unittest.expect(
273 o.sourceParent!,
274 unittest.equals('foo'),
275 );
Kevin Moore0946dce2021-02-04 09:58:04 -0800276 }
277 buildCounterCloudresourcemanagerGoogleCloudResourcemanagerV2alpha1FolderOperation--;
278}
279
280core.int
281 buildCounterCloudresourcemanagerGoogleCloudResourcemanagerV2beta1FolderOperation =
282 0;
283api.CloudresourcemanagerGoogleCloudResourcemanagerV2beta1FolderOperation
284 buildCloudresourcemanagerGoogleCloudResourcemanagerV2beta1FolderOperation() {
285 var o = api
286 .CloudresourcemanagerGoogleCloudResourcemanagerV2beta1FolderOperation();
287 buildCounterCloudresourcemanagerGoogleCloudResourcemanagerV2beta1FolderOperation++;
288 if (buildCounterCloudresourcemanagerGoogleCloudResourcemanagerV2beta1FolderOperation <
289 3) {
290 o.destinationParent = 'foo';
291 o.displayName = 'foo';
292 o.operationType = 'foo';
293 o.sourceParent = 'foo';
294 }
295 buildCounterCloudresourcemanagerGoogleCloudResourcemanagerV2beta1FolderOperation--;
296 return o;
297}
298
299void checkCloudresourcemanagerGoogleCloudResourcemanagerV2beta1FolderOperation(
300 api.CloudresourcemanagerGoogleCloudResourcemanagerV2beta1FolderOperation
301 o) {
302 buildCounterCloudresourcemanagerGoogleCloudResourcemanagerV2beta1FolderOperation++;
303 if (buildCounterCloudresourcemanagerGoogleCloudResourcemanagerV2beta1FolderOperation <
304 3) {
Kevin Moore58e22332021-02-25 10:11:41 -0800305 unittest.expect(
306 o.destinationParent!,
307 unittest.equals('foo'),
308 );
309 unittest.expect(
310 o.displayName!,
311 unittest.equals('foo'),
312 );
313 unittest.expect(
314 o.operationType!,
315 unittest.equals('foo'),
316 );
317 unittest.expect(
318 o.sourceParent!,
319 unittest.equals('foo'),
320 );
Kevin Moore0946dce2021-02-04 09:58:04 -0800321 }
322 buildCounterCloudresourcemanagerGoogleCloudResourcemanagerV2beta1FolderOperation--;
323}
324
Martin Kustermanna6d0a322017-03-27 13:52:31 +0200325core.int buildCounterConstraint = 0;
Kevin Moore6d21e902021-01-15 06:41:08 -0800326api.Constraint buildConstraint() {
327 var o = api.Constraint();
Martin Kustermanna6d0a322017-03-27 13:52:31 +0200328 buildCounterConstraint++;
329 if (buildCounterConstraint < 3) {
330 o.booleanConstraint = buildBooleanConstraint();
Kevin Moored0251702021-01-15 06:41:08 -0800331 o.constraintDefault = 'foo';
332 o.description = 'foo';
333 o.displayName = 'foo';
Martin Kustermanna6d0a322017-03-27 13:52:31 +0200334 o.listConstraint = buildListConstraint();
Kevin Moored0251702021-01-15 06:41:08 -0800335 o.name = 'foo';
Martin Kustermanna6d0a322017-03-27 13:52:31 +0200336 o.version = 42;
337 }
338 buildCounterConstraint--;
339 return o;
340}
341
Kevin Moore6d21e902021-01-15 06:41:08 -0800342void checkConstraint(api.Constraint o) {
Martin Kustermanna6d0a322017-03-27 13:52:31 +0200343 buildCounterConstraint++;
344 if (buildCounterConstraint < 3) {
Kevin Moore58e22332021-02-25 10:11:41 -0800345 checkBooleanConstraint(o.booleanConstraint! as api.BooleanConstraint);
346 unittest.expect(
347 o.constraintDefault!,
348 unittest.equals('foo'),
349 );
350 unittest.expect(
351 o.description!,
352 unittest.equals('foo'),
353 );
354 unittest.expect(
355 o.displayName!,
356 unittest.equals('foo'),
357 );
358 checkListConstraint(o.listConstraint! as api.ListConstraint);
359 unittest.expect(
360 o.name!,
361 unittest.equals('foo'),
362 );
363 unittest.expect(
364 o.version!,
365 unittest.equals(42),
366 );
Martin Kustermanna6d0a322017-03-27 13:52:31 +0200367 }
368 buildCounterConstraint--;
369}
370
Kevin Moore0946dce2021-02-04 09:58:04 -0800371core.int buildCounterCreateTagKeyMetadata = 0;
372api.CreateTagKeyMetadata buildCreateTagKeyMetadata() {
373 var o = api.CreateTagKeyMetadata();
374 buildCounterCreateTagKeyMetadata++;
375 if (buildCounterCreateTagKeyMetadata < 3) {}
376 buildCounterCreateTagKeyMetadata--;
377 return o;
378}
379
380void checkCreateTagKeyMetadata(api.CreateTagKeyMetadata o) {
381 buildCounterCreateTagKeyMetadata++;
382 if (buildCounterCreateTagKeyMetadata < 3) {}
383 buildCounterCreateTagKeyMetadata--;
384}
385
386core.int buildCounterCreateTagValueMetadata = 0;
387api.CreateTagValueMetadata buildCreateTagValueMetadata() {
388 var o = api.CreateTagValueMetadata();
389 buildCounterCreateTagValueMetadata++;
390 if (buildCounterCreateTagValueMetadata < 3) {}
391 buildCounterCreateTagValueMetadata--;
392 return o;
393}
394
395void checkCreateTagValueMetadata(api.CreateTagValueMetadata o) {
396 buildCounterCreateTagValueMetadata++;
397 if (buildCounterCreateTagValueMetadata < 3) {}
398 buildCounterCreateTagValueMetadata--;
399}
400
Kevin Moore0946dce2021-02-04 09:58:04 -0800401core.int buildCounterDeleteTagKeyMetadata = 0;
402api.DeleteTagKeyMetadata buildDeleteTagKeyMetadata() {
403 var o = api.DeleteTagKeyMetadata();
404 buildCounterDeleteTagKeyMetadata++;
405 if (buildCounterDeleteTagKeyMetadata < 3) {}
406 buildCounterDeleteTagKeyMetadata--;
407 return o;
408}
409
410void checkDeleteTagKeyMetadata(api.DeleteTagKeyMetadata o) {
411 buildCounterDeleteTagKeyMetadata++;
412 if (buildCounterDeleteTagKeyMetadata < 3) {}
413 buildCounterDeleteTagKeyMetadata--;
414}
415
416core.int buildCounterDeleteTagValueMetadata = 0;
417api.DeleteTagValueMetadata buildDeleteTagValueMetadata() {
418 var o = api.DeleteTagValueMetadata();
419 buildCounterDeleteTagValueMetadata++;
420 if (buildCounterDeleteTagValueMetadata < 3) {}
421 buildCounterDeleteTagValueMetadata--;
422 return o;
423}
424
425void checkDeleteTagValueMetadata(api.DeleteTagValueMetadata o) {
426 buildCounterDeleteTagValueMetadata++;
427 if (buildCounterDeleteTagValueMetadata < 3) {}
428 buildCounterDeleteTagValueMetadata--;
429}
430
Martin Kustermannf6325572016-03-14 14:25:28 +0100431core.int buildCounterEmpty = 0;
Kevin Moore6d21e902021-01-15 06:41:08 -0800432api.Empty buildEmpty() {
433 var o = api.Empty();
Martin Kustermannf6325572016-03-14 14:25:28 +0100434 buildCounterEmpty++;
Martin Kustermann5eb85c12017-09-11 12:35:54 +0200435 if (buildCounterEmpty < 3) {}
Martin Kustermannf6325572016-03-14 14:25:28 +0100436 buildCounterEmpty--;
437 return o;
438}
439
Kevin Moore6d21e902021-01-15 06:41:08 -0800440void checkEmpty(api.Empty o) {
Martin Kustermannf6325572016-03-14 14:25:28 +0100441 buildCounterEmpty++;
Martin Kustermann5eb85c12017-09-11 12:35:54 +0200442 if (buildCounterEmpty < 3) {}
Martin Kustermannf6325572016-03-14 14:25:28 +0100443 buildCounterEmpty--;
444}
445
Martin Kustermann12cdd522018-08-27 10:46:50 +0200446core.int buildCounterExpr = 0;
Kevin Moore6d21e902021-01-15 06:41:08 -0800447api.Expr buildExpr() {
448 var o = api.Expr();
Martin Kustermann12cdd522018-08-27 10:46:50 +0200449 buildCounterExpr++;
450 if (buildCounterExpr < 3) {
Kevin Moored0251702021-01-15 06:41:08 -0800451 o.description = 'foo';
452 o.expression = 'foo';
453 o.location = 'foo';
454 o.title = 'foo';
Martin Kustermann12cdd522018-08-27 10:46:50 +0200455 }
456 buildCounterExpr--;
457 return o;
458}
459
Kevin Moore6d21e902021-01-15 06:41:08 -0800460void checkExpr(api.Expr o) {
Martin Kustermann12cdd522018-08-27 10:46:50 +0200461 buildCounterExpr++;
462 if (buildCounterExpr < 3) {
Kevin Moore58e22332021-02-25 10:11:41 -0800463 unittest.expect(
464 o.description!,
465 unittest.equals('foo'),
466 );
467 unittest.expect(
468 o.expression!,
469 unittest.equals('foo'),
470 );
471 unittest.expect(
472 o.location!,
473 unittest.equals('foo'),
474 );
475 unittest.expect(
476 o.title!,
477 unittest.equals('foo'),
478 );
Martin Kustermann12cdd522018-08-27 10:46:50 +0200479 }
480 buildCounterExpr--;
481}
482
Martin Kustermann4ff71db2016-11-09 10:46:40 +0100483core.int buildCounterFolderOperation = 0;
Kevin Moore6d21e902021-01-15 06:41:08 -0800484api.FolderOperation buildFolderOperation() {
485 var o = api.FolderOperation();
Martin Kustermann4ff71db2016-11-09 10:46:40 +0100486 buildCounterFolderOperation++;
487 if (buildCounterFolderOperation < 3) {
Kevin Moored0251702021-01-15 06:41:08 -0800488 o.destinationParent = 'foo';
489 o.displayName = 'foo';
490 o.operationType = 'foo';
491 o.sourceParent = 'foo';
Martin Kustermann4ff71db2016-11-09 10:46:40 +0100492 }
493 buildCounterFolderOperation--;
494 return o;
495}
496
Kevin Moore6d21e902021-01-15 06:41:08 -0800497void checkFolderOperation(api.FolderOperation o) {
Martin Kustermann4ff71db2016-11-09 10:46:40 +0100498 buildCounterFolderOperation++;
499 if (buildCounterFolderOperation < 3) {
Kevin Moore58e22332021-02-25 10:11:41 -0800500 unittest.expect(
501 o.destinationParent!,
502 unittest.equals('foo'),
503 );
504 unittest.expect(
505 o.displayName!,
506 unittest.equals('foo'),
507 );
508 unittest.expect(
509 o.operationType!,
510 unittest.equals('foo'),
511 );
512 unittest.expect(
513 o.sourceParent!,
514 unittest.equals('foo'),
515 );
Martin Kustermann4ff71db2016-11-09 10:46:40 +0100516 }
517 buildCounterFolderOperation--;
518}
519
520core.int buildCounterFolderOperationError = 0;
Kevin Moore6d21e902021-01-15 06:41:08 -0800521api.FolderOperationError buildFolderOperationError() {
522 var o = api.FolderOperationError();
Martin Kustermann4ff71db2016-11-09 10:46:40 +0100523 buildCounterFolderOperationError++;
524 if (buildCounterFolderOperationError < 3) {
Kevin Moored0251702021-01-15 06:41:08 -0800525 o.errorMessageId = 'foo';
Martin Kustermann4ff71db2016-11-09 10:46:40 +0100526 }
527 buildCounterFolderOperationError--;
528 return o;
529}
530
Kevin Moore6d21e902021-01-15 06:41:08 -0800531void checkFolderOperationError(api.FolderOperationError o) {
Martin Kustermann4ff71db2016-11-09 10:46:40 +0100532 buildCounterFolderOperationError++;
533 if (buildCounterFolderOperationError < 3) {
Kevin Moore58e22332021-02-25 10:11:41 -0800534 unittest.expect(
535 o.errorMessageId!,
536 unittest.equals('foo'),
537 );
Martin Kustermann4ff71db2016-11-09 10:46:40 +0100538 }
539 buildCounterFolderOperationError--;
540}
541
Martin Kustermannb25a7842016-12-13 16:42:27 +0100542core.int buildCounterGetAncestryRequest = 0;
Kevin Moore6d21e902021-01-15 06:41:08 -0800543api.GetAncestryRequest buildGetAncestryRequest() {
544 var o = api.GetAncestryRequest();
Martin Kustermannb25a7842016-12-13 16:42:27 +0100545 buildCounterGetAncestryRequest++;
Martin Kustermann5eb85c12017-09-11 12:35:54 +0200546 if (buildCounterGetAncestryRequest < 3) {}
Martin Kustermannb25a7842016-12-13 16:42:27 +0100547 buildCounterGetAncestryRequest--;
548 return o;
549}
550
Kevin Moore6d21e902021-01-15 06:41:08 -0800551void checkGetAncestryRequest(api.GetAncestryRequest o) {
Martin Kustermannb25a7842016-12-13 16:42:27 +0100552 buildCounterGetAncestryRequest++;
Martin Kustermann5eb85c12017-09-11 12:35:54 +0200553 if (buildCounterGetAncestryRequest < 3) {}
Martin Kustermannb25a7842016-12-13 16:42:27 +0100554 buildCounterGetAncestryRequest--;
555}
556
Kevin Moore64f78622021-03-01 17:42:54 -0800557core.List<api.Ancestor> buildUnnamed3275() {
Kevin Moore6d21e902021-01-15 06:41:08 -0800558 var o = <api.Ancestor>[];
Martin Kustermannb25a7842016-12-13 16:42:27 +0100559 o.add(buildAncestor());
560 o.add(buildAncestor());
561 return o;
562}
563
Kevin Moore64f78622021-03-01 17:42:54 -0800564void checkUnnamed3275(core.List<api.Ancestor> o) {
Martin Kustermannb25a7842016-12-13 16:42:27 +0100565 unittest.expect(o, unittest.hasLength(2));
Kevin Moorec4dbd8e2021-01-26 14:40:35 -0800566 checkAncestor(o[0] as api.Ancestor);
567 checkAncestor(o[1] as api.Ancestor);
Martin Kustermannb25a7842016-12-13 16:42:27 +0100568}
569
570core.int buildCounterGetAncestryResponse = 0;
Kevin Moore6d21e902021-01-15 06:41:08 -0800571api.GetAncestryResponse buildGetAncestryResponse() {
572 var o = api.GetAncestryResponse();
Martin Kustermannb25a7842016-12-13 16:42:27 +0100573 buildCounterGetAncestryResponse++;
574 if (buildCounterGetAncestryResponse < 3) {
Kevin Moore64f78622021-03-01 17:42:54 -0800575 o.ancestor = buildUnnamed3275();
Martin Kustermannb25a7842016-12-13 16:42:27 +0100576 }
577 buildCounterGetAncestryResponse--;
578 return o;
579}
580
Kevin Moore6d21e902021-01-15 06:41:08 -0800581void checkGetAncestryResponse(api.GetAncestryResponse o) {
Martin Kustermannb25a7842016-12-13 16:42:27 +0100582 buildCounterGetAncestryResponse++;
583 if (buildCounterGetAncestryResponse < 3) {
Kevin Moore64f78622021-03-01 17:42:54 -0800584 checkUnnamed3275(o.ancestor!);
Martin Kustermannb25a7842016-12-13 16:42:27 +0100585 }
586 buildCounterGetAncestryResponse--;
587}
588
Martin Kustermanna6d0a322017-03-27 13:52:31 +0200589core.int buildCounterGetEffectiveOrgPolicyRequest = 0;
Kevin Moore6d21e902021-01-15 06:41:08 -0800590api.GetEffectiveOrgPolicyRequest buildGetEffectiveOrgPolicyRequest() {
591 var o = api.GetEffectiveOrgPolicyRequest();
Martin Kustermanna6d0a322017-03-27 13:52:31 +0200592 buildCounterGetEffectiveOrgPolicyRequest++;
593 if (buildCounterGetEffectiveOrgPolicyRequest < 3) {
Kevin Moored0251702021-01-15 06:41:08 -0800594 o.constraint = 'foo';
Martin Kustermanna6d0a322017-03-27 13:52:31 +0200595 }
596 buildCounterGetEffectiveOrgPolicyRequest--;
597 return o;
598}
599
Kevin Moore6d21e902021-01-15 06:41:08 -0800600void checkGetEffectiveOrgPolicyRequest(api.GetEffectiveOrgPolicyRequest o) {
Martin Kustermanna6d0a322017-03-27 13:52:31 +0200601 buildCounterGetEffectiveOrgPolicyRequest++;
602 if (buildCounterGetEffectiveOrgPolicyRequest < 3) {
Kevin Moore58e22332021-02-25 10:11:41 -0800603 unittest.expect(
604 o.constraint!,
605 unittest.equals('foo'),
606 );
Martin Kustermanna6d0a322017-03-27 13:52:31 +0200607 }
608 buildCounterGetEffectiveOrgPolicyRequest--;
609}
610
Martin Kustermannf6325572016-03-14 14:25:28 +0100611core.int buildCounterGetIamPolicyRequest = 0;
Kevin Moore6d21e902021-01-15 06:41:08 -0800612api.GetIamPolicyRequest buildGetIamPolicyRequest() {
613 var o = api.GetIamPolicyRequest();
Martin Kustermannf6325572016-03-14 14:25:28 +0100614 buildCounterGetIamPolicyRequest++;
Jonas Finnemann Jensenee696b12019-07-04 15:07:25 +0200615 if (buildCounterGetIamPolicyRequest < 3) {
616 o.options = buildGetPolicyOptions();
617 }
Martin Kustermannf6325572016-03-14 14:25:28 +0100618 buildCounterGetIamPolicyRequest--;
619 return o;
620}
621
Kevin Moore6d21e902021-01-15 06:41:08 -0800622void checkGetIamPolicyRequest(api.GetIamPolicyRequest o) {
Martin Kustermannf6325572016-03-14 14:25:28 +0100623 buildCounterGetIamPolicyRequest++;
Jonas Finnemann Jensenee696b12019-07-04 15:07:25 +0200624 if (buildCounterGetIamPolicyRequest < 3) {
Kevin Moore58e22332021-02-25 10:11:41 -0800625 checkGetPolicyOptions(o.options! as api.GetPolicyOptions);
Jonas Finnemann Jensenee696b12019-07-04 15:07:25 +0200626 }
Martin Kustermannf6325572016-03-14 14:25:28 +0100627 buildCounterGetIamPolicyRequest--;
628}
629
Martin Kustermanna6d0a322017-03-27 13:52:31 +0200630core.int buildCounterGetOrgPolicyRequest = 0;
Kevin Moore6d21e902021-01-15 06:41:08 -0800631api.GetOrgPolicyRequest buildGetOrgPolicyRequest() {
632 var o = api.GetOrgPolicyRequest();
Martin Kustermanna6d0a322017-03-27 13:52:31 +0200633 buildCounterGetOrgPolicyRequest++;
634 if (buildCounterGetOrgPolicyRequest < 3) {
Kevin Moored0251702021-01-15 06:41:08 -0800635 o.constraint = 'foo';
Martin Kustermanna6d0a322017-03-27 13:52:31 +0200636 }
637 buildCounterGetOrgPolicyRequest--;
638 return o;
639}
640
Kevin Moore6d21e902021-01-15 06:41:08 -0800641void checkGetOrgPolicyRequest(api.GetOrgPolicyRequest o) {
Martin Kustermanna6d0a322017-03-27 13:52:31 +0200642 buildCounterGetOrgPolicyRequest++;
643 if (buildCounterGetOrgPolicyRequest < 3) {
Kevin Moore58e22332021-02-25 10:11:41 -0800644 unittest.expect(
645 o.constraint!,
646 unittest.equals('foo'),
647 );
Martin Kustermanna6d0a322017-03-27 13:52:31 +0200648 }
649 buildCounterGetOrgPolicyRequest--;
650}
651
Jonas Finnemann Jensenee696b12019-07-04 15:07:25 +0200652core.int buildCounterGetPolicyOptions = 0;
Kevin Moore6d21e902021-01-15 06:41:08 -0800653api.GetPolicyOptions buildGetPolicyOptions() {
654 var o = api.GetPolicyOptions();
Jonas Finnemann Jensenee696b12019-07-04 15:07:25 +0200655 buildCounterGetPolicyOptions++;
656 if (buildCounterGetPolicyOptions < 3) {
657 o.requestedPolicyVersion = 42;
658 }
659 buildCounterGetPolicyOptions--;
660 return o;
661}
662
Kevin Moore6d21e902021-01-15 06:41:08 -0800663void checkGetPolicyOptions(api.GetPolicyOptions o) {
Jonas Finnemann Jensenee696b12019-07-04 15:07:25 +0200664 buildCounterGetPolicyOptions++;
665 if (buildCounterGetPolicyOptions < 3) {
Kevin Moore58e22332021-02-25 10:11:41 -0800666 unittest.expect(
667 o.requestedPolicyVersion!,
668 unittest.equals(42),
669 );
Jonas Finnemann Jensenee696b12019-07-04 15:07:25 +0200670 }
671 buildCounterGetPolicyOptions--;
672}
673
Kevin Moore64f78622021-03-01 17:42:54 -0800674core.List<core.String> buildUnnamed3276() {
Kevin Moore6d21e902021-01-15 06:41:08 -0800675 var o = <core.String>[];
Kevin Moored0251702021-01-15 06:41:08 -0800676 o.add('foo');
677 o.add('foo');
Martin Kustermann77f42ff2017-03-06 13:56:35 +0100678 return o;
679}
680
Kevin Moore64f78622021-03-01 17:42:54 -0800681void checkUnnamed3276(core.List<core.String> o) {
Martin Kustermann77f42ff2017-03-06 13:56:35 +0100682 unittest.expect(o, unittest.hasLength(2));
Kevin Moore58e22332021-02-25 10:11:41 -0800683 unittest.expect(
684 o[0],
685 unittest.equals('foo'),
686 );
687 unittest.expect(
688 o[1],
689 unittest.equals('foo'),
690 );
Martin Kustermann77f42ff2017-03-06 13:56:35 +0100691}
692
693core.int buildCounterLien = 0;
Kevin Moore6d21e902021-01-15 06:41:08 -0800694api.Lien buildLien() {
695 var o = api.Lien();
Martin Kustermann77f42ff2017-03-06 13:56:35 +0100696 buildCounterLien++;
697 if (buildCounterLien < 3) {
Kevin Moored0251702021-01-15 06:41:08 -0800698 o.createTime = 'foo';
699 o.name = 'foo';
700 o.origin = 'foo';
701 o.parent = 'foo';
702 o.reason = 'foo';
Kevin Moore64f78622021-03-01 17:42:54 -0800703 o.restrictions = buildUnnamed3276();
Martin Kustermann77f42ff2017-03-06 13:56:35 +0100704 }
705 buildCounterLien--;
706 return o;
707}
708
Kevin Moore6d21e902021-01-15 06:41:08 -0800709void checkLien(api.Lien o) {
Martin Kustermann77f42ff2017-03-06 13:56:35 +0100710 buildCounterLien++;
711 if (buildCounterLien < 3) {
Kevin Moore58e22332021-02-25 10:11:41 -0800712 unittest.expect(
713 o.createTime!,
714 unittest.equals('foo'),
715 );
716 unittest.expect(
717 o.name!,
718 unittest.equals('foo'),
719 );
720 unittest.expect(
721 o.origin!,
722 unittest.equals('foo'),
723 );
724 unittest.expect(
725 o.parent!,
726 unittest.equals('foo'),
727 );
728 unittest.expect(
729 o.reason!,
730 unittest.equals('foo'),
731 );
Kevin Moore64f78622021-03-01 17:42:54 -0800732 checkUnnamed3276(o.restrictions!);
Martin Kustermann77f42ff2017-03-06 13:56:35 +0100733 }
734 buildCounterLien--;
735}
736
Martin Kustermanna6d0a322017-03-27 13:52:31 +0200737core.int buildCounterListAvailableOrgPolicyConstraintsRequest = 0;
Kevin Moore6d21e902021-01-15 06:41:08 -0800738api.ListAvailableOrgPolicyConstraintsRequest
739 buildListAvailableOrgPolicyConstraintsRequest() {
740 var o = api.ListAvailableOrgPolicyConstraintsRequest();
Martin Kustermanna6d0a322017-03-27 13:52:31 +0200741 buildCounterListAvailableOrgPolicyConstraintsRequest++;
742 if (buildCounterListAvailableOrgPolicyConstraintsRequest < 3) {
743 o.pageSize = 42;
Kevin Moored0251702021-01-15 06:41:08 -0800744 o.pageToken = 'foo';
Martin Kustermanna6d0a322017-03-27 13:52:31 +0200745 }
746 buildCounterListAvailableOrgPolicyConstraintsRequest--;
747 return o;
748}
749
Kevin Moore6d21e902021-01-15 06:41:08 -0800750void checkListAvailableOrgPolicyConstraintsRequest(
Martin Kustermann5eb85c12017-09-11 12:35:54 +0200751 api.ListAvailableOrgPolicyConstraintsRequest o) {
Martin Kustermanna6d0a322017-03-27 13:52:31 +0200752 buildCounterListAvailableOrgPolicyConstraintsRequest++;
753 if (buildCounterListAvailableOrgPolicyConstraintsRequest < 3) {
Kevin Moore58e22332021-02-25 10:11:41 -0800754 unittest.expect(
755 o.pageSize!,
756 unittest.equals(42),
757 );
758 unittest.expect(
759 o.pageToken!,
760 unittest.equals('foo'),
761 );
Martin Kustermanna6d0a322017-03-27 13:52:31 +0200762 }
763 buildCounterListAvailableOrgPolicyConstraintsRequest--;
764}
765
Kevin Moore64f78622021-03-01 17:42:54 -0800766core.List<api.Constraint> buildUnnamed3277() {
Kevin Moore6d21e902021-01-15 06:41:08 -0800767 var o = <api.Constraint>[];
Martin Kustermanna6d0a322017-03-27 13:52:31 +0200768 o.add(buildConstraint());
769 o.add(buildConstraint());
770 return o;
771}
772
Kevin Moore64f78622021-03-01 17:42:54 -0800773void checkUnnamed3277(core.List<api.Constraint> o) {
Martin Kustermanna6d0a322017-03-27 13:52:31 +0200774 unittest.expect(o, unittest.hasLength(2));
Kevin Moorec4dbd8e2021-01-26 14:40:35 -0800775 checkConstraint(o[0] as api.Constraint);
776 checkConstraint(o[1] as api.Constraint);
Martin Kustermanna6d0a322017-03-27 13:52:31 +0200777}
778
779core.int buildCounterListAvailableOrgPolicyConstraintsResponse = 0;
Kevin Moore6d21e902021-01-15 06:41:08 -0800780api.ListAvailableOrgPolicyConstraintsResponse
781 buildListAvailableOrgPolicyConstraintsResponse() {
782 var o = api.ListAvailableOrgPolicyConstraintsResponse();
Martin Kustermanna6d0a322017-03-27 13:52:31 +0200783 buildCounterListAvailableOrgPolicyConstraintsResponse++;
784 if (buildCounterListAvailableOrgPolicyConstraintsResponse < 3) {
Kevin Moore64f78622021-03-01 17:42:54 -0800785 o.constraints = buildUnnamed3277();
Kevin Moored0251702021-01-15 06:41:08 -0800786 o.nextPageToken = 'foo';
Martin Kustermanna6d0a322017-03-27 13:52:31 +0200787 }
788 buildCounterListAvailableOrgPolicyConstraintsResponse--;
789 return o;
790}
791
Kevin Moore6d21e902021-01-15 06:41:08 -0800792void checkListAvailableOrgPolicyConstraintsResponse(
Martin Kustermann5eb85c12017-09-11 12:35:54 +0200793 api.ListAvailableOrgPolicyConstraintsResponse o) {
Martin Kustermanna6d0a322017-03-27 13:52:31 +0200794 buildCounterListAvailableOrgPolicyConstraintsResponse++;
795 if (buildCounterListAvailableOrgPolicyConstraintsResponse < 3) {
Kevin Moore64f78622021-03-01 17:42:54 -0800796 checkUnnamed3277(o.constraints!);
Kevin Moore58e22332021-02-25 10:11:41 -0800797 unittest.expect(
798 o.nextPageToken!,
799 unittest.equals('foo'),
800 );
Martin Kustermanna6d0a322017-03-27 13:52:31 +0200801 }
802 buildCounterListAvailableOrgPolicyConstraintsResponse--;
803}
804
805core.int buildCounterListConstraint = 0;
Kevin Moore6d21e902021-01-15 06:41:08 -0800806api.ListConstraint buildListConstraint() {
807 var o = api.ListConstraint();
Martin Kustermanna6d0a322017-03-27 13:52:31 +0200808 buildCounterListConstraint++;
809 if (buildCounterListConstraint < 3) {
Kevin Moored0251702021-01-15 06:41:08 -0800810 o.suggestedValue = 'foo';
Martin Kustermann12cdd522018-08-27 10:46:50 +0200811 o.supportsUnder = true;
Martin Kustermanna6d0a322017-03-27 13:52:31 +0200812 }
813 buildCounterListConstraint--;
814 return o;
815}
816
Kevin Moore6d21e902021-01-15 06:41:08 -0800817void checkListConstraint(api.ListConstraint o) {
Martin Kustermanna6d0a322017-03-27 13:52:31 +0200818 buildCounterListConstraint++;
819 if (buildCounterListConstraint < 3) {
Kevin Moore58e22332021-02-25 10:11:41 -0800820 unittest.expect(
821 o.suggestedValue!,
822 unittest.equals('foo'),
823 );
824 unittest.expect(o.supportsUnder!, unittest.isTrue);
Martin Kustermanna6d0a322017-03-27 13:52:31 +0200825 }
826 buildCounterListConstraint--;
827}
828
Kevin Moore64f78622021-03-01 17:42:54 -0800829core.List<api.Lien> buildUnnamed3278() {
Kevin Moore6d21e902021-01-15 06:41:08 -0800830 var o = <api.Lien>[];
Martin Kustermann77f42ff2017-03-06 13:56:35 +0100831 o.add(buildLien());
832 o.add(buildLien());
833 return o;
834}
835
Kevin Moore64f78622021-03-01 17:42:54 -0800836void checkUnnamed3278(core.List<api.Lien> o) {
Martin Kustermann77f42ff2017-03-06 13:56:35 +0100837 unittest.expect(o, unittest.hasLength(2));
Kevin Moorec4dbd8e2021-01-26 14:40:35 -0800838 checkLien(o[0] as api.Lien);
839 checkLien(o[1] as api.Lien);
Martin Kustermann77f42ff2017-03-06 13:56:35 +0100840}
841
842core.int buildCounterListLiensResponse = 0;
Kevin Moore6d21e902021-01-15 06:41:08 -0800843api.ListLiensResponse buildListLiensResponse() {
844 var o = api.ListLiensResponse();
Martin Kustermann77f42ff2017-03-06 13:56:35 +0100845 buildCounterListLiensResponse++;
846 if (buildCounterListLiensResponse < 3) {
Kevin Moore64f78622021-03-01 17:42:54 -0800847 o.liens = buildUnnamed3278();
Kevin Moored0251702021-01-15 06:41:08 -0800848 o.nextPageToken = 'foo';
Martin Kustermann77f42ff2017-03-06 13:56:35 +0100849 }
850 buildCounterListLiensResponse--;
851 return o;
852}
853
Kevin Moore6d21e902021-01-15 06:41:08 -0800854void checkListLiensResponse(api.ListLiensResponse o) {
Martin Kustermann77f42ff2017-03-06 13:56:35 +0100855 buildCounterListLiensResponse++;
856 if (buildCounterListLiensResponse < 3) {
Kevin Moore64f78622021-03-01 17:42:54 -0800857 checkUnnamed3278(o.liens!);
Kevin Moore58e22332021-02-25 10:11:41 -0800858 unittest.expect(
859 o.nextPageToken!,
860 unittest.equals('foo'),
861 );
Martin Kustermann77f42ff2017-03-06 13:56:35 +0100862 }
863 buildCounterListLiensResponse--;
864}
865
Martin Kustermanna6d0a322017-03-27 13:52:31 +0200866core.int buildCounterListOrgPoliciesRequest = 0;
Kevin Moore6d21e902021-01-15 06:41:08 -0800867api.ListOrgPoliciesRequest buildListOrgPoliciesRequest() {
868 var o = api.ListOrgPoliciesRequest();
Martin Kustermanna6d0a322017-03-27 13:52:31 +0200869 buildCounterListOrgPoliciesRequest++;
870 if (buildCounterListOrgPoliciesRequest < 3) {
871 o.pageSize = 42;
Kevin Moored0251702021-01-15 06:41:08 -0800872 o.pageToken = 'foo';
Martin Kustermanna6d0a322017-03-27 13:52:31 +0200873 }
874 buildCounterListOrgPoliciesRequest--;
875 return o;
876}
877
Kevin Moore6d21e902021-01-15 06:41:08 -0800878void checkListOrgPoliciesRequest(api.ListOrgPoliciesRequest o) {
Martin Kustermanna6d0a322017-03-27 13:52:31 +0200879 buildCounterListOrgPoliciesRequest++;
880 if (buildCounterListOrgPoliciesRequest < 3) {
Kevin Moore58e22332021-02-25 10:11:41 -0800881 unittest.expect(
882 o.pageSize!,
883 unittest.equals(42),
884 );
885 unittest.expect(
886 o.pageToken!,
887 unittest.equals('foo'),
888 );
Martin Kustermanna6d0a322017-03-27 13:52:31 +0200889 }
890 buildCounterListOrgPoliciesRequest--;
891}
892
Kevin Moore64f78622021-03-01 17:42:54 -0800893core.List<api.OrgPolicy> buildUnnamed3279() {
Kevin Moore6d21e902021-01-15 06:41:08 -0800894 var o = <api.OrgPolicy>[];
Martin Kustermanna6d0a322017-03-27 13:52:31 +0200895 o.add(buildOrgPolicy());
896 o.add(buildOrgPolicy());
897 return o;
898}
899
Kevin Moore64f78622021-03-01 17:42:54 -0800900void checkUnnamed3279(core.List<api.OrgPolicy> o) {
Martin Kustermanna6d0a322017-03-27 13:52:31 +0200901 unittest.expect(o, unittest.hasLength(2));
Kevin Moorec4dbd8e2021-01-26 14:40:35 -0800902 checkOrgPolicy(o[0] as api.OrgPolicy);
903 checkOrgPolicy(o[1] as api.OrgPolicy);
Martin Kustermanna6d0a322017-03-27 13:52:31 +0200904}
905
906core.int buildCounterListOrgPoliciesResponse = 0;
Kevin Moore6d21e902021-01-15 06:41:08 -0800907api.ListOrgPoliciesResponse buildListOrgPoliciesResponse() {
908 var o = api.ListOrgPoliciesResponse();
Martin Kustermanna6d0a322017-03-27 13:52:31 +0200909 buildCounterListOrgPoliciesResponse++;
910 if (buildCounterListOrgPoliciesResponse < 3) {
Kevin Moored0251702021-01-15 06:41:08 -0800911 o.nextPageToken = 'foo';
Kevin Moore64f78622021-03-01 17:42:54 -0800912 o.policies = buildUnnamed3279();
Martin Kustermanna6d0a322017-03-27 13:52:31 +0200913 }
914 buildCounterListOrgPoliciesResponse--;
915 return o;
916}
917
Kevin Moore6d21e902021-01-15 06:41:08 -0800918void checkListOrgPoliciesResponse(api.ListOrgPoliciesResponse o) {
Martin Kustermanna6d0a322017-03-27 13:52:31 +0200919 buildCounterListOrgPoliciesResponse++;
920 if (buildCounterListOrgPoliciesResponse < 3) {
Kevin Moore58e22332021-02-25 10:11:41 -0800921 unittest.expect(
922 o.nextPageToken!,
923 unittest.equals('foo'),
924 );
Kevin Moore64f78622021-03-01 17:42:54 -0800925 checkUnnamed3279(o.policies!);
Martin Kustermanna6d0a322017-03-27 13:52:31 +0200926 }
927 buildCounterListOrgPoliciesResponse--;
928}
929
Kevin Mooreb3758bc2021-02-25 10:03:59 -0800930core.List<core.String> buildUnnamed3280() {
Kevin Moore6d21e902021-01-15 06:41:08 -0800931 var o = <core.String>[];
Kevin Moored0251702021-01-15 06:41:08 -0800932 o.add('foo');
933 o.add('foo');
Martin Kustermannc95693d2017-04-18 12:30:00 +0200934 return o;
935}
936
Kevin Mooreb3758bc2021-02-25 10:03:59 -0800937void checkUnnamed3280(core.List<core.String> o) {
Martin Kustermannc95693d2017-04-18 12:30:00 +0200938 unittest.expect(o, unittest.hasLength(2));
Kevin Moore58e22332021-02-25 10:11:41 -0800939 unittest.expect(
940 o[0],
941 unittest.equals('foo'),
942 );
943 unittest.expect(
944 o[1],
945 unittest.equals('foo'),
946 );
Martin Kustermannc95693d2017-04-18 12:30:00 +0200947}
948
Kevin Moore64f78622021-03-01 17:42:54 -0800949core.List<core.String> buildUnnamed3281() {
950 var o = <core.String>[];
951 o.add('foo');
952 o.add('foo');
953 return o;
954}
955
956void checkUnnamed3281(core.List<core.String> o) {
957 unittest.expect(o, unittest.hasLength(2));
958 unittest.expect(
959 o[0],
960 unittest.equals('foo'),
961 );
962 unittest.expect(
963 o[1],
964 unittest.equals('foo'),
965 );
966}
967
Martin Kustermanna6d0a322017-03-27 13:52:31 +0200968core.int buildCounterListPolicy = 0;
Kevin Moore6d21e902021-01-15 06:41:08 -0800969api.ListPolicy buildListPolicy() {
970 var o = api.ListPolicy();
Martin Kustermanna6d0a322017-03-27 13:52:31 +0200971 buildCounterListPolicy++;
972 if (buildCounterListPolicy < 3) {
Kevin Moored0251702021-01-15 06:41:08 -0800973 o.allValues = 'foo';
Kevin Moore64f78622021-03-01 17:42:54 -0800974 o.allowedValues = buildUnnamed3280();
975 o.deniedValues = buildUnnamed3281();
Martin Kustermanna6d0a322017-03-27 13:52:31 +0200976 o.inheritFromParent = true;
Kevin Moored0251702021-01-15 06:41:08 -0800977 o.suggestedValue = 'foo';
Martin Kustermanna6d0a322017-03-27 13:52:31 +0200978 }
979 buildCounterListPolicy--;
980 return o;
981}
982
Kevin Moore6d21e902021-01-15 06:41:08 -0800983void checkListPolicy(api.ListPolicy o) {
Martin Kustermanna6d0a322017-03-27 13:52:31 +0200984 buildCounterListPolicy++;
985 if (buildCounterListPolicy < 3) {
Kevin Moore58e22332021-02-25 10:11:41 -0800986 unittest.expect(
987 o.allValues!,
988 unittest.equals('foo'),
989 );
Kevin Moore64f78622021-03-01 17:42:54 -0800990 checkUnnamed3280(o.allowedValues!);
991 checkUnnamed3281(o.deniedValues!);
Kevin Moore58e22332021-02-25 10:11:41 -0800992 unittest.expect(o.inheritFromParent!, unittest.isTrue);
993 unittest.expect(
994 o.suggestedValue!,
995 unittest.equals('foo'),
996 );
Martin Kustermanna6d0a322017-03-27 13:52:31 +0200997 }
998 buildCounterListPolicy--;
999}
1000
Kevin Moore64f78622021-03-01 17:42:54 -08001001core.List<api.Project> buildUnnamed3282() {
Kevin Moore6d21e902021-01-15 06:41:08 -08001002 var o = <api.Project>[];
Martin Kustermannf6325572016-03-14 14:25:28 +01001003 o.add(buildProject());
1004 o.add(buildProject());
1005 return o;
1006}
1007
Kevin Moore64f78622021-03-01 17:42:54 -08001008void checkUnnamed3282(core.List<api.Project> o) {
Martin Kustermannf6325572016-03-14 14:25:28 +01001009 unittest.expect(o, unittest.hasLength(2));
Kevin Moorec4dbd8e2021-01-26 14:40:35 -08001010 checkProject(o[0] as api.Project);
1011 checkProject(o[1] as api.Project);
Martin Kustermannf6325572016-03-14 14:25:28 +01001012}
1013
1014core.int buildCounterListProjectsResponse = 0;
Kevin Moore6d21e902021-01-15 06:41:08 -08001015api.ListProjectsResponse buildListProjectsResponse() {
1016 var o = api.ListProjectsResponse();
Martin Kustermannf6325572016-03-14 14:25:28 +01001017 buildCounterListProjectsResponse++;
1018 if (buildCounterListProjectsResponse < 3) {
Kevin Moored0251702021-01-15 06:41:08 -08001019 o.nextPageToken = 'foo';
Kevin Moore64f78622021-03-01 17:42:54 -08001020 o.projects = buildUnnamed3282();
Martin Kustermannf6325572016-03-14 14:25:28 +01001021 }
1022 buildCounterListProjectsResponse--;
1023 return o;
1024}
1025
Kevin Moore6d21e902021-01-15 06:41:08 -08001026void checkListProjectsResponse(api.ListProjectsResponse o) {
Martin Kustermannf6325572016-03-14 14:25:28 +01001027 buildCounterListProjectsResponse++;
1028 if (buildCounterListProjectsResponse < 3) {
Kevin Moore58e22332021-02-25 10:11:41 -08001029 unittest.expect(
1030 o.nextPageToken!,
1031 unittest.equals('foo'),
1032 );
Kevin Moore64f78622021-03-01 17:42:54 -08001033 checkUnnamed3282(o.projects!);
Martin Kustermannf6325572016-03-14 14:25:28 +01001034 }
1035 buildCounterListProjectsResponse--;
1036}
1037
Kevin Moore64f78622021-03-01 17:42:54 -08001038core.Map<core.String, core.Object> buildUnnamed3283() {
Kevin Moore6d21e902021-01-15 06:41:08 -08001039 var o = <core.String, core.Object>{};
Kevin Moored0251702021-01-15 06:41:08 -08001040 o['x'] = {
Martin Kustermann5eb85c12017-09-11 12:35:54 +02001041 'list': [1, 2, 3],
1042 'bool': true,
1043 'string': 'foo'
1044 };
Kevin Moored0251702021-01-15 06:41:08 -08001045 o['y'] = {
Martin Kustermann5eb85c12017-09-11 12:35:54 +02001046 'list': [1, 2, 3],
1047 'bool': true,
1048 'string': 'foo'
1049 };
Søren Gjessee98c52c2016-06-27 11:06:50 +02001050 return o;
1051}
1052
Kevin Moore64f78622021-03-01 17:42:54 -08001053void checkUnnamed3283(core.Map<core.String, core.Object> o) {
Søren Gjessee98c52c2016-06-27 11:06:50 +02001054 unittest.expect(o, unittest.hasLength(2));
Kevin Moore58e22332021-02-25 10:11:41 -08001055 var casted1 = (o['x']!) as core.Map;
Martin Kustermann5eb85c12017-09-11 12:35:54 +02001056 unittest.expect(casted1, unittest.hasLength(3));
Kevin Moore58e22332021-02-25 10:11:41 -08001057 unittest.expect(
1058 casted1['list'],
1059 unittest.equals([1, 2, 3]),
1060 );
1061 unittest.expect(
1062 casted1['bool'],
1063 unittest.equals(true),
1064 );
1065 unittest.expect(
1066 casted1['string'],
1067 unittest.equals('foo'),
1068 );
1069 var casted2 = (o['y']!) as core.Map;
Martin Kustermann5eb85c12017-09-11 12:35:54 +02001070 unittest.expect(casted2, unittest.hasLength(3));
Kevin Moore58e22332021-02-25 10:11:41 -08001071 unittest.expect(
1072 casted2['list'],
1073 unittest.equals([1, 2, 3]),
1074 );
1075 unittest.expect(
1076 casted2['bool'],
1077 unittest.equals(true),
1078 );
1079 unittest.expect(
1080 casted2['string'],
1081 unittest.equals('foo'),
1082 );
Martin Kustermannc95693d2017-04-18 12:30:00 +02001083}
1084
Kevin Moore64f78622021-03-01 17:42:54 -08001085core.Map<core.String, core.Object> buildUnnamed3284() {
Kevin Moore6d21e902021-01-15 06:41:08 -08001086 var o = <core.String, core.Object>{};
Kevin Moored0251702021-01-15 06:41:08 -08001087 o['x'] = {
Martin Kustermann5eb85c12017-09-11 12:35:54 +02001088 'list': [1, 2, 3],
1089 'bool': true,
1090 'string': 'foo'
1091 };
Kevin Moored0251702021-01-15 06:41:08 -08001092 o['y'] = {
Martin Kustermann5eb85c12017-09-11 12:35:54 +02001093 'list': [1, 2, 3],
1094 'bool': true,
1095 'string': 'foo'
1096 };
Martin Kustermannc95693d2017-04-18 12:30:00 +02001097 return o;
1098}
1099
Kevin Moore64f78622021-03-01 17:42:54 -08001100void checkUnnamed3284(core.Map<core.String, core.Object> o) {
Martin Kustermannc95693d2017-04-18 12:30:00 +02001101 unittest.expect(o, unittest.hasLength(2));
Kevin Moore58e22332021-02-25 10:11:41 -08001102 var casted3 = (o['x']!) as core.Map;
Martin Kustermann5eb85c12017-09-11 12:35:54 +02001103 unittest.expect(casted3, unittest.hasLength(3));
Kevin Moore58e22332021-02-25 10:11:41 -08001104 unittest.expect(
1105 casted3['list'],
1106 unittest.equals([1, 2, 3]),
1107 );
1108 unittest.expect(
1109 casted3['bool'],
1110 unittest.equals(true),
1111 );
1112 unittest.expect(
1113 casted3['string'],
1114 unittest.equals('foo'),
1115 );
1116 var casted4 = (o['y']!) as core.Map;
Martin Kustermann5eb85c12017-09-11 12:35:54 +02001117 unittest.expect(casted4, unittest.hasLength(3));
Kevin Moore58e22332021-02-25 10:11:41 -08001118 unittest.expect(
1119 casted4['list'],
1120 unittest.equals([1, 2, 3]),
1121 );
1122 unittest.expect(
1123 casted4['bool'],
1124 unittest.equals(true),
1125 );
1126 unittest.expect(
1127 casted4['string'],
1128 unittest.equals('foo'),
1129 );
Søren Gjessee98c52c2016-06-27 11:06:50 +02001130}
1131
1132core.int buildCounterOperation = 0;
Kevin Moore6d21e902021-01-15 06:41:08 -08001133api.Operation buildOperation() {
1134 var o = api.Operation();
Søren Gjessee98c52c2016-06-27 11:06:50 +02001135 buildCounterOperation++;
1136 if (buildCounterOperation < 3) {
1137 o.done = true;
1138 o.error = buildStatus();
Kevin Moore64f78622021-03-01 17:42:54 -08001139 o.metadata = buildUnnamed3283();
Kevin Moored0251702021-01-15 06:41:08 -08001140 o.name = 'foo';
Kevin Moore64f78622021-03-01 17:42:54 -08001141 o.response = buildUnnamed3284();
Søren Gjessee98c52c2016-06-27 11:06:50 +02001142 }
1143 buildCounterOperation--;
1144 return o;
1145}
1146
Kevin Moore6d21e902021-01-15 06:41:08 -08001147void checkOperation(api.Operation o) {
Søren Gjessee98c52c2016-06-27 11:06:50 +02001148 buildCounterOperation++;
1149 if (buildCounterOperation < 3) {
Kevin Moore58e22332021-02-25 10:11:41 -08001150 unittest.expect(o.done!, unittest.isTrue);
1151 checkStatus(o.error! as api.Status);
Kevin Moore64f78622021-03-01 17:42:54 -08001152 checkUnnamed3283(o.metadata!);
Kevin Moore58e22332021-02-25 10:11:41 -08001153 unittest.expect(
1154 o.name!,
1155 unittest.equals('foo'),
1156 );
Kevin Moore64f78622021-03-01 17:42:54 -08001157 checkUnnamed3284(o.response!);
Søren Gjessee98c52c2016-06-27 11:06:50 +02001158 }
1159 buildCounterOperation--;
1160}
1161
Martin Kustermanna6d0a322017-03-27 13:52:31 +02001162core.int buildCounterOrgPolicy = 0;
Kevin Moore6d21e902021-01-15 06:41:08 -08001163api.OrgPolicy buildOrgPolicy() {
1164 var o = api.OrgPolicy();
Martin Kustermanna6d0a322017-03-27 13:52:31 +02001165 buildCounterOrgPolicy++;
1166 if (buildCounterOrgPolicy < 3) {
1167 o.booleanPolicy = buildBooleanPolicy();
Kevin Moored0251702021-01-15 06:41:08 -08001168 o.constraint = 'foo';
1169 o.etag = 'foo';
Martin Kustermanna6d0a322017-03-27 13:52:31 +02001170 o.listPolicy = buildListPolicy();
1171 o.restoreDefault = buildRestoreDefault();
Kevin Moored0251702021-01-15 06:41:08 -08001172 o.updateTime = 'foo';
Martin Kustermanna6d0a322017-03-27 13:52:31 +02001173 o.version = 42;
1174 }
1175 buildCounterOrgPolicy--;
1176 return o;
1177}
1178
Kevin Moore6d21e902021-01-15 06:41:08 -08001179void checkOrgPolicy(api.OrgPolicy o) {
Martin Kustermanna6d0a322017-03-27 13:52:31 +02001180 buildCounterOrgPolicy++;
1181 if (buildCounterOrgPolicy < 3) {
Kevin Moore58e22332021-02-25 10:11:41 -08001182 checkBooleanPolicy(o.booleanPolicy! as api.BooleanPolicy);
1183 unittest.expect(
1184 o.constraint!,
1185 unittest.equals('foo'),
1186 );
1187 unittest.expect(
1188 o.etag!,
1189 unittest.equals('foo'),
1190 );
1191 checkListPolicy(o.listPolicy! as api.ListPolicy);
1192 checkRestoreDefault(o.restoreDefault! as api.RestoreDefault);
1193 unittest.expect(
1194 o.updateTime!,
1195 unittest.equals('foo'),
1196 );
1197 unittest.expect(
1198 o.version!,
1199 unittest.equals(42),
1200 );
Martin Kustermanna6d0a322017-03-27 13:52:31 +02001201 }
1202 buildCounterOrgPolicy--;
1203}
1204
Martin Kustermann4ff71db2016-11-09 10:46:40 +01001205core.int buildCounterOrganization = 0;
Kevin Moore6d21e902021-01-15 06:41:08 -08001206api.Organization buildOrganization() {
1207 var o = api.Organization();
Martin Kustermann4ff71db2016-11-09 10:46:40 +01001208 buildCounterOrganization++;
1209 if (buildCounterOrganization < 3) {
Kevin Moored0251702021-01-15 06:41:08 -08001210 o.creationTime = 'foo';
1211 o.displayName = 'foo';
1212 o.lifecycleState = 'foo';
1213 o.name = 'foo';
Martin Kustermann4ff71db2016-11-09 10:46:40 +01001214 o.owner = buildOrganizationOwner();
1215 }
1216 buildCounterOrganization--;
1217 return o;
1218}
1219
Kevin Moore6d21e902021-01-15 06:41:08 -08001220void checkOrganization(api.Organization o) {
Martin Kustermann4ff71db2016-11-09 10:46:40 +01001221 buildCounterOrganization++;
1222 if (buildCounterOrganization < 3) {
Kevin Moore58e22332021-02-25 10:11:41 -08001223 unittest.expect(
1224 o.creationTime!,
1225 unittest.equals('foo'),
1226 );
1227 unittest.expect(
1228 o.displayName!,
1229 unittest.equals('foo'),
1230 );
1231 unittest.expect(
1232 o.lifecycleState!,
1233 unittest.equals('foo'),
1234 );
1235 unittest.expect(
1236 o.name!,
1237 unittest.equals('foo'),
1238 );
1239 checkOrganizationOwner(o.owner! as api.OrganizationOwner);
Martin Kustermann4ff71db2016-11-09 10:46:40 +01001240 }
1241 buildCounterOrganization--;
1242}
1243
1244core.int buildCounterOrganizationOwner = 0;
Kevin Moore6d21e902021-01-15 06:41:08 -08001245api.OrganizationOwner buildOrganizationOwner() {
1246 var o = api.OrganizationOwner();
Martin Kustermann4ff71db2016-11-09 10:46:40 +01001247 buildCounterOrganizationOwner++;
1248 if (buildCounterOrganizationOwner < 3) {
Kevin Moored0251702021-01-15 06:41:08 -08001249 o.directoryCustomerId = 'foo';
Martin Kustermann4ff71db2016-11-09 10:46:40 +01001250 }
1251 buildCounterOrganizationOwner--;
1252 return o;
1253}
1254
Kevin Moore6d21e902021-01-15 06:41:08 -08001255void checkOrganizationOwner(api.OrganizationOwner o) {
Martin Kustermann4ff71db2016-11-09 10:46:40 +01001256 buildCounterOrganizationOwner++;
1257 if (buildCounterOrganizationOwner < 3) {
Kevin Moore58e22332021-02-25 10:11:41 -08001258 unittest.expect(
1259 o.directoryCustomerId!,
1260 unittest.equals('foo'),
1261 );
Martin Kustermann4ff71db2016-11-09 10:46:40 +01001262 }
1263 buildCounterOrganizationOwner--;
1264}
1265
Kevin Moore64f78622021-03-01 17:42:54 -08001266core.List<api.AuditConfig> buildUnnamed3285() {
Kevin Moore6d21e902021-01-15 06:41:08 -08001267 var o = <api.AuditConfig>[];
Martin Kustermanna6d0a322017-03-27 13:52:31 +02001268 o.add(buildAuditConfig());
1269 o.add(buildAuditConfig());
1270 return o;
1271}
1272
Kevin Moore64f78622021-03-01 17:42:54 -08001273void checkUnnamed3285(core.List<api.AuditConfig> o) {
Martin Kustermanna6d0a322017-03-27 13:52:31 +02001274 unittest.expect(o, unittest.hasLength(2));
Kevin Moorec4dbd8e2021-01-26 14:40:35 -08001275 checkAuditConfig(o[0] as api.AuditConfig);
1276 checkAuditConfig(o[1] as api.AuditConfig);
Martin Kustermanna6d0a322017-03-27 13:52:31 +02001277}
1278
Kevin Moore64f78622021-03-01 17:42:54 -08001279core.List<api.Binding> buildUnnamed3286() {
Kevin Moore6d21e902021-01-15 06:41:08 -08001280 var o = <api.Binding>[];
Martin Kustermannf6325572016-03-14 14:25:28 +01001281 o.add(buildBinding());
1282 o.add(buildBinding());
1283 return o;
1284}
1285
Kevin Moore64f78622021-03-01 17:42:54 -08001286void checkUnnamed3286(core.List<api.Binding> o) {
Martin Kustermannf6325572016-03-14 14:25:28 +01001287 unittest.expect(o, unittest.hasLength(2));
Kevin Moorec4dbd8e2021-01-26 14:40:35 -08001288 checkBinding(o[0] as api.Binding);
1289 checkBinding(o[1] as api.Binding);
Martin Kustermannf6325572016-03-14 14:25:28 +01001290}
1291
1292core.int buildCounterPolicy = 0;
Kevin Moore6d21e902021-01-15 06:41:08 -08001293api.Policy buildPolicy() {
1294 var o = api.Policy();
Martin Kustermannf6325572016-03-14 14:25:28 +01001295 buildCounterPolicy++;
1296 if (buildCounterPolicy < 3) {
Kevin Moore64f78622021-03-01 17:42:54 -08001297 o.auditConfigs = buildUnnamed3285();
1298 o.bindings = buildUnnamed3286();
Kevin Moored0251702021-01-15 06:41:08 -08001299 o.etag = 'foo';
Martin Kustermannf6325572016-03-14 14:25:28 +01001300 o.version = 42;
1301 }
1302 buildCounterPolicy--;
1303 return o;
1304}
1305
Kevin Moore6d21e902021-01-15 06:41:08 -08001306void checkPolicy(api.Policy o) {
Martin Kustermannf6325572016-03-14 14:25:28 +01001307 buildCounterPolicy++;
1308 if (buildCounterPolicy < 3) {
Kevin Moore64f78622021-03-01 17:42:54 -08001309 checkUnnamed3285(o.auditConfigs!);
1310 checkUnnamed3286(o.bindings!);
Kevin Moore58e22332021-02-25 10:11:41 -08001311 unittest.expect(
1312 o.etag!,
1313 unittest.equals('foo'),
1314 );
1315 unittest.expect(
1316 o.version!,
1317 unittest.equals(42),
1318 );
Martin Kustermannf6325572016-03-14 14:25:28 +01001319 }
1320 buildCounterPolicy--;
1321}
1322
Kevin Moore64f78622021-03-01 17:42:54 -08001323core.Map<core.String, core.String> buildUnnamed3287() {
Kevin Moore6d21e902021-01-15 06:41:08 -08001324 var o = <core.String, core.String>{};
Kevin Moored0251702021-01-15 06:41:08 -08001325 o['x'] = 'foo';
1326 o['y'] = 'foo';
Martin Kustermannf6325572016-03-14 14:25:28 +01001327 return o;
1328}
1329
Kevin Moore64f78622021-03-01 17:42:54 -08001330void checkUnnamed3287(core.Map<core.String, core.String> o) {
Martin Kustermannf6325572016-03-14 14:25:28 +01001331 unittest.expect(o, unittest.hasLength(2));
Kevin Moore58e22332021-02-25 10:11:41 -08001332 unittest.expect(
1333 o['x']!,
1334 unittest.equals('foo'),
1335 );
1336 unittest.expect(
1337 o['y']!,
1338 unittest.equals('foo'),
1339 );
Martin Kustermannf6325572016-03-14 14:25:28 +01001340}
1341
1342core.int buildCounterProject = 0;
Kevin Moore6d21e902021-01-15 06:41:08 -08001343api.Project buildProject() {
1344 var o = api.Project();
Martin Kustermannf6325572016-03-14 14:25:28 +01001345 buildCounterProject++;
1346 if (buildCounterProject < 3) {
Kevin Moored0251702021-01-15 06:41:08 -08001347 o.createTime = 'foo';
Kevin Moore64f78622021-03-01 17:42:54 -08001348 o.labels = buildUnnamed3287();
Kevin Moored0251702021-01-15 06:41:08 -08001349 o.lifecycleState = 'foo';
1350 o.name = 'foo';
Martin Kustermannf6325572016-03-14 14:25:28 +01001351 o.parent = buildResourceId();
Kevin Moored0251702021-01-15 06:41:08 -08001352 o.projectId = 'foo';
1353 o.projectNumber = 'foo';
Martin Kustermannf6325572016-03-14 14:25:28 +01001354 }
1355 buildCounterProject--;
1356 return o;
1357}
1358
Kevin Moore6d21e902021-01-15 06:41:08 -08001359void checkProject(api.Project o) {
Martin Kustermannf6325572016-03-14 14:25:28 +01001360 buildCounterProject++;
1361 if (buildCounterProject < 3) {
Kevin Moore58e22332021-02-25 10:11:41 -08001362 unittest.expect(
1363 o.createTime!,
1364 unittest.equals('foo'),
1365 );
Kevin Moore64f78622021-03-01 17:42:54 -08001366 checkUnnamed3287(o.labels!);
Kevin Moore58e22332021-02-25 10:11:41 -08001367 unittest.expect(
1368 o.lifecycleState!,
1369 unittest.equals('foo'),
1370 );
1371 unittest.expect(
1372 o.name!,
1373 unittest.equals('foo'),
1374 );
1375 checkResourceId(o.parent! as api.ResourceId);
1376 unittest.expect(
1377 o.projectId!,
1378 unittest.equals('foo'),
1379 );
1380 unittest.expect(
1381 o.projectNumber!,
1382 unittest.equals('foo'),
1383 );
Martin Kustermannf6325572016-03-14 14:25:28 +01001384 }
1385 buildCounterProject--;
1386}
1387
Martin Kustermann4ff71db2016-11-09 10:46:40 +01001388core.int buildCounterProjectCreationStatus = 0;
Kevin Moore6d21e902021-01-15 06:41:08 -08001389api.ProjectCreationStatus buildProjectCreationStatus() {
1390 var o = api.ProjectCreationStatus();
Martin Kustermann4ff71db2016-11-09 10:46:40 +01001391 buildCounterProjectCreationStatus++;
1392 if (buildCounterProjectCreationStatus < 3) {
Kevin Moored0251702021-01-15 06:41:08 -08001393 o.createTime = 'foo';
Martin Kustermann4ff71db2016-11-09 10:46:40 +01001394 o.gettable = true;
1395 o.ready = true;
1396 }
1397 buildCounterProjectCreationStatus--;
1398 return o;
1399}
1400
Kevin Moore6d21e902021-01-15 06:41:08 -08001401void checkProjectCreationStatus(api.ProjectCreationStatus o) {
Martin Kustermann4ff71db2016-11-09 10:46:40 +01001402 buildCounterProjectCreationStatus++;
1403 if (buildCounterProjectCreationStatus < 3) {
Kevin Moore58e22332021-02-25 10:11:41 -08001404 unittest.expect(
1405 o.createTime!,
1406 unittest.equals('foo'),
1407 );
1408 unittest.expect(o.gettable!, unittest.isTrue);
1409 unittest.expect(o.ready!, unittest.isTrue);
Martin Kustermann4ff71db2016-11-09 10:46:40 +01001410 }
1411 buildCounterProjectCreationStatus--;
1412}
1413
Martin Kustermannf6325572016-03-14 14:25:28 +01001414core.int buildCounterResourceId = 0;
Kevin Moore6d21e902021-01-15 06:41:08 -08001415api.ResourceId buildResourceId() {
1416 var o = api.ResourceId();
Martin Kustermannf6325572016-03-14 14:25:28 +01001417 buildCounterResourceId++;
1418 if (buildCounterResourceId < 3) {
Kevin Moored0251702021-01-15 06:41:08 -08001419 o.id = 'foo';
1420 o.type = 'foo';
Martin Kustermannf6325572016-03-14 14:25:28 +01001421 }
1422 buildCounterResourceId--;
1423 return o;
1424}
1425
Kevin Moore6d21e902021-01-15 06:41:08 -08001426void checkResourceId(api.ResourceId o) {
Martin Kustermannf6325572016-03-14 14:25:28 +01001427 buildCounterResourceId++;
1428 if (buildCounterResourceId < 3) {
Kevin Moore58e22332021-02-25 10:11:41 -08001429 unittest.expect(
1430 o.id!,
1431 unittest.equals('foo'),
1432 );
1433 unittest.expect(
1434 o.type!,
1435 unittest.equals('foo'),
1436 );
Martin Kustermannf6325572016-03-14 14:25:28 +01001437 }
1438 buildCounterResourceId--;
1439}
1440
Martin Kustermanna6d0a322017-03-27 13:52:31 +02001441core.int buildCounterRestoreDefault = 0;
Kevin Moore6d21e902021-01-15 06:41:08 -08001442api.RestoreDefault buildRestoreDefault() {
1443 var o = api.RestoreDefault();
Martin Kustermanna6d0a322017-03-27 13:52:31 +02001444 buildCounterRestoreDefault++;
Martin Kustermann5eb85c12017-09-11 12:35:54 +02001445 if (buildCounterRestoreDefault < 3) {}
Martin Kustermanna6d0a322017-03-27 13:52:31 +02001446 buildCounterRestoreDefault--;
1447 return o;
1448}
1449
Kevin Moore6d21e902021-01-15 06:41:08 -08001450void checkRestoreDefault(api.RestoreDefault o) {
Martin Kustermanna6d0a322017-03-27 13:52:31 +02001451 buildCounterRestoreDefault++;
Martin Kustermann5eb85c12017-09-11 12:35:54 +02001452 if (buildCounterRestoreDefault < 3) {}
Martin Kustermanna6d0a322017-03-27 13:52:31 +02001453 buildCounterRestoreDefault--;
1454}
1455
Martin Kustermann4ff71db2016-11-09 10:46:40 +01001456core.int buildCounterSearchOrganizationsRequest = 0;
Kevin Moore6d21e902021-01-15 06:41:08 -08001457api.SearchOrganizationsRequest buildSearchOrganizationsRequest() {
1458 var o = api.SearchOrganizationsRequest();
Martin Kustermann4ff71db2016-11-09 10:46:40 +01001459 buildCounterSearchOrganizationsRequest++;
1460 if (buildCounterSearchOrganizationsRequest < 3) {
Kevin Moored0251702021-01-15 06:41:08 -08001461 o.filter = 'foo';
Martin Kustermann4ff71db2016-11-09 10:46:40 +01001462 o.pageSize = 42;
Kevin Moored0251702021-01-15 06:41:08 -08001463 o.pageToken = 'foo';
Martin Kustermann4ff71db2016-11-09 10:46:40 +01001464 }
1465 buildCounterSearchOrganizationsRequest--;
1466 return o;
1467}
1468
Kevin Moore6d21e902021-01-15 06:41:08 -08001469void checkSearchOrganizationsRequest(api.SearchOrganizationsRequest o) {
Martin Kustermann4ff71db2016-11-09 10:46:40 +01001470 buildCounterSearchOrganizationsRequest++;
1471 if (buildCounterSearchOrganizationsRequest < 3) {
Kevin Moore58e22332021-02-25 10:11:41 -08001472 unittest.expect(
1473 o.filter!,
1474 unittest.equals('foo'),
1475 );
1476 unittest.expect(
1477 o.pageSize!,
1478 unittest.equals(42),
1479 );
1480 unittest.expect(
1481 o.pageToken!,
1482 unittest.equals('foo'),
1483 );
Martin Kustermann4ff71db2016-11-09 10:46:40 +01001484 }
1485 buildCounterSearchOrganizationsRequest--;
1486}
1487
Kevin Moore64f78622021-03-01 17:42:54 -08001488core.List<api.Organization> buildUnnamed3288() {
Kevin Moore6d21e902021-01-15 06:41:08 -08001489 var o = <api.Organization>[];
Martin Kustermann4ff71db2016-11-09 10:46:40 +01001490 o.add(buildOrganization());
1491 o.add(buildOrganization());
1492 return o;
1493}
1494
Kevin Moore64f78622021-03-01 17:42:54 -08001495void checkUnnamed3288(core.List<api.Organization> o) {
Martin Kustermann4ff71db2016-11-09 10:46:40 +01001496 unittest.expect(o, unittest.hasLength(2));
Kevin Moorec4dbd8e2021-01-26 14:40:35 -08001497 checkOrganization(o[0] as api.Organization);
1498 checkOrganization(o[1] as api.Organization);
Martin Kustermann4ff71db2016-11-09 10:46:40 +01001499}
1500
1501core.int buildCounterSearchOrganizationsResponse = 0;
Kevin Moore6d21e902021-01-15 06:41:08 -08001502api.SearchOrganizationsResponse buildSearchOrganizationsResponse() {
1503 var o = api.SearchOrganizationsResponse();
Martin Kustermann4ff71db2016-11-09 10:46:40 +01001504 buildCounterSearchOrganizationsResponse++;
1505 if (buildCounterSearchOrganizationsResponse < 3) {
Kevin Moored0251702021-01-15 06:41:08 -08001506 o.nextPageToken = 'foo';
Kevin Moore64f78622021-03-01 17:42:54 -08001507 o.organizations = buildUnnamed3288();
Martin Kustermann4ff71db2016-11-09 10:46:40 +01001508 }
1509 buildCounterSearchOrganizationsResponse--;
1510 return o;
1511}
1512
Kevin Moore6d21e902021-01-15 06:41:08 -08001513void checkSearchOrganizationsResponse(api.SearchOrganizationsResponse o) {
Martin Kustermann4ff71db2016-11-09 10:46:40 +01001514 buildCounterSearchOrganizationsResponse++;
1515 if (buildCounterSearchOrganizationsResponse < 3) {
Kevin Moore58e22332021-02-25 10:11:41 -08001516 unittest.expect(
1517 o.nextPageToken!,
1518 unittest.equals('foo'),
1519 );
Kevin Moore64f78622021-03-01 17:42:54 -08001520 checkUnnamed3288(o.organizations!);
Martin Kustermann4ff71db2016-11-09 10:46:40 +01001521 }
1522 buildCounterSearchOrganizationsResponse--;
1523}
1524
Martin Kustermannf6325572016-03-14 14:25:28 +01001525core.int buildCounterSetIamPolicyRequest = 0;
Kevin Moore6d21e902021-01-15 06:41:08 -08001526api.SetIamPolicyRequest buildSetIamPolicyRequest() {
1527 var o = api.SetIamPolicyRequest();
Martin Kustermannf6325572016-03-14 14:25:28 +01001528 buildCounterSetIamPolicyRequest++;
1529 if (buildCounterSetIamPolicyRequest < 3) {
1530 o.policy = buildPolicy();
Kevin Moored0251702021-01-15 06:41:08 -08001531 o.updateMask = 'foo';
Martin Kustermannf6325572016-03-14 14:25:28 +01001532 }
1533 buildCounterSetIamPolicyRequest--;
1534 return o;
1535}
1536
Kevin Moore6d21e902021-01-15 06:41:08 -08001537void checkSetIamPolicyRequest(api.SetIamPolicyRequest o) {
Martin Kustermannf6325572016-03-14 14:25:28 +01001538 buildCounterSetIamPolicyRequest++;
1539 if (buildCounterSetIamPolicyRequest < 3) {
Kevin Moore58e22332021-02-25 10:11:41 -08001540 checkPolicy(o.policy! as api.Policy);
1541 unittest.expect(
1542 o.updateMask!,
1543 unittest.equals('foo'),
1544 );
Martin Kustermannf6325572016-03-14 14:25:28 +01001545 }
1546 buildCounterSetIamPolicyRequest--;
1547}
1548
Martin Kustermanna6d0a322017-03-27 13:52:31 +02001549core.int buildCounterSetOrgPolicyRequest = 0;
Kevin Moore6d21e902021-01-15 06:41:08 -08001550api.SetOrgPolicyRequest buildSetOrgPolicyRequest() {
1551 var o = api.SetOrgPolicyRequest();
Martin Kustermanna6d0a322017-03-27 13:52:31 +02001552 buildCounterSetOrgPolicyRequest++;
1553 if (buildCounterSetOrgPolicyRequest < 3) {
1554 o.policy = buildOrgPolicy();
1555 }
1556 buildCounterSetOrgPolicyRequest--;
1557 return o;
1558}
1559
Kevin Moore6d21e902021-01-15 06:41:08 -08001560void checkSetOrgPolicyRequest(api.SetOrgPolicyRequest o) {
Martin Kustermanna6d0a322017-03-27 13:52:31 +02001561 buildCounterSetOrgPolicyRequest++;
1562 if (buildCounterSetOrgPolicyRequest < 3) {
Kevin Moore58e22332021-02-25 10:11:41 -08001563 checkOrgPolicy(o.policy! as api.OrgPolicy);
Martin Kustermanna6d0a322017-03-27 13:52:31 +02001564 }
1565 buildCounterSetOrgPolicyRequest--;
1566}
1567
Kevin Moore64f78622021-03-01 17:42:54 -08001568core.Map<core.String, core.Object> buildUnnamed3289() {
Kevin Moore6d21e902021-01-15 06:41:08 -08001569 var o = <core.String, core.Object>{};
Kevin Moored0251702021-01-15 06:41:08 -08001570 o['x'] = {
Martin Kustermann5eb85c12017-09-11 12:35:54 +02001571 'list': [1, 2, 3],
1572 'bool': true,
1573 'string': 'foo'
1574 };
Kevin Moored0251702021-01-15 06:41:08 -08001575 o['y'] = {
Martin Kustermann5eb85c12017-09-11 12:35:54 +02001576 'list': [1, 2, 3],
1577 'bool': true,
1578 'string': 'foo'
1579 };
Søren Gjessee98c52c2016-06-27 11:06:50 +02001580 return o;
1581}
1582
Kevin Moore64f78622021-03-01 17:42:54 -08001583void checkUnnamed3289(core.Map<core.String, core.Object> o) {
Søren Gjessee98c52c2016-06-27 11:06:50 +02001584 unittest.expect(o, unittest.hasLength(2));
Kevin Moore58e22332021-02-25 10:11:41 -08001585 var casted5 = (o['x']!) as core.Map;
Martin Kustermann5eb85c12017-09-11 12:35:54 +02001586 unittest.expect(casted5, unittest.hasLength(3));
Kevin Moore58e22332021-02-25 10:11:41 -08001587 unittest.expect(
1588 casted5['list'],
1589 unittest.equals([1, 2, 3]),
1590 );
1591 unittest.expect(
1592 casted5['bool'],
1593 unittest.equals(true),
1594 );
1595 unittest.expect(
1596 casted5['string'],
1597 unittest.equals('foo'),
1598 );
1599 var casted6 = (o['y']!) as core.Map;
Martin Kustermann5eb85c12017-09-11 12:35:54 +02001600 unittest.expect(casted6, unittest.hasLength(3));
Kevin Moore58e22332021-02-25 10:11:41 -08001601 unittest.expect(
1602 casted6['list'],
1603 unittest.equals([1, 2, 3]),
1604 );
1605 unittest.expect(
1606 casted6['bool'],
1607 unittest.equals(true),
1608 );
1609 unittest.expect(
1610 casted6['string'],
1611 unittest.equals('foo'),
1612 );
Søren Gjessee98c52c2016-06-27 11:06:50 +02001613}
1614
Kevin Moore64f78622021-03-01 17:42:54 -08001615core.List<core.Map<core.String, core.Object>> buildUnnamed3290() {
Kevin Moore6d21e902021-01-15 06:41:08 -08001616 var o = <core.Map<core.String, core.Object>>[];
Kevin Moore64f78622021-03-01 17:42:54 -08001617 o.add(buildUnnamed3289());
1618 o.add(buildUnnamed3289());
Søren Gjessee98c52c2016-06-27 11:06:50 +02001619 return o;
1620}
1621
Kevin Moore64f78622021-03-01 17:42:54 -08001622void checkUnnamed3290(core.List<core.Map<core.String, core.Object>> o) {
Søren Gjessee98c52c2016-06-27 11:06:50 +02001623 unittest.expect(o, unittest.hasLength(2));
Kevin Moore64f78622021-03-01 17:42:54 -08001624 checkUnnamed3289(o[0]);
1625 checkUnnamed3289(o[1]);
Søren Gjessee98c52c2016-06-27 11:06:50 +02001626}
1627
1628core.int buildCounterStatus = 0;
Kevin Moore6d21e902021-01-15 06:41:08 -08001629api.Status buildStatus() {
1630 var o = api.Status();
Søren Gjessee98c52c2016-06-27 11:06:50 +02001631 buildCounterStatus++;
1632 if (buildCounterStatus < 3) {
1633 o.code = 42;
Kevin Moore64f78622021-03-01 17:42:54 -08001634 o.details = buildUnnamed3290();
Kevin Moored0251702021-01-15 06:41:08 -08001635 o.message = 'foo';
Søren Gjessee98c52c2016-06-27 11:06:50 +02001636 }
1637 buildCounterStatus--;
1638 return o;
1639}
1640
Kevin Moore6d21e902021-01-15 06:41:08 -08001641void checkStatus(api.Status o) {
Søren Gjessee98c52c2016-06-27 11:06:50 +02001642 buildCounterStatus++;
1643 if (buildCounterStatus < 3) {
Kevin Moore58e22332021-02-25 10:11:41 -08001644 unittest.expect(
1645 o.code!,
1646 unittest.equals(42),
1647 );
Kevin Moore64f78622021-03-01 17:42:54 -08001648 checkUnnamed3290(o.details!);
Kevin Moore58e22332021-02-25 10:11:41 -08001649 unittest.expect(
1650 o.message!,
1651 unittest.equals('foo'),
1652 );
Søren Gjessee98c52c2016-06-27 11:06:50 +02001653 }
1654 buildCounterStatus--;
1655}
1656
Kevin Mooreb3758bc2021-02-25 10:03:59 -08001657core.List<core.String> buildUnnamed3291() {
Kevin Moore6d21e902021-01-15 06:41:08 -08001658 var o = <core.String>[];
Kevin Moored0251702021-01-15 06:41:08 -08001659 o.add('foo');
1660 o.add('foo');
Martin Kustermannc95693d2017-04-18 12:30:00 +02001661 return o;
1662}
1663
Kevin Mooreb3758bc2021-02-25 10:03:59 -08001664void checkUnnamed3291(core.List<core.String> o) {
Martin Kustermannc95693d2017-04-18 12:30:00 +02001665 unittest.expect(o, unittest.hasLength(2));
Kevin Moore58e22332021-02-25 10:11:41 -08001666 unittest.expect(
1667 o[0],
1668 unittest.equals('foo'),
1669 );
1670 unittest.expect(
1671 o[1],
1672 unittest.equals('foo'),
1673 );
Martin Kustermannc95693d2017-04-18 12:30:00 +02001674}
1675
Kevin Moore64f78622021-03-01 17:42:54 -08001676core.int buildCounterTestIamPermissionsRequest = 0;
1677api.TestIamPermissionsRequest buildTestIamPermissionsRequest() {
1678 var o = api.TestIamPermissionsRequest();
1679 buildCounterTestIamPermissionsRequest++;
1680 if (buildCounterTestIamPermissionsRequest < 3) {
1681 o.permissions = buildUnnamed3291();
1682 }
1683 buildCounterTestIamPermissionsRequest--;
1684 return o;
1685}
1686
1687void checkTestIamPermissionsRequest(api.TestIamPermissionsRequest o) {
1688 buildCounterTestIamPermissionsRequest++;
1689 if (buildCounterTestIamPermissionsRequest < 3) {
1690 checkUnnamed3291(o.permissions!);
1691 }
1692 buildCounterTestIamPermissionsRequest--;
1693}
1694
1695core.List<core.String> buildUnnamed3292() {
1696 var o = <core.String>[];
1697 o.add('foo');
1698 o.add('foo');
1699 return o;
1700}
1701
1702void checkUnnamed3292(core.List<core.String> o) {
1703 unittest.expect(o, unittest.hasLength(2));
1704 unittest.expect(
1705 o[0],
1706 unittest.equals('foo'),
1707 );
1708 unittest.expect(
1709 o[1],
1710 unittest.equals('foo'),
1711 );
1712}
1713
Martin Kustermannf6325572016-03-14 14:25:28 +01001714core.int buildCounterTestIamPermissionsResponse = 0;
Kevin Moore6d21e902021-01-15 06:41:08 -08001715api.TestIamPermissionsResponse buildTestIamPermissionsResponse() {
1716 var o = api.TestIamPermissionsResponse();
Martin Kustermannf6325572016-03-14 14:25:28 +01001717 buildCounterTestIamPermissionsResponse++;
1718 if (buildCounterTestIamPermissionsResponse < 3) {
Kevin Moore64f78622021-03-01 17:42:54 -08001719 o.permissions = buildUnnamed3292();
Martin Kustermannf6325572016-03-14 14:25:28 +01001720 }
1721 buildCounterTestIamPermissionsResponse--;
1722 return o;
1723}
1724
Kevin Moore6d21e902021-01-15 06:41:08 -08001725void checkTestIamPermissionsResponse(api.TestIamPermissionsResponse o) {
Martin Kustermannf6325572016-03-14 14:25:28 +01001726 buildCounterTestIamPermissionsResponse++;
1727 if (buildCounterTestIamPermissionsResponse < 3) {
Kevin Moore64f78622021-03-01 17:42:54 -08001728 checkUnnamed3292(o.permissions!);
Martin Kustermannf6325572016-03-14 14:25:28 +01001729 }
1730 buildCounterTestIamPermissionsResponse--;
1731}
1732
1733core.int buildCounterUndeleteProjectRequest = 0;
Kevin Moore6d21e902021-01-15 06:41:08 -08001734api.UndeleteProjectRequest buildUndeleteProjectRequest() {
1735 var o = api.UndeleteProjectRequest();
Martin Kustermannf6325572016-03-14 14:25:28 +01001736 buildCounterUndeleteProjectRequest++;
Martin Kustermann5eb85c12017-09-11 12:35:54 +02001737 if (buildCounterUndeleteProjectRequest < 3) {}
Martin Kustermannf6325572016-03-14 14:25:28 +01001738 buildCounterUndeleteProjectRequest--;
1739 return o;
1740}
1741
Kevin Moore6d21e902021-01-15 06:41:08 -08001742void checkUndeleteProjectRequest(api.UndeleteProjectRequest o) {
Martin Kustermannf6325572016-03-14 14:25:28 +01001743 buildCounterUndeleteProjectRequest++;
Martin Kustermann5eb85c12017-09-11 12:35:54 +02001744 if (buildCounterUndeleteProjectRequest < 3) {}
Martin Kustermannf6325572016-03-14 14:25:28 +01001745 buildCounterUndeleteProjectRequest--;
1746}
1747
Kevin Moore0946dce2021-02-04 09:58:04 -08001748core.int buildCounterUpdateTagKeyMetadata = 0;
1749api.UpdateTagKeyMetadata buildUpdateTagKeyMetadata() {
1750 var o = api.UpdateTagKeyMetadata();
1751 buildCounterUpdateTagKeyMetadata++;
1752 if (buildCounterUpdateTagKeyMetadata < 3) {}
1753 buildCounterUpdateTagKeyMetadata--;
1754 return o;
1755}
1756
1757void checkUpdateTagKeyMetadata(api.UpdateTagKeyMetadata o) {
1758 buildCounterUpdateTagKeyMetadata++;
1759 if (buildCounterUpdateTagKeyMetadata < 3) {}
1760 buildCounterUpdateTagKeyMetadata--;
1761}
1762
1763core.int buildCounterUpdateTagValueMetadata = 0;
1764api.UpdateTagValueMetadata buildUpdateTagValueMetadata() {
1765 var o = api.UpdateTagValueMetadata();
1766 buildCounterUpdateTagValueMetadata++;
1767 if (buildCounterUpdateTagValueMetadata < 3) {}
1768 buildCounterUpdateTagValueMetadata--;
1769 return o;
1770}
1771
1772void checkUpdateTagValueMetadata(api.UpdateTagValueMetadata o) {
1773 buildCounterUpdateTagValueMetadata++;
1774 if (buildCounterUpdateTagValueMetadata < 3) {}
1775 buildCounterUpdateTagValueMetadata--;
1776}
1777
Kevin Moore6d21e902021-01-15 06:41:08 -08001778void main() {
Kevin Moored0251702021-01-15 06:41:08 -08001779 unittest.group('obj-schema-Ancestor', () {
Kevin Moore341348b2021-02-25 11:55:18 -08001780 unittest.test('to-json--from-json', () async {
Martin Kustermannb25a7842016-12-13 16:42:27 +01001781 var o = buildAncestor();
Kevin Mooreae408692021-02-25 12:00:44 -08001782 var oJson = convert.jsonDecode(convert.jsonEncode(o));
1783 var od =
1784 api.Ancestor.fromJson(oJson as core.Map<core.String, core.dynamic>);
Kevin Moorec4dbd8e2021-01-26 14:40:35 -08001785 checkAncestor(od as api.Ancestor);
Martin Kustermannb25a7842016-12-13 16:42:27 +01001786 });
1787 });
1788
Kevin Moored0251702021-01-15 06:41:08 -08001789 unittest.group('obj-schema-AuditConfig', () {
Kevin Moore341348b2021-02-25 11:55:18 -08001790 unittest.test('to-json--from-json', () async {
Martin Kustermanna6d0a322017-03-27 13:52:31 +02001791 var o = buildAuditConfig();
Kevin Mooreae408692021-02-25 12:00:44 -08001792 var oJson = convert.jsonDecode(convert.jsonEncode(o));
1793 var od = api.AuditConfig.fromJson(
1794 oJson as core.Map<core.String, core.dynamic>);
Kevin Moorec4dbd8e2021-01-26 14:40:35 -08001795 checkAuditConfig(od as api.AuditConfig);
Martin Kustermanna6d0a322017-03-27 13:52:31 +02001796 });
1797 });
1798
Kevin Moored0251702021-01-15 06:41:08 -08001799 unittest.group('obj-schema-AuditLogConfig', () {
Kevin Moore341348b2021-02-25 11:55:18 -08001800 unittest.test('to-json--from-json', () async {
Martin Kustermanna6d0a322017-03-27 13:52:31 +02001801 var o = buildAuditLogConfig();
Kevin Mooreae408692021-02-25 12:00:44 -08001802 var oJson = convert.jsonDecode(convert.jsonEncode(o));
1803 var od = api.AuditLogConfig.fromJson(
1804 oJson as core.Map<core.String, core.dynamic>);
Kevin Moorec4dbd8e2021-01-26 14:40:35 -08001805 checkAuditLogConfig(od as api.AuditLogConfig);
Martin Kustermanna6d0a322017-03-27 13:52:31 +02001806 });
1807 });
1808
Kevin Moored0251702021-01-15 06:41:08 -08001809 unittest.group('obj-schema-Binding', () {
Kevin Moore341348b2021-02-25 11:55:18 -08001810 unittest.test('to-json--from-json', () async {
Martin Kustermannf6325572016-03-14 14:25:28 +01001811 var o = buildBinding();
Kevin Mooreae408692021-02-25 12:00:44 -08001812 var oJson = convert.jsonDecode(convert.jsonEncode(o));
1813 var od =
1814 api.Binding.fromJson(oJson as core.Map<core.String, core.dynamic>);
Kevin Moorec4dbd8e2021-01-26 14:40:35 -08001815 checkBinding(od as api.Binding);
Martin Kustermannf6325572016-03-14 14:25:28 +01001816 });
1817 });
1818
Kevin Moored0251702021-01-15 06:41:08 -08001819 unittest.group('obj-schema-BooleanConstraint', () {
Kevin Moore341348b2021-02-25 11:55:18 -08001820 unittest.test('to-json--from-json', () async {
Martin Kustermanna6d0a322017-03-27 13:52:31 +02001821 var o = buildBooleanConstraint();
Kevin Mooreae408692021-02-25 12:00:44 -08001822 var oJson = convert.jsonDecode(convert.jsonEncode(o));
1823 var od = api.BooleanConstraint.fromJson(
1824 oJson as core.Map<core.String, core.dynamic>);
Kevin Moorec4dbd8e2021-01-26 14:40:35 -08001825 checkBooleanConstraint(od as api.BooleanConstraint);
Martin Kustermanna6d0a322017-03-27 13:52:31 +02001826 });
1827 });
1828
Kevin Moored0251702021-01-15 06:41:08 -08001829 unittest.group('obj-schema-BooleanPolicy', () {
Kevin Moore341348b2021-02-25 11:55:18 -08001830 unittest.test('to-json--from-json', () async {
Martin Kustermanna6d0a322017-03-27 13:52:31 +02001831 var o = buildBooleanPolicy();
Kevin Mooreae408692021-02-25 12:00:44 -08001832 var oJson = convert.jsonDecode(convert.jsonEncode(o));
1833 var od = api.BooleanPolicy.fromJson(
1834 oJson as core.Map<core.String, core.dynamic>);
Kevin Moorec4dbd8e2021-01-26 14:40:35 -08001835 checkBooleanPolicy(od as api.BooleanPolicy);
Martin Kustermanna6d0a322017-03-27 13:52:31 +02001836 });
1837 });
1838
Kevin Moored0251702021-01-15 06:41:08 -08001839 unittest.group('obj-schema-ClearOrgPolicyRequest', () {
Kevin Moore341348b2021-02-25 11:55:18 -08001840 unittest.test('to-json--from-json', () async {
Martin Kustermanna6d0a322017-03-27 13:52:31 +02001841 var o = buildClearOrgPolicyRequest();
Kevin Mooreae408692021-02-25 12:00:44 -08001842 var oJson = convert.jsonDecode(convert.jsonEncode(o));
1843 var od = api.ClearOrgPolicyRequest.fromJson(
1844 oJson as core.Map<core.String, core.dynamic>);
Kevin Moorec4dbd8e2021-01-26 14:40:35 -08001845 checkClearOrgPolicyRequest(od as api.ClearOrgPolicyRequest);
Martin Kustermanna6d0a322017-03-27 13:52:31 +02001846 });
1847 });
1848
Kevin Moore0946dce2021-02-04 09:58:04 -08001849 unittest.group(
1850 'obj-schema-CloudresourcemanagerGoogleCloudResourcemanagerV2alpha1FolderOperation',
1851 () {
Kevin Moore341348b2021-02-25 11:55:18 -08001852 unittest.test('to-json--from-json', () async {
Kevin Moore0946dce2021-02-04 09:58:04 -08001853 var o =
1854 buildCloudresourcemanagerGoogleCloudResourcemanagerV2alpha1FolderOperation();
Kevin Mooreae408692021-02-25 12:00:44 -08001855 var oJson = convert.jsonDecode(convert.jsonEncode(o));
Kevin Moore0946dce2021-02-04 09:58:04 -08001856 var od =
1857 api.CloudresourcemanagerGoogleCloudResourcemanagerV2alpha1FolderOperation
Kevin Mooreae408692021-02-25 12:00:44 -08001858 .fromJson(oJson as core.Map<core.String, core.dynamic>);
Kevin Moore0946dce2021-02-04 09:58:04 -08001859 checkCloudresourcemanagerGoogleCloudResourcemanagerV2alpha1FolderOperation(
1860 od as api
1861 .CloudresourcemanagerGoogleCloudResourcemanagerV2alpha1FolderOperation);
1862 });
1863 });
1864
1865 unittest.group(
1866 'obj-schema-CloudresourcemanagerGoogleCloudResourcemanagerV2beta1FolderOperation',
1867 () {
Kevin Moore341348b2021-02-25 11:55:18 -08001868 unittest.test('to-json--from-json', () async {
Kevin Moore0946dce2021-02-04 09:58:04 -08001869 var o =
1870 buildCloudresourcemanagerGoogleCloudResourcemanagerV2beta1FolderOperation();
Kevin Mooreae408692021-02-25 12:00:44 -08001871 var oJson = convert.jsonDecode(convert.jsonEncode(o));
Kevin Moore0946dce2021-02-04 09:58:04 -08001872 var od =
1873 api.CloudresourcemanagerGoogleCloudResourcemanagerV2beta1FolderOperation
Kevin Mooreae408692021-02-25 12:00:44 -08001874 .fromJson(oJson as core.Map<core.String, core.dynamic>);
Kevin Moore0946dce2021-02-04 09:58:04 -08001875 checkCloudresourcemanagerGoogleCloudResourcemanagerV2beta1FolderOperation(
1876 od as api
1877 .CloudresourcemanagerGoogleCloudResourcemanagerV2beta1FolderOperation);
1878 });
1879 });
1880
Kevin Moored0251702021-01-15 06:41:08 -08001881 unittest.group('obj-schema-Constraint', () {
Kevin Moore341348b2021-02-25 11:55:18 -08001882 unittest.test('to-json--from-json', () async {
Martin Kustermanna6d0a322017-03-27 13:52:31 +02001883 var o = buildConstraint();
Kevin Mooreae408692021-02-25 12:00:44 -08001884 var oJson = convert.jsonDecode(convert.jsonEncode(o));
1885 var od =
1886 api.Constraint.fromJson(oJson as core.Map<core.String, core.dynamic>);
Kevin Moorec4dbd8e2021-01-26 14:40:35 -08001887 checkConstraint(od as api.Constraint);
Martin Kustermanna6d0a322017-03-27 13:52:31 +02001888 });
1889 });
1890
Kevin Moore0946dce2021-02-04 09:58:04 -08001891 unittest.group('obj-schema-CreateTagKeyMetadata', () {
Kevin Moore341348b2021-02-25 11:55:18 -08001892 unittest.test('to-json--from-json', () async {
Kevin Moore0946dce2021-02-04 09:58:04 -08001893 var o = buildCreateTagKeyMetadata();
Kevin Mooreae408692021-02-25 12:00:44 -08001894 var oJson = convert.jsonDecode(convert.jsonEncode(o));
1895 var od = api.CreateTagKeyMetadata.fromJson(
1896 oJson as core.Map<core.String, core.dynamic>);
Kevin Moore0946dce2021-02-04 09:58:04 -08001897 checkCreateTagKeyMetadata(od as api.CreateTagKeyMetadata);
1898 });
1899 });
1900
1901 unittest.group('obj-schema-CreateTagValueMetadata', () {
Kevin Moore341348b2021-02-25 11:55:18 -08001902 unittest.test('to-json--from-json', () async {
Kevin Moore0946dce2021-02-04 09:58:04 -08001903 var o = buildCreateTagValueMetadata();
Kevin Mooreae408692021-02-25 12:00:44 -08001904 var oJson = convert.jsonDecode(convert.jsonEncode(o));
1905 var od = api.CreateTagValueMetadata.fromJson(
1906 oJson as core.Map<core.String, core.dynamic>);
Kevin Moore0946dce2021-02-04 09:58:04 -08001907 checkCreateTagValueMetadata(od as api.CreateTagValueMetadata);
1908 });
1909 });
1910
Kevin Moore0946dce2021-02-04 09:58:04 -08001911 unittest.group('obj-schema-DeleteTagKeyMetadata', () {
Kevin Moore341348b2021-02-25 11:55:18 -08001912 unittest.test('to-json--from-json', () async {
Kevin Moore0946dce2021-02-04 09:58:04 -08001913 var o = buildDeleteTagKeyMetadata();
Kevin Mooreae408692021-02-25 12:00:44 -08001914 var oJson = convert.jsonDecode(convert.jsonEncode(o));
1915 var od = api.DeleteTagKeyMetadata.fromJson(
1916 oJson as core.Map<core.String, core.dynamic>);
Kevin Moore0946dce2021-02-04 09:58:04 -08001917 checkDeleteTagKeyMetadata(od as api.DeleteTagKeyMetadata);
1918 });
1919 });
1920
1921 unittest.group('obj-schema-DeleteTagValueMetadata', () {
Kevin Moore341348b2021-02-25 11:55:18 -08001922 unittest.test('to-json--from-json', () async {
Kevin Moore0946dce2021-02-04 09:58:04 -08001923 var o = buildDeleteTagValueMetadata();
Kevin Mooreae408692021-02-25 12:00:44 -08001924 var oJson = convert.jsonDecode(convert.jsonEncode(o));
1925 var od = api.DeleteTagValueMetadata.fromJson(
1926 oJson as core.Map<core.String, core.dynamic>);
Kevin Moore0946dce2021-02-04 09:58:04 -08001927 checkDeleteTagValueMetadata(od as api.DeleteTagValueMetadata);
1928 });
1929 });
1930
Kevin Moored0251702021-01-15 06:41:08 -08001931 unittest.group('obj-schema-Empty', () {
Kevin Moore341348b2021-02-25 11:55:18 -08001932 unittest.test('to-json--from-json', () async {
Martin Kustermannf6325572016-03-14 14:25:28 +01001933 var o = buildEmpty();
Kevin Mooreae408692021-02-25 12:00:44 -08001934 var oJson = convert.jsonDecode(convert.jsonEncode(o));
1935 var od = api.Empty.fromJson(oJson as core.Map<core.String, core.dynamic>);
Kevin Moorec4dbd8e2021-01-26 14:40:35 -08001936 checkEmpty(od as api.Empty);
Martin Kustermannf6325572016-03-14 14:25:28 +01001937 });
1938 });
1939
Kevin Moored0251702021-01-15 06:41:08 -08001940 unittest.group('obj-schema-Expr', () {
Kevin Moore341348b2021-02-25 11:55:18 -08001941 unittest.test('to-json--from-json', () async {
Martin Kustermann12cdd522018-08-27 10:46:50 +02001942 var o = buildExpr();
Kevin Mooreae408692021-02-25 12:00:44 -08001943 var oJson = convert.jsonDecode(convert.jsonEncode(o));
1944 var od = api.Expr.fromJson(oJson as core.Map<core.String, core.dynamic>);
Kevin Moorec4dbd8e2021-01-26 14:40:35 -08001945 checkExpr(od as api.Expr);
Martin Kustermann12cdd522018-08-27 10:46:50 +02001946 });
1947 });
1948
Kevin Moored0251702021-01-15 06:41:08 -08001949 unittest.group('obj-schema-FolderOperation', () {
Kevin Moore341348b2021-02-25 11:55:18 -08001950 unittest.test('to-json--from-json', () async {
Martin Kustermann4ff71db2016-11-09 10:46:40 +01001951 var o = buildFolderOperation();
Kevin Mooreae408692021-02-25 12:00:44 -08001952 var oJson = convert.jsonDecode(convert.jsonEncode(o));
1953 var od = api.FolderOperation.fromJson(
1954 oJson as core.Map<core.String, core.dynamic>);
Kevin Moorec4dbd8e2021-01-26 14:40:35 -08001955 checkFolderOperation(od as api.FolderOperation);
Martin Kustermann4ff71db2016-11-09 10:46:40 +01001956 });
1957 });
1958
Kevin Moored0251702021-01-15 06:41:08 -08001959 unittest.group('obj-schema-FolderOperationError', () {
Kevin Moore341348b2021-02-25 11:55:18 -08001960 unittest.test('to-json--from-json', () async {
Martin Kustermann4ff71db2016-11-09 10:46:40 +01001961 var o = buildFolderOperationError();
Kevin Mooreae408692021-02-25 12:00:44 -08001962 var oJson = convert.jsonDecode(convert.jsonEncode(o));
1963 var od = api.FolderOperationError.fromJson(
1964 oJson as core.Map<core.String, core.dynamic>);
Kevin Moorec4dbd8e2021-01-26 14:40:35 -08001965 checkFolderOperationError(od as api.FolderOperationError);
Martin Kustermann4ff71db2016-11-09 10:46:40 +01001966 });
1967 });
1968
Kevin Moored0251702021-01-15 06:41:08 -08001969 unittest.group('obj-schema-GetAncestryRequest', () {
Kevin Moore341348b2021-02-25 11:55:18 -08001970 unittest.test('to-json--from-json', () async {
Martin Kustermannb25a7842016-12-13 16:42:27 +01001971 var o = buildGetAncestryRequest();
Kevin Mooreae408692021-02-25 12:00:44 -08001972 var oJson = convert.jsonDecode(convert.jsonEncode(o));
1973 var od = api.GetAncestryRequest.fromJson(
1974 oJson as core.Map<core.String, core.dynamic>);
Kevin Moorec4dbd8e2021-01-26 14:40:35 -08001975 checkGetAncestryRequest(od as api.GetAncestryRequest);
Martin Kustermannb25a7842016-12-13 16:42:27 +01001976 });
1977 });
1978
Kevin Moored0251702021-01-15 06:41:08 -08001979 unittest.group('obj-schema-GetAncestryResponse', () {
Kevin Moore341348b2021-02-25 11:55:18 -08001980 unittest.test('to-json--from-json', () async {
Martin Kustermannb25a7842016-12-13 16:42:27 +01001981 var o = buildGetAncestryResponse();
Kevin Mooreae408692021-02-25 12:00:44 -08001982 var oJson = convert.jsonDecode(convert.jsonEncode(o));
1983 var od = api.GetAncestryResponse.fromJson(
1984 oJson as core.Map<core.String, core.dynamic>);
Kevin Moorec4dbd8e2021-01-26 14:40:35 -08001985 checkGetAncestryResponse(od as api.GetAncestryResponse);
Martin Kustermannb25a7842016-12-13 16:42:27 +01001986 });
1987 });
1988
Kevin Moored0251702021-01-15 06:41:08 -08001989 unittest.group('obj-schema-GetEffectiveOrgPolicyRequest', () {
Kevin Moore341348b2021-02-25 11:55:18 -08001990 unittest.test('to-json--from-json', () async {
Martin Kustermanna6d0a322017-03-27 13:52:31 +02001991 var o = buildGetEffectiveOrgPolicyRequest();
Kevin Mooreae408692021-02-25 12:00:44 -08001992 var oJson = convert.jsonDecode(convert.jsonEncode(o));
1993 var od = api.GetEffectiveOrgPolicyRequest.fromJson(
1994 oJson as core.Map<core.String, core.dynamic>);
Kevin Moorec4dbd8e2021-01-26 14:40:35 -08001995 checkGetEffectiveOrgPolicyRequest(od as api.GetEffectiveOrgPolicyRequest);
Martin Kustermanna6d0a322017-03-27 13:52:31 +02001996 });
1997 });
1998
Kevin Moored0251702021-01-15 06:41:08 -08001999 unittest.group('obj-schema-GetIamPolicyRequest', () {
Kevin Moore341348b2021-02-25 11:55:18 -08002000 unittest.test('to-json--from-json', () async {
Martin Kustermannf6325572016-03-14 14:25:28 +01002001 var o = buildGetIamPolicyRequest();
Kevin Mooreae408692021-02-25 12:00:44 -08002002 var oJson = convert.jsonDecode(convert.jsonEncode(o));
2003 var od = api.GetIamPolicyRequest.fromJson(
2004 oJson as core.Map<core.String, core.dynamic>);
Kevin Moorec4dbd8e2021-01-26 14:40:35 -08002005 checkGetIamPolicyRequest(od as api.GetIamPolicyRequest);
Martin Kustermannf6325572016-03-14 14:25:28 +01002006 });
2007 });
2008
Kevin Moored0251702021-01-15 06:41:08 -08002009 unittest.group('obj-schema-GetOrgPolicyRequest', () {
Kevin Moore341348b2021-02-25 11:55:18 -08002010 unittest.test('to-json--from-json', () async {
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002011 var o = buildGetOrgPolicyRequest();
Kevin Mooreae408692021-02-25 12:00:44 -08002012 var oJson = convert.jsonDecode(convert.jsonEncode(o));
2013 var od = api.GetOrgPolicyRequest.fromJson(
2014 oJson as core.Map<core.String, core.dynamic>);
Kevin Moorec4dbd8e2021-01-26 14:40:35 -08002015 checkGetOrgPolicyRequest(od as api.GetOrgPolicyRequest);
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002016 });
2017 });
2018
Kevin Moored0251702021-01-15 06:41:08 -08002019 unittest.group('obj-schema-GetPolicyOptions', () {
Kevin Moore341348b2021-02-25 11:55:18 -08002020 unittest.test('to-json--from-json', () async {
Jonas Finnemann Jensenee696b12019-07-04 15:07:25 +02002021 var o = buildGetPolicyOptions();
Kevin Mooreae408692021-02-25 12:00:44 -08002022 var oJson = convert.jsonDecode(convert.jsonEncode(o));
2023 var od = api.GetPolicyOptions.fromJson(
2024 oJson as core.Map<core.String, core.dynamic>);
Kevin Moorec4dbd8e2021-01-26 14:40:35 -08002025 checkGetPolicyOptions(od as api.GetPolicyOptions);
Jonas Finnemann Jensenee696b12019-07-04 15:07:25 +02002026 });
2027 });
2028
Kevin Moored0251702021-01-15 06:41:08 -08002029 unittest.group('obj-schema-Lien', () {
Kevin Moore341348b2021-02-25 11:55:18 -08002030 unittest.test('to-json--from-json', () async {
Martin Kustermann77f42ff2017-03-06 13:56:35 +01002031 var o = buildLien();
Kevin Mooreae408692021-02-25 12:00:44 -08002032 var oJson = convert.jsonDecode(convert.jsonEncode(o));
2033 var od = api.Lien.fromJson(oJson as core.Map<core.String, core.dynamic>);
Kevin Moorec4dbd8e2021-01-26 14:40:35 -08002034 checkLien(od as api.Lien);
Martin Kustermann77f42ff2017-03-06 13:56:35 +01002035 });
2036 });
2037
Kevin Moored0251702021-01-15 06:41:08 -08002038 unittest.group('obj-schema-ListAvailableOrgPolicyConstraintsRequest', () {
Kevin Moore341348b2021-02-25 11:55:18 -08002039 unittest.test('to-json--from-json', () async {
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002040 var o = buildListAvailableOrgPolicyConstraintsRequest();
Kevin Mooreae408692021-02-25 12:00:44 -08002041 var oJson = convert.jsonDecode(convert.jsonEncode(o));
2042 var od = api.ListAvailableOrgPolicyConstraintsRequest.fromJson(
2043 oJson as core.Map<core.String, core.dynamic>);
Kevin Moorec4dbd8e2021-01-26 14:40:35 -08002044 checkListAvailableOrgPolicyConstraintsRequest(
2045 od as api.ListAvailableOrgPolicyConstraintsRequest);
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002046 });
2047 });
2048
Kevin Moored0251702021-01-15 06:41:08 -08002049 unittest.group('obj-schema-ListAvailableOrgPolicyConstraintsResponse', () {
Kevin Moore341348b2021-02-25 11:55:18 -08002050 unittest.test('to-json--from-json', () async {
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002051 var o = buildListAvailableOrgPolicyConstraintsResponse();
Kevin Mooreae408692021-02-25 12:00:44 -08002052 var oJson = convert.jsonDecode(convert.jsonEncode(o));
2053 var od = api.ListAvailableOrgPolicyConstraintsResponse.fromJson(
2054 oJson as core.Map<core.String, core.dynamic>);
Kevin Moorec4dbd8e2021-01-26 14:40:35 -08002055 checkListAvailableOrgPolicyConstraintsResponse(
2056 od as api.ListAvailableOrgPolicyConstraintsResponse);
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002057 });
2058 });
2059
Kevin Moored0251702021-01-15 06:41:08 -08002060 unittest.group('obj-schema-ListConstraint', () {
Kevin Moore341348b2021-02-25 11:55:18 -08002061 unittest.test('to-json--from-json', () async {
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002062 var o = buildListConstraint();
Kevin Mooreae408692021-02-25 12:00:44 -08002063 var oJson = convert.jsonDecode(convert.jsonEncode(o));
2064 var od = api.ListConstraint.fromJson(
2065 oJson as core.Map<core.String, core.dynamic>);
Kevin Moorec4dbd8e2021-01-26 14:40:35 -08002066 checkListConstraint(od as api.ListConstraint);
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002067 });
2068 });
2069
Kevin Moored0251702021-01-15 06:41:08 -08002070 unittest.group('obj-schema-ListLiensResponse', () {
Kevin Moore341348b2021-02-25 11:55:18 -08002071 unittest.test('to-json--from-json', () async {
Martin Kustermann77f42ff2017-03-06 13:56:35 +01002072 var o = buildListLiensResponse();
Kevin Mooreae408692021-02-25 12:00:44 -08002073 var oJson = convert.jsonDecode(convert.jsonEncode(o));
2074 var od = api.ListLiensResponse.fromJson(
2075 oJson as core.Map<core.String, core.dynamic>);
Kevin Moorec4dbd8e2021-01-26 14:40:35 -08002076 checkListLiensResponse(od as api.ListLiensResponse);
Martin Kustermann77f42ff2017-03-06 13:56:35 +01002077 });
2078 });
2079
Kevin Moored0251702021-01-15 06:41:08 -08002080 unittest.group('obj-schema-ListOrgPoliciesRequest', () {
Kevin Moore341348b2021-02-25 11:55:18 -08002081 unittest.test('to-json--from-json', () async {
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002082 var o = buildListOrgPoliciesRequest();
Kevin Mooreae408692021-02-25 12:00:44 -08002083 var oJson = convert.jsonDecode(convert.jsonEncode(o));
2084 var od = api.ListOrgPoliciesRequest.fromJson(
2085 oJson as core.Map<core.String, core.dynamic>);
Kevin Moorec4dbd8e2021-01-26 14:40:35 -08002086 checkListOrgPoliciesRequest(od as api.ListOrgPoliciesRequest);
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002087 });
2088 });
2089
Kevin Moored0251702021-01-15 06:41:08 -08002090 unittest.group('obj-schema-ListOrgPoliciesResponse', () {
Kevin Moore341348b2021-02-25 11:55:18 -08002091 unittest.test('to-json--from-json', () async {
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002092 var o = buildListOrgPoliciesResponse();
Kevin Mooreae408692021-02-25 12:00:44 -08002093 var oJson = convert.jsonDecode(convert.jsonEncode(o));
2094 var od = api.ListOrgPoliciesResponse.fromJson(
2095 oJson as core.Map<core.String, core.dynamic>);
Kevin Moorec4dbd8e2021-01-26 14:40:35 -08002096 checkListOrgPoliciesResponse(od as api.ListOrgPoliciesResponse);
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002097 });
2098 });
2099
Kevin Moored0251702021-01-15 06:41:08 -08002100 unittest.group('obj-schema-ListPolicy', () {
Kevin Moore341348b2021-02-25 11:55:18 -08002101 unittest.test('to-json--from-json', () async {
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002102 var o = buildListPolicy();
Kevin Mooreae408692021-02-25 12:00:44 -08002103 var oJson = convert.jsonDecode(convert.jsonEncode(o));
2104 var od =
2105 api.ListPolicy.fromJson(oJson as core.Map<core.String, core.dynamic>);
Kevin Moorec4dbd8e2021-01-26 14:40:35 -08002106 checkListPolicy(od as api.ListPolicy);
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002107 });
2108 });
2109
Kevin Moored0251702021-01-15 06:41:08 -08002110 unittest.group('obj-schema-ListProjectsResponse', () {
Kevin Moore341348b2021-02-25 11:55:18 -08002111 unittest.test('to-json--from-json', () async {
Martin Kustermannf6325572016-03-14 14:25:28 +01002112 var o = buildListProjectsResponse();
Kevin Mooreae408692021-02-25 12:00:44 -08002113 var oJson = convert.jsonDecode(convert.jsonEncode(o));
2114 var od = api.ListProjectsResponse.fromJson(
2115 oJson as core.Map<core.String, core.dynamic>);
Kevin Moorec4dbd8e2021-01-26 14:40:35 -08002116 checkListProjectsResponse(od as api.ListProjectsResponse);
Martin Kustermannf6325572016-03-14 14:25:28 +01002117 });
2118 });
2119
Kevin Moored0251702021-01-15 06:41:08 -08002120 unittest.group('obj-schema-Operation', () {
Kevin Moore341348b2021-02-25 11:55:18 -08002121 unittest.test('to-json--from-json', () async {
Søren Gjessee98c52c2016-06-27 11:06:50 +02002122 var o = buildOperation();
Kevin Mooreae408692021-02-25 12:00:44 -08002123 var oJson = convert.jsonDecode(convert.jsonEncode(o));
2124 var od =
2125 api.Operation.fromJson(oJson as core.Map<core.String, core.dynamic>);
Kevin Moorec4dbd8e2021-01-26 14:40:35 -08002126 checkOperation(od as api.Operation);
Søren Gjessee98c52c2016-06-27 11:06:50 +02002127 });
2128 });
2129
Kevin Moored0251702021-01-15 06:41:08 -08002130 unittest.group('obj-schema-OrgPolicy', () {
Kevin Moore341348b2021-02-25 11:55:18 -08002131 unittest.test('to-json--from-json', () async {
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002132 var o = buildOrgPolicy();
Kevin Mooreae408692021-02-25 12:00:44 -08002133 var oJson = convert.jsonDecode(convert.jsonEncode(o));
2134 var od =
2135 api.OrgPolicy.fromJson(oJson as core.Map<core.String, core.dynamic>);
Kevin Moorec4dbd8e2021-01-26 14:40:35 -08002136 checkOrgPolicy(od as api.OrgPolicy);
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002137 });
2138 });
2139
Kevin Moored0251702021-01-15 06:41:08 -08002140 unittest.group('obj-schema-Organization', () {
Kevin Moore341348b2021-02-25 11:55:18 -08002141 unittest.test('to-json--from-json', () async {
Martin Kustermann4ff71db2016-11-09 10:46:40 +01002142 var o = buildOrganization();
Kevin Mooreae408692021-02-25 12:00:44 -08002143 var oJson = convert.jsonDecode(convert.jsonEncode(o));
2144 var od = api.Organization.fromJson(
2145 oJson as core.Map<core.String, core.dynamic>);
Kevin Moorec4dbd8e2021-01-26 14:40:35 -08002146 checkOrganization(od as api.Organization);
Martin Kustermann4ff71db2016-11-09 10:46:40 +01002147 });
2148 });
2149
Kevin Moored0251702021-01-15 06:41:08 -08002150 unittest.group('obj-schema-OrganizationOwner', () {
Kevin Moore341348b2021-02-25 11:55:18 -08002151 unittest.test('to-json--from-json', () async {
Martin Kustermann4ff71db2016-11-09 10:46:40 +01002152 var o = buildOrganizationOwner();
Kevin Mooreae408692021-02-25 12:00:44 -08002153 var oJson = convert.jsonDecode(convert.jsonEncode(o));
2154 var od = api.OrganizationOwner.fromJson(
2155 oJson as core.Map<core.String, core.dynamic>);
Kevin Moorec4dbd8e2021-01-26 14:40:35 -08002156 checkOrganizationOwner(od as api.OrganizationOwner);
Martin Kustermann4ff71db2016-11-09 10:46:40 +01002157 });
2158 });
2159
Kevin Moored0251702021-01-15 06:41:08 -08002160 unittest.group('obj-schema-Policy', () {
Kevin Moore341348b2021-02-25 11:55:18 -08002161 unittest.test('to-json--from-json', () async {
Martin Kustermannf6325572016-03-14 14:25:28 +01002162 var o = buildPolicy();
Kevin Mooreae408692021-02-25 12:00:44 -08002163 var oJson = convert.jsonDecode(convert.jsonEncode(o));
2164 var od =
2165 api.Policy.fromJson(oJson as core.Map<core.String, core.dynamic>);
Kevin Moorec4dbd8e2021-01-26 14:40:35 -08002166 checkPolicy(od as api.Policy);
Martin Kustermannf6325572016-03-14 14:25:28 +01002167 });
2168 });
2169
Kevin Moored0251702021-01-15 06:41:08 -08002170 unittest.group('obj-schema-Project', () {
Kevin Moore341348b2021-02-25 11:55:18 -08002171 unittest.test('to-json--from-json', () async {
Martin Kustermannf6325572016-03-14 14:25:28 +01002172 var o = buildProject();
Kevin Mooreae408692021-02-25 12:00:44 -08002173 var oJson = convert.jsonDecode(convert.jsonEncode(o));
2174 var od =
2175 api.Project.fromJson(oJson as core.Map<core.String, core.dynamic>);
Kevin Moorec4dbd8e2021-01-26 14:40:35 -08002176 checkProject(od as api.Project);
Martin Kustermannf6325572016-03-14 14:25:28 +01002177 });
2178 });
2179
Kevin Moored0251702021-01-15 06:41:08 -08002180 unittest.group('obj-schema-ProjectCreationStatus', () {
Kevin Moore341348b2021-02-25 11:55:18 -08002181 unittest.test('to-json--from-json', () async {
Martin Kustermann4ff71db2016-11-09 10:46:40 +01002182 var o = buildProjectCreationStatus();
Kevin Mooreae408692021-02-25 12:00:44 -08002183 var oJson = convert.jsonDecode(convert.jsonEncode(o));
2184 var od = api.ProjectCreationStatus.fromJson(
2185 oJson as core.Map<core.String, core.dynamic>);
Kevin Moorec4dbd8e2021-01-26 14:40:35 -08002186 checkProjectCreationStatus(od as api.ProjectCreationStatus);
Martin Kustermann4ff71db2016-11-09 10:46:40 +01002187 });
2188 });
2189
Kevin Moored0251702021-01-15 06:41:08 -08002190 unittest.group('obj-schema-ResourceId', () {
Kevin Moore341348b2021-02-25 11:55:18 -08002191 unittest.test('to-json--from-json', () async {
Martin Kustermannf6325572016-03-14 14:25:28 +01002192 var o = buildResourceId();
Kevin Mooreae408692021-02-25 12:00:44 -08002193 var oJson = convert.jsonDecode(convert.jsonEncode(o));
2194 var od =
2195 api.ResourceId.fromJson(oJson as core.Map<core.String, core.dynamic>);
Kevin Moorec4dbd8e2021-01-26 14:40:35 -08002196 checkResourceId(od as api.ResourceId);
Martin Kustermannf6325572016-03-14 14:25:28 +01002197 });
2198 });
2199
Kevin Moored0251702021-01-15 06:41:08 -08002200 unittest.group('obj-schema-RestoreDefault', () {
Kevin Moore341348b2021-02-25 11:55:18 -08002201 unittest.test('to-json--from-json', () async {
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002202 var o = buildRestoreDefault();
Kevin Mooreae408692021-02-25 12:00:44 -08002203 var oJson = convert.jsonDecode(convert.jsonEncode(o));
2204 var od = api.RestoreDefault.fromJson(
2205 oJson as core.Map<core.String, core.dynamic>);
Kevin Moorec4dbd8e2021-01-26 14:40:35 -08002206 checkRestoreDefault(od as api.RestoreDefault);
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002207 });
2208 });
2209
Kevin Moored0251702021-01-15 06:41:08 -08002210 unittest.group('obj-schema-SearchOrganizationsRequest', () {
Kevin Moore341348b2021-02-25 11:55:18 -08002211 unittest.test('to-json--from-json', () async {
Martin Kustermann4ff71db2016-11-09 10:46:40 +01002212 var o = buildSearchOrganizationsRequest();
Kevin Mooreae408692021-02-25 12:00:44 -08002213 var oJson = convert.jsonDecode(convert.jsonEncode(o));
2214 var od = api.SearchOrganizationsRequest.fromJson(
2215 oJson as core.Map<core.String, core.dynamic>);
Kevin Moorec4dbd8e2021-01-26 14:40:35 -08002216 checkSearchOrganizationsRequest(od as api.SearchOrganizationsRequest);
Martin Kustermann4ff71db2016-11-09 10:46:40 +01002217 });
2218 });
2219
Kevin Moored0251702021-01-15 06:41:08 -08002220 unittest.group('obj-schema-SearchOrganizationsResponse', () {
Kevin Moore341348b2021-02-25 11:55:18 -08002221 unittest.test('to-json--from-json', () async {
Martin Kustermann4ff71db2016-11-09 10:46:40 +01002222 var o = buildSearchOrganizationsResponse();
Kevin Mooreae408692021-02-25 12:00:44 -08002223 var oJson = convert.jsonDecode(convert.jsonEncode(o));
2224 var od = api.SearchOrganizationsResponse.fromJson(
2225 oJson as core.Map<core.String, core.dynamic>);
Kevin Moorec4dbd8e2021-01-26 14:40:35 -08002226 checkSearchOrganizationsResponse(od as api.SearchOrganizationsResponse);
Martin Kustermann4ff71db2016-11-09 10:46:40 +01002227 });
2228 });
2229
Kevin Moored0251702021-01-15 06:41:08 -08002230 unittest.group('obj-schema-SetIamPolicyRequest', () {
Kevin Moore341348b2021-02-25 11:55:18 -08002231 unittest.test('to-json--from-json', () async {
Martin Kustermannf6325572016-03-14 14:25:28 +01002232 var o = buildSetIamPolicyRequest();
Kevin Mooreae408692021-02-25 12:00:44 -08002233 var oJson = convert.jsonDecode(convert.jsonEncode(o));
2234 var od = api.SetIamPolicyRequest.fromJson(
2235 oJson as core.Map<core.String, core.dynamic>);
Kevin Moorec4dbd8e2021-01-26 14:40:35 -08002236 checkSetIamPolicyRequest(od as api.SetIamPolicyRequest);
Martin Kustermannf6325572016-03-14 14:25:28 +01002237 });
2238 });
2239
Kevin Moored0251702021-01-15 06:41:08 -08002240 unittest.group('obj-schema-SetOrgPolicyRequest', () {
Kevin Moore341348b2021-02-25 11:55:18 -08002241 unittest.test('to-json--from-json', () async {
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002242 var o = buildSetOrgPolicyRequest();
Kevin Mooreae408692021-02-25 12:00:44 -08002243 var oJson = convert.jsonDecode(convert.jsonEncode(o));
2244 var od = api.SetOrgPolicyRequest.fromJson(
2245 oJson as core.Map<core.String, core.dynamic>);
Kevin Moorec4dbd8e2021-01-26 14:40:35 -08002246 checkSetOrgPolicyRequest(od as api.SetOrgPolicyRequest);
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002247 });
2248 });
2249
Kevin Moored0251702021-01-15 06:41:08 -08002250 unittest.group('obj-schema-Status', () {
Kevin Moore341348b2021-02-25 11:55:18 -08002251 unittest.test('to-json--from-json', () async {
Søren Gjessee98c52c2016-06-27 11:06:50 +02002252 var o = buildStatus();
Kevin Mooreae408692021-02-25 12:00:44 -08002253 var oJson = convert.jsonDecode(convert.jsonEncode(o));
2254 var od =
2255 api.Status.fromJson(oJson as core.Map<core.String, core.dynamic>);
Kevin Moorec4dbd8e2021-01-26 14:40:35 -08002256 checkStatus(od as api.Status);
Søren Gjessee98c52c2016-06-27 11:06:50 +02002257 });
2258 });
2259
Kevin Moored0251702021-01-15 06:41:08 -08002260 unittest.group('obj-schema-TestIamPermissionsRequest', () {
Kevin Moore341348b2021-02-25 11:55:18 -08002261 unittest.test('to-json--from-json', () async {
Martin Kustermannf6325572016-03-14 14:25:28 +01002262 var o = buildTestIamPermissionsRequest();
Kevin Mooreae408692021-02-25 12:00:44 -08002263 var oJson = convert.jsonDecode(convert.jsonEncode(o));
2264 var od = api.TestIamPermissionsRequest.fromJson(
2265 oJson as core.Map<core.String, core.dynamic>);
Kevin Moorec4dbd8e2021-01-26 14:40:35 -08002266 checkTestIamPermissionsRequest(od as api.TestIamPermissionsRequest);
Martin Kustermannf6325572016-03-14 14:25:28 +01002267 });
2268 });
2269
Kevin Moored0251702021-01-15 06:41:08 -08002270 unittest.group('obj-schema-TestIamPermissionsResponse', () {
Kevin Moore341348b2021-02-25 11:55:18 -08002271 unittest.test('to-json--from-json', () async {
Martin Kustermannf6325572016-03-14 14:25:28 +01002272 var o = buildTestIamPermissionsResponse();
Kevin Mooreae408692021-02-25 12:00:44 -08002273 var oJson = convert.jsonDecode(convert.jsonEncode(o));
2274 var od = api.TestIamPermissionsResponse.fromJson(
2275 oJson as core.Map<core.String, core.dynamic>);
Kevin Moorec4dbd8e2021-01-26 14:40:35 -08002276 checkTestIamPermissionsResponse(od as api.TestIamPermissionsResponse);
Martin Kustermannf6325572016-03-14 14:25:28 +01002277 });
2278 });
2279
Kevin Moored0251702021-01-15 06:41:08 -08002280 unittest.group('obj-schema-UndeleteProjectRequest', () {
Kevin Moore341348b2021-02-25 11:55:18 -08002281 unittest.test('to-json--from-json', () async {
Martin Kustermannf6325572016-03-14 14:25:28 +01002282 var o = buildUndeleteProjectRequest();
Kevin Mooreae408692021-02-25 12:00:44 -08002283 var oJson = convert.jsonDecode(convert.jsonEncode(o));
2284 var od = api.UndeleteProjectRequest.fromJson(
2285 oJson as core.Map<core.String, core.dynamic>);
Kevin Moorec4dbd8e2021-01-26 14:40:35 -08002286 checkUndeleteProjectRequest(od as api.UndeleteProjectRequest);
Martin Kustermannf6325572016-03-14 14:25:28 +01002287 });
2288 });
2289
Kevin Moore0946dce2021-02-04 09:58:04 -08002290 unittest.group('obj-schema-UpdateTagKeyMetadata', () {
Kevin Moore341348b2021-02-25 11:55:18 -08002291 unittest.test('to-json--from-json', () async {
Kevin Moore0946dce2021-02-04 09:58:04 -08002292 var o = buildUpdateTagKeyMetadata();
Kevin Mooreae408692021-02-25 12:00:44 -08002293 var oJson = convert.jsonDecode(convert.jsonEncode(o));
2294 var od = api.UpdateTagKeyMetadata.fromJson(
2295 oJson as core.Map<core.String, core.dynamic>);
Kevin Moore0946dce2021-02-04 09:58:04 -08002296 checkUpdateTagKeyMetadata(od as api.UpdateTagKeyMetadata);
2297 });
2298 });
2299
2300 unittest.group('obj-schema-UpdateTagValueMetadata', () {
Kevin Moore341348b2021-02-25 11:55:18 -08002301 unittest.test('to-json--from-json', () async {
Kevin Moore0946dce2021-02-04 09:58:04 -08002302 var o = buildUpdateTagValueMetadata();
Kevin Mooreae408692021-02-25 12:00:44 -08002303 var oJson = convert.jsonDecode(convert.jsonEncode(o));
2304 var od = api.UpdateTagValueMetadata.fromJson(
2305 oJson as core.Map<core.String, core.dynamic>);
Kevin Moore0946dce2021-02-04 09:58:04 -08002306 checkUpdateTagValueMetadata(od as api.UpdateTagValueMetadata);
2307 });
2308 });
2309
Kevin Moore88512712021-01-28 14:43:28 -08002310 unittest.group('resource-FoldersResource', () {
Kevin Moore341348b2021-02-25 11:55:18 -08002311 unittest.test('method--clearOrgPolicy', () async {
Kevin Moore6d21e902021-01-15 06:41:08 -08002312 var mock = HttpServerMock();
Kevin Moore5889af72021-01-28 13:31:53 -08002313 var res = api.CloudResourceManagerApi(mock).folders;
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002314 var arg_request = buildClearOrgPolicyRequest();
Kevin Moored0251702021-01-15 06:41:08 -08002315 var arg_resource = 'foo';
2316 var arg_$fields = 'foo';
Martin Kustermann3953f0d2017-06-12 16:59:53 +02002317 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
Kevin Moorec4dbd8e2021-01-26 14:40:35 -08002318 var obj = api.ClearOrgPolicyRequest.fromJson(
2319 json as core.Map<core.String, core.dynamic>);
2320 checkClearOrgPolicyRequest(obj as api.ClearOrgPolicyRequest);
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002321
2322 var path = (req.url).path;
2323 var pathOffset = 0;
Kevin Moore6d21e902021-01-15 06:41:08 -08002324 core.int index;
2325 core.String subPart;
Martin Kustermann5eb85c12017-09-11 12:35:54 +02002326 unittest.expect(
Kevin Moore58e22332021-02-25 10:11:41 -08002327 path.substring(pathOffset, pathOffset + 1),
2328 unittest.equals("/"),
2329 );
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002330 pathOffset += 1;
Martin Kustermann5eb85c12017-09-11 12:35:54 +02002331 unittest.expect(
Kevin Moore58e22332021-02-25 10:11:41 -08002332 path.substring(pathOffset, pathOffset + 3),
2333 unittest.equals("v1/"),
2334 );
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002335 pathOffset += 3;
2336 // NOTE: We cannot test reserved expansions due to the inability to reverse the operation;
2337
2338 var query = (req.url).query;
2339 var queryOffset = 0;
Jakob Andersen52715df2018-05-01 13:58:48 +02002340 var queryMap = <core.String, core.List<core.String>>{};
Kevin Moore91f7e3e2021-01-26 07:51:20 -08002341 void addQueryParam(core.String n, core.String v) =>
2342 queryMap.putIfAbsent(n, () => []).add(v);
Martin Kustermann5eb85c12017-09-11 12:35:54 +02002343
Kevin Moore6d21e902021-01-15 06:41:08 -08002344 if (query.isNotEmpty) {
Kevin Moored0251702021-01-15 06:41:08 -08002345 for (var part in query.split('&')) {
2346 var keyValue = part.split('=');
Kevin Moore6d21e902021-01-15 06:41:08 -08002347 addQueryParam(
2348 core.Uri.decodeQueryComponent(keyValue[0]),
2349 core.Uri.decodeQueryComponent(keyValue[1]),
2350 );
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002351 }
2352 }
Kevin Moore58e22332021-02-25 10:11:41 -08002353 unittest.expect(
2354 queryMap["fields"]!.first,
2355 unittest.equals(arg_$fields),
2356 );
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002357
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002358 var h = {
Kevin Moored0251702021-01-15 06:41:08 -08002359 'content-type': 'application/json; charset=utf-8',
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002360 };
Jakob Andersen52715df2018-05-01 13:58:48 +02002361 var resp = convert.json.encode(buildEmpty());
Kevin Moore6d21e902021-01-15 06:41:08 -08002362 return async.Future.value(stringResponse(200, h, resp));
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002363 }), true);
Kevin Moore341348b2021-02-25 11:55:18 -08002364 final response = await res.clearOrgPolicy(arg_request, arg_resource,
2365 $fields: arg_$fields);
2366 checkEmpty(response as api.Empty);
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002367 });
2368
Kevin Moore341348b2021-02-25 11:55:18 -08002369 unittest.test('method--getEffectiveOrgPolicy', () async {
Kevin Moore6d21e902021-01-15 06:41:08 -08002370 var mock = HttpServerMock();
Kevin Moore5889af72021-01-28 13:31:53 -08002371 var res = api.CloudResourceManagerApi(mock).folders;
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002372 var arg_request = buildGetEffectiveOrgPolicyRequest();
Kevin Moored0251702021-01-15 06:41:08 -08002373 var arg_resource = 'foo';
2374 var arg_$fields = 'foo';
Martin Kustermann3953f0d2017-06-12 16:59:53 +02002375 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
Kevin Moorec4dbd8e2021-01-26 14:40:35 -08002376 var obj = api.GetEffectiveOrgPolicyRequest.fromJson(
2377 json as core.Map<core.String, core.dynamic>);
2378 checkGetEffectiveOrgPolicyRequest(
2379 obj as api.GetEffectiveOrgPolicyRequest);
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002380
2381 var path = (req.url).path;
2382 var pathOffset = 0;
Kevin Moore6d21e902021-01-15 06:41:08 -08002383 core.int index;
2384 core.String subPart;
Martin Kustermann5eb85c12017-09-11 12:35:54 +02002385 unittest.expect(
Kevin Moore58e22332021-02-25 10:11:41 -08002386 path.substring(pathOffset, pathOffset + 1),
2387 unittest.equals("/"),
2388 );
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002389 pathOffset += 1;
Martin Kustermann5eb85c12017-09-11 12:35:54 +02002390 unittest.expect(
Kevin Moore58e22332021-02-25 10:11:41 -08002391 path.substring(pathOffset, pathOffset + 3),
2392 unittest.equals("v1/"),
2393 );
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002394 pathOffset += 3;
2395 // NOTE: We cannot test reserved expansions due to the inability to reverse the operation;
2396
2397 var query = (req.url).query;
2398 var queryOffset = 0;
Jakob Andersen52715df2018-05-01 13:58:48 +02002399 var queryMap = <core.String, core.List<core.String>>{};
Kevin Moore91f7e3e2021-01-26 07:51:20 -08002400 void addQueryParam(core.String n, core.String v) =>
2401 queryMap.putIfAbsent(n, () => []).add(v);
Martin Kustermann5eb85c12017-09-11 12:35:54 +02002402
Kevin Moore6d21e902021-01-15 06:41:08 -08002403 if (query.isNotEmpty) {
Kevin Moored0251702021-01-15 06:41:08 -08002404 for (var part in query.split('&')) {
2405 var keyValue = part.split('=');
Kevin Moore6d21e902021-01-15 06:41:08 -08002406 addQueryParam(
2407 core.Uri.decodeQueryComponent(keyValue[0]),
2408 core.Uri.decodeQueryComponent(keyValue[1]),
2409 );
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002410 }
2411 }
Kevin Moore58e22332021-02-25 10:11:41 -08002412 unittest.expect(
2413 queryMap["fields"]!.first,
2414 unittest.equals(arg_$fields),
2415 );
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002416
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002417 var h = {
Kevin Moored0251702021-01-15 06:41:08 -08002418 'content-type': 'application/json; charset=utf-8',
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002419 };
Jakob Andersen52715df2018-05-01 13:58:48 +02002420 var resp = convert.json.encode(buildOrgPolicy());
Kevin Moore6d21e902021-01-15 06:41:08 -08002421 return async.Future.value(stringResponse(200, h, resp));
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002422 }), true);
Kevin Moore341348b2021-02-25 11:55:18 -08002423 final response = await res.getEffectiveOrgPolicy(
2424 arg_request, arg_resource,
2425 $fields: arg_$fields);
2426 checkOrgPolicy(response as api.OrgPolicy);
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002427 });
2428
Kevin Moore341348b2021-02-25 11:55:18 -08002429 unittest.test('method--getOrgPolicy', () async {
Kevin Moore6d21e902021-01-15 06:41:08 -08002430 var mock = HttpServerMock();
Kevin Moore5889af72021-01-28 13:31:53 -08002431 var res = api.CloudResourceManagerApi(mock).folders;
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002432 var arg_request = buildGetOrgPolicyRequest();
Kevin Moored0251702021-01-15 06:41:08 -08002433 var arg_resource = 'foo';
2434 var arg_$fields = 'foo';
Martin Kustermann3953f0d2017-06-12 16:59:53 +02002435 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
Kevin Moorec4dbd8e2021-01-26 14:40:35 -08002436 var obj = api.GetOrgPolicyRequest.fromJson(
2437 json as core.Map<core.String, core.dynamic>);
2438 checkGetOrgPolicyRequest(obj as api.GetOrgPolicyRequest);
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002439
2440 var path = (req.url).path;
2441 var pathOffset = 0;
Kevin Moore6d21e902021-01-15 06:41:08 -08002442 core.int index;
2443 core.String subPart;
Martin Kustermann5eb85c12017-09-11 12:35:54 +02002444 unittest.expect(
Kevin Moore58e22332021-02-25 10:11:41 -08002445 path.substring(pathOffset, pathOffset + 1),
2446 unittest.equals("/"),
2447 );
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002448 pathOffset += 1;
Martin Kustermann5eb85c12017-09-11 12:35:54 +02002449 unittest.expect(
Kevin Moore58e22332021-02-25 10:11:41 -08002450 path.substring(pathOffset, pathOffset + 3),
2451 unittest.equals("v1/"),
2452 );
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002453 pathOffset += 3;
2454 // NOTE: We cannot test reserved expansions due to the inability to reverse the operation;
2455
2456 var query = (req.url).query;
2457 var queryOffset = 0;
Jakob Andersen52715df2018-05-01 13:58:48 +02002458 var queryMap = <core.String, core.List<core.String>>{};
Kevin Moore91f7e3e2021-01-26 07:51:20 -08002459 void addQueryParam(core.String n, core.String v) =>
2460 queryMap.putIfAbsent(n, () => []).add(v);
Martin Kustermann5eb85c12017-09-11 12:35:54 +02002461
Kevin Moore6d21e902021-01-15 06:41:08 -08002462 if (query.isNotEmpty) {
Kevin Moored0251702021-01-15 06:41:08 -08002463 for (var part in query.split('&')) {
2464 var keyValue = part.split('=');
Kevin Moore6d21e902021-01-15 06:41:08 -08002465 addQueryParam(
2466 core.Uri.decodeQueryComponent(keyValue[0]),
2467 core.Uri.decodeQueryComponent(keyValue[1]),
2468 );
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002469 }
2470 }
Kevin Moore58e22332021-02-25 10:11:41 -08002471 unittest.expect(
2472 queryMap["fields"]!.first,
2473 unittest.equals(arg_$fields),
2474 );
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002475
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002476 var h = {
Kevin Moored0251702021-01-15 06:41:08 -08002477 'content-type': 'application/json; charset=utf-8',
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002478 };
Jakob Andersen52715df2018-05-01 13:58:48 +02002479 var resp = convert.json.encode(buildOrgPolicy());
Kevin Moore6d21e902021-01-15 06:41:08 -08002480 return async.Future.value(stringResponse(200, h, resp));
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002481 }), true);
Kevin Moore341348b2021-02-25 11:55:18 -08002482 final response = await res.getOrgPolicy(arg_request, arg_resource,
2483 $fields: arg_$fields);
2484 checkOrgPolicy(response as api.OrgPolicy);
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002485 });
2486
Kevin Moore341348b2021-02-25 11:55:18 -08002487 unittest.test('method--listAvailableOrgPolicyConstraints', () async {
Kevin Moore6d21e902021-01-15 06:41:08 -08002488 var mock = HttpServerMock();
Kevin Moore5889af72021-01-28 13:31:53 -08002489 var res = api.CloudResourceManagerApi(mock).folders;
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002490 var arg_request = buildListAvailableOrgPolicyConstraintsRequest();
Kevin Moored0251702021-01-15 06:41:08 -08002491 var arg_resource = 'foo';
2492 var arg_$fields = 'foo';
Martin Kustermann3953f0d2017-06-12 16:59:53 +02002493 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
Kevin Moorec4dbd8e2021-01-26 14:40:35 -08002494 var obj = api.ListAvailableOrgPolicyConstraintsRequest.fromJson(
2495 json as core.Map<core.String, core.dynamic>);
2496 checkListAvailableOrgPolicyConstraintsRequest(
2497 obj as api.ListAvailableOrgPolicyConstraintsRequest);
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002498
2499 var path = (req.url).path;
2500 var pathOffset = 0;
Kevin Moore6d21e902021-01-15 06:41:08 -08002501 core.int index;
2502 core.String subPart;
Martin Kustermann5eb85c12017-09-11 12:35:54 +02002503 unittest.expect(
Kevin Moore58e22332021-02-25 10:11:41 -08002504 path.substring(pathOffset, pathOffset + 1),
2505 unittest.equals("/"),
2506 );
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002507 pathOffset += 1;
Martin Kustermann5eb85c12017-09-11 12:35:54 +02002508 unittest.expect(
Kevin Moore58e22332021-02-25 10:11:41 -08002509 path.substring(pathOffset, pathOffset + 3),
2510 unittest.equals("v1/"),
2511 );
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002512 pathOffset += 3;
2513 // NOTE: We cannot test reserved expansions due to the inability to reverse the operation;
2514
2515 var query = (req.url).query;
2516 var queryOffset = 0;
Jakob Andersen52715df2018-05-01 13:58:48 +02002517 var queryMap = <core.String, core.List<core.String>>{};
Kevin Moore91f7e3e2021-01-26 07:51:20 -08002518 void addQueryParam(core.String n, core.String v) =>
2519 queryMap.putIfAbsent(n, () => []).add(v);
Martin Kustermann5eb85c12017-09-11 12:35:54 +02002520
Kevin Moore6d21e902021-01-15 06:41:08 -08002521 if (query.isNotEmpty) {
Kevin Moored0251702021-01-15 06:41:08 -08002522 for (var part in query.split('&')) {
2523 var keyValue = part.split('=');
Kevin Moore6d21e902021-01-15 06:41:08 -08002524 addQueryParam(
2525 core.Uri.decodeQueryComponent(keyValue[0]),
2526 core.Uri.decodeQueryComponent(keyValue[1]),
2527 );
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002528 }
2529 }
Kevin Moore58e22332021-02-25 10:11:41 -08002530 unittest.expect(
2531 queryMap["fields"]!.first,
2532 unittest.equals(arg_$fields),
2533 );
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002534
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002535 var h = {
Kevin Moored0251702021-01-15 06:41:08 -08002536 'content-type': 'application/json; charset=utf-8',
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002537 };
Jakob Andersen52715df2018-05-01 13:58:48 +02002538 var resp = convert.json
Martin Kustermann5eb85c12017-09-11 12:35:54 +02002539 .encode(buildListAvailableOrgPolicyConstraintsResponse());
Kevin Moore6d21e902021-01-15 06:41:08 -08002540 return async.Future.value(stringResponse(200, h, resp));
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002541 }), true);
Kevin Moore341348b2021-02-25 11:55:18 -08002542 final response = await res.listAvailableOrgPolicyConstraints(
2543 arg_request, arg_resource,
2544 $fields: arg_$fields);
2545 checkListAvailableOrgPolicyConstraintsResponse(
2546 response as api.ListAvailableOrgPolicyConstraintsResponse);
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002547 });
2548
Kevin Moore341348b2021-02-25 11:55:18 -08002549 unittest.test('method--listOrgPolicies', () async {
Kevin Moore6d21e902021-01-15 06:41:08 -08002550 var mock = HttpServerMock();
Kevin Moore5889af72021-01-28 13:31:53 -08002551 var res = api.CloudResourceManagerApi(mock).folders;
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002552 var arg_request = buildListOrgPoliciesRequest();
Kevin Moored0251702021-01-15 06:41:08 -08002553 var arg_resource = 'foo';
2554 var arg_$fields = 'foo';
Martin Kustermann3953f0d2017-06-12 16:59:53 +02002555 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
Kevin Moorec4dbd8e2021-01-26 14:40:35 -08002556 var obj = api.ListOrgPoliciesRequest.fromJson(
2557 json as core.Map<core.String, core.dynamic>);
2558 checkListOrgPoliciesRequest(obj as api.ListOrgPoliciesRequest);
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002559
2560 var path = (req.url).path;
2561 var pathOffset = 0;
Kevin Moore6d21e902021-01-15 06:41:08 -08002562 core.int index;
2563 core.String subPart;
Martin Kustermann5eb85c12017-09-11 12:35:54 +02002564 unittest.expect(
Kevin Moore58e22332021-02-25 10:11:41 -08002565 path.substring(pathOffset, pathOffset + 1),
2566 unittest.equals("/"),
2567 );
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002568 pathOffset += 1;
Martin Kustermann5eb85c12017-09-11 12:35:54 +02002569 unittest.expect(
Kevin Moore58e22332021-02-25 10:11:41 -08002570 path.substring(pathOffset, pathOffset + 3),
2571 unittest.equals("v1/"),
2572 );
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002573 pathOffset += 3;
2574 // NOTE: We cannot test reserved expansions due to the inability to reverse the operation;
2575
2576 var query = (req.url).query;
2577 var queryOffset = 0;
Jakob Andersen52715df2018-05-01 13:58:48 +02002578 var queryMap = <core.String, core.List<core.String>>{};
Kevin Moore91f7e3e2021-01-26 07:51:20 -08002579 void addQueryParam(core.String n, core.String v) =>
2580 queryMap.putIfAbsent(n, () => []).add(v);
Martin Kustermann5eb85c12017-09-11 12:35:54 +02002581
Kevin Moore6d21e902021-01-15 06:41:08 -08002582 if (query.isNotEmpty) {
Kevin Moored0251702021-01-15 06:41:08 -08002583 for (var part in query.split('&')) {
2584 var keyValue = part.split('=');
Kevin Moore6d21e902021-01-15 06:41:08 -08002585 addQueryParam(
2586 core.Uri.decodeQueryComponent(keyValue[0]),
2587 core.Uri.decodeQueryComponent(keyValue[1]),
2588 );
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002589 }
2590 }
Kevin Moore58e22332021-02-25 10:11:41 -08002591 unittest.expect(
2592 queryMap["fields"]!.first,
2593 unittest.equals(arg_$fields),
2594 );
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002595
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002596 var h = {
Kevin Moored0251702021-01-15 06:41:08 -08002597 'content-type': 'application/json; charset=utf-8',
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002598 };
Jakob Andersen52715df2018-05-01 13:58:48 +02002599 var resp = convert.json.encode(buildListOrgPoliciesResponse());
Kevin Moore6d21e902021-01-15 06:41:08 -08002600 return async.Future.value(stringResponse(200, h, resp));
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002601 }), true);
Kevin Moore341348b2021-02-25 11:55:18 -08002602 final response = await res.listOrgPolicies(arg_request, arg_resource,
2603 $fields: arg_$fields);
2604 checkListOrgPoliciesResponse(response as api.ListOrgPoliciesResponse);
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002605 });
2606
Kevin Moore341348b2021-02-25 11:55:18 -08002607 unittest.test('method--setOrgPolicy', () async {
Kevin Moore6d21e902021-01-15 06:41:08 -08002608 var mock = HttpServerMock();
Kevin Moore5889af72021-01-28 13:31:53 -08002609 var res = api.CloudResourceManagerApi(mock).folders;
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002610 var arg_request = buildSetOrgPolicyRequest();
Kevin Moored0251702021-01-15 06:41:08 -08002611 var arg_resource = 'foo';
2612 var arg_$fields = 'foo';
Martin Kustermann3953f0d2017-06-12 16:59:53 +02002613 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
Kevin Moorec4dbd8e2021-01-26 14:40:35 -08002614 var obj = api.SetOrgPolicyRequest.fromJson(
2615 json as core.Map<core.String, core.dynamic>);
2616 checkSetOrgPolicyRequest(obj as api.SetOrgPolicyRequest);
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002617
2618 var path = (req.url).path;
2619 var pathOffset = 0;
Kevin Moore6d21e902021-01-15 06:41:08 -08002620 core.int index;
2621 core.String subPart;
Martin Kustermann5eb85c12017-09-11 12:35:54 +02002622 unittest.expect(
Kevin Moore58e22332021-02-25 10:11:41 -08002623 path.substring(pathOffset, pathOffset + 1),
2624 unittest.equals("/"),
2625 );
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002626 pathOffset += 1;
Martin Kustermann5eb85c12017-09-11 12:35:54 +02002627 unittest.expect(
Kevin Moore58e22332021-02-25 10:11:41 -08002628 path.substring(pathOffset, pathOffset + 3),
2629 unittest.equals("v1/"),
2630 );
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002631 pathOffset += 3;
2632 // NOTE: We cannot test reserved expansions due to the inability to reverse the operation;
2633
2634 var query = (req.url).query;
2635 var queryOffset = 0;
Jakob Andersen52715df2018-05-01 13:58:48 +02002636 var queryMap = <core.String, core.List<core.String>>{};
Kevin Moore91f7e3e2021-01-26 07:51:20 -08002637 void addQueryParam(core.String n, core.String v) =>
2638 queryMap.putIfAbsent(n, () => []).add(v);
Martin Kustermann5eb85c12017-09-11 12:35:54 +02002639
Kevin Moore6d21e902021-01-15 06:41:08 -08002640 if (query.isNotEmpty) {
Kevin Moored0251702021-01-15 06:41:08 -08002641 for (var part in query.split('&')) {
2642 var keyValue = part.split('=');
Kevin Moore6d21e902021-01-15 06:41:08 -08002643 addQueryParam(
2644 core.Uri.decodeQueryComponent(keyValue[0]),
2645 core.Uri.decodeQueryComponent(keyValue[1]),
2646 );
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002647 }
2648 }
Kevin Moore58e22332021-02-25 10:11:41 -08002649 unittest.expect(
2650 queryMap["fields"]!.first,
2651 unittest.equals(arg_$fields),
2652 );
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002653
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002654 var h = {
Kevin Moored0251702021-01-15 06:41:08 -08002655 'content-type': 'application/json; charset=utf-8',
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002656 };
Jakob Andersen52715df2018-05-01 13:58:48 +02002657 var resp = convert.json.encode(buildOrgPolicy());
Kevin Moore6d21e902021-01-15 06:41:08 -08002658 return async.Future.value(stringResponse(200, h, resp));
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002659 }), true);
Kevin Moore341348b2021-02-25 11:55:18 -08002660 final response = await res.setOrgPolicy(arg_request, arg_resource,
2661 $fields: arg_$fields);
2662 checkOrgPolicy(response as api.OrgPolicy);
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002663 });
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002664 });
2665
Kevin Moore88512712021-01-28 14:43:28 -08002666 unittest.group('resource-LiensResource', () {
Kevin Moore341348b2021-02-25 11:55:18 -08002667 unittest.test('method--create', () async {
Kevin Moore6d21e902021-01-15 06:41:08 -08002668 var mock = HttpServerMock();
Kevin Moore5889af72021-01-28 13:31:53 -08002669 var res = api.CloudResourceManagerApi(mock).liens;
Martin Kustermann77f42ff2017-03-06 13:56:35 +01002670 var arg_request = buildLien();
Kevin Moored0251702021-01-15 06:41:08 -08002671 var arg_$fields = 'foo';
Martin Kustermann3953f0d2017-06-12 16:59:53 +02002672 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
Kevin Moorec4dbd8e2021-01-26 14:40:35 -08002673 var obj =
2674 api.Lien.fromJson(json as core.Map<core.String, core.dynamic>);
2675 checkLien(obj as api.Lien);
Martin Kustermann77f42ff2017-03-06 13:56:35 +01002676
2677 var path = (req.url).path;
2678 var pathOffset = 0;
Kevin Moore6d21e902021-01-15 06:41:08 -08002679 core.int index;
2680 core.String subPart;
Martin Kustermann5eb85c12017-09-11 12:35:54 +02002681 unittest.expect(
Kevin Moore58e22332021-02-25 10:11:41 -08002682 path.substring(pathOffset, pathOffset + 1),
2683 unittest.equals("/"),
2684 );
Martin Kustermann77f42ff2017-03-06 13:56:35 +01002685 pathOffset += 1;
Kevin Moore58e22332021-02-25 10:11:41 -08002686 unittest.expect(
2687 path.substring(pathOffset, pathOffset + 8),
2688 unittest.equals("v1/liens"),
2689 );
Martin Kustermann77f42ff2017-03-06 13:56:35 +01002690 pathOffset += 8;
2691
2692 var query = (req.url).query;
2693 var queryOffset = 0;
Jakob Andersen52715df2018-05-01 13:58:48 +02002694 var queryMap = <core.String, core.List<core.String>>{};
Kevin Moore91f7e3e2021-01-26 07:51:20 -08002695 void addQueryParam(core.String n, core.String v) =>
2696 queryMap.putIfAbsent(n, () => []).add(v);
Martin Kustermann5eb85c12017-09-11 12:35:54 +02002697
Kevin Moore6d21e902021-01-15 06:41:08 -08002698 if (query.isNotEmpty) {
Kevin Moored0251702021-01-15 06:41:08 -08002699 for (var part in query.split('&')) {
2700 var keyValue = part.split('=');
Kevin Moore6d21e902021-01-15 06:41:08 -08002701 addQueryParam(
2702 core.Uri.decodeQueryComponent(keyValue[0]),
2703 core.Uri.decodeQueryComponent(keyValue[1]),
2704 );
Martin Kustermann77f42ff2017-03-06 13:56:35 +01002705 }
2706 }
Kevin Moore58e22332021-02-25 10:11:41 -08002707 unittest.expect(
2708 queryMap["fields"]!.first,
2709 unittest.equals(arg_$fields),
2710 );
Martin Kustermann77f42ff2017-03-06 13:56:35 +01002711
Martin Kustermann77f42ff2017-03-06 13:56:35 +01002712 var h = {
Kevin Moored0251702021-01-15 06:41:08 -08002713 'content-type': 'application/json; charset=utf-8',
Martin Kustermann77f42ff2017-03-06 13:56:35 +01002714 };
Jakob Andersen52715df2018-05-01 13:58:48 +02002715 var resp = convert.json.encode(buildLien());
Kevin Moore6d21e902021-01-15 06:41:08 -08002716 return async.Future.value(stringResponse(200, h, resp));
Martin Kustermann77f42ff2017-03-06 13:56:35 +01002717 }), true);
Kevin Moore341348b2021-02-25 11:55:18 -08002718 final response = await res.create(arg_request, $fields: arg_$fields);
2719 checkLien(response as api.Lien);
Martin Kustermann77f42ff2017-03-06 13:56:35 +01002720 });
2721
Kevin Moore341348b2021-02-25 11:55:18 -08002722 unittest.test('method--delete', () async {
Kevin Moore6d21e902021-01-15 06:41:08 -08002723 var mock = HttpServerMock();
Kevin Moore5889af72021-01-28 13:31:53 -08002724 var res = api.CloudResourceManagerApi(mock).liens;
Kevin Moored0251702021-01-15 06:41:08 -08002725 var arg_name = 'foo';
2726 var arg_$fields = 'foo';
Martin Kustermann3953f0d2017-06-12 16:59:53 +02002727 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
Martin Kustermann77f42ff2017-03-06 13:56:35 +01002728 var path = (req.url).path;
2729 var pathOffset = 0;
Kevin Moore6d21e902021-01-15 06:41:08 -08002730 core.int index;
2731 core.String subPart;
Martin Kustermann5eb85c12017-09-11 12:35:54 +02002732 unittest.expect(
Kevin Moore58e22332021-02-25 10:11:41 -08002733 path.substring(pathOffset, pathOffset + 1),
2734 unittest.equals("/"),
2735 );
Martin Kustermann77f42ff2017-03-06 13:56:35 +01002736 pathOffset += 1;
Martin Kustermann5eb85c12017-09-11 12:35:54 +02002737 unittest.expect(
Kevin Moore58e22332021-02-25 10:11:41 -08002738 path.substring(pathOffset, pathOffset + 3),
2739 unittest.equals("v1/"),
2740 );
Martin Kustermann77f42ff2017-03-06 13:56:35 +01002741 pathOffset += 3;
2742 // NOTE: We cannot test reserved expansions due to the inability to reverse the operation;
2743
2744 var query = (req.url).query;
2745 var queryOffset = 0;
Jakob Andersen52715df2018-05-01 13:58:48 +02002746 var queryMap = <core.String, core.List<core.String>>{};
Kevin Moore91f7e3e2021-01-26 07:51:20 -08002747 void addQueryParam(core.String n, core.String v) =>
2748 queryMap.putIfAbsent(n, () => []).add(v);
Martin Kustermann5eb85c12017-09-11 12:35:54 +02002749
Kevin Moore6d21e902021-01-15 06:41:08 -08002750 if (query.isNotEmpty) {
Kevin Moored0251702021-01-15 06:41:08 -08002751 for (var part in query.split('&')) {
2752 var keyValue = part.split('=');
Kevin Moore6d21e902021-01-15 06:41:08 -08002753 addQueryParam(
2754 core.Uri.decodeQueryComponent(keyValue[0]),
2755 core.Uri.decodeQueryComponent(keyValue[1]),
2756 );
Martin Kustermann77f42ff2017-03-06 13:56:35 +01002757 }
2758 }
Kevin Moore58e22332021-02-25 10:11:41 -08002759 unittest.expect(
2760 queryMap["fields"]!.first,
2761 unittest.equals(arg_$fields),
2762 );
Martin Kustermann77f42ff2017-03-06 13:56:35 +01002763
Martin Kustermann77f42ff2017-03-06 13:56:35 +01002764 var h = {
Kevin Moored0251702021-01-15 06:41:08 -08002765 'content-type': 'application/json; charset=utf-8',
Martin Kustermann77f42ff2017-03-06 13:56:35 +01002766 };
Jakob Andersen52715df2018-05-01 13:58:48 +02002767 var resp = convert.json.encode(buildEmpty());
Kevin Moore6d21e902021-01-15 06:41:08 -08002768 return async.Future.value(stringResponse(200, h, resp));
Martin Kustermann77f42ff2017-03-06 13:56:35 +01002769 }), true);
Kevin Moore341348b2021-02-25 11:55:18 -08002770 final response = await res.delete(arg_name, $fields: arg_$fields);
2771 checkEmpty(response as api.Empty);
Martin Kustermann77f42ff2017-03-06 13:56:35 +01002772 });
2773
Kevin Moore341348b2021-02-25 11:55:18 -08002774 unittest.test('method--get', () async {
Kevin Moore6d21e902021-01-15 06:41:08 -08002775 var mock = HttpServerMock();
Kevin Moore5889af72021-01-28 13:31:53 -08002776 var res = api.CloudResourceManagerApi(mock).liens;
Kevin Moored0251702021-01-15 06:41:08 -08002777 var arg_name = 'foo';
2778 var arg_$fields = 'foo';
Martin Kustermann12cdd522018-08-27 10:46:50 +02002779 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
2780 var path = (req.url).path;
2781 var pathOffset = 0;
Kevin Moore6d21e902021-01-15 06:41:08 -08002782 core.int index;
2783 core.String subPart;
Martin Kustermann12cdd522018-08-27 10:46:50 +02002784 unittest.expect(
Kevin Moore58e22332021-02-25 10:11:41 -08002785 path.substring(pathOffset, pathOffset + 1),
2786 unittest.equals("/"),
2787 );
Martin Kustermann12cdd522018-08-27 10:46:50 +02002788 pathOffset += 1;
2789 unittest.expect(
Kevin Moore58e22332021-02-25 10:11:41 -08002790 path.substring(pathOffset, pathOffset + 3),
2791 unittest.equals("v1/"),
2792 );
Martin Kustermann12cdd522018-08-27 10:46:50 +02002793 pathOffset += 3;
2794 // NOTE: We cannot test reserved expansions due to the inability to reverse the operation;
2795
2796 var query = (req.url).query;
2797 var queryOffset = 0;
2798 var queryMap = <core.String, core.List<core.String>>{};
Kevin Moore91f7e3e2021-01-26 07:51:20 -08002799 void addQueryParam(core.String n, core.String v) =>
2800 queryMap.putIfAbsent(n, () => []).add(v);
Martin Kustermann12cdd522018-08-27 10:46:50 +02002801
Kevin Moore6d21e902021-01-15 06:41:08 -08002802 if (query.isNotEmpty) {
Kevin Moored0251702021-01-15 06:41:08 -08002803 for (var part in query.split('&')) {
2804 var keyValue = part.split('=');
Kevin Moore6d21e902021-01-15 06:41:08 -08002805 addQueryParam(
2806 core.Uri.decodeQueryComponent(keyValue[0]),
2807 core.Uri.decodeQueryComponent(keyValue[1]),
2808 );
Martin Kustermann12cdd522018-08-27 10:46:50 +02002809 }
2810 }
Kevin Moore58e22332021-02-25 10:11:41 -08002811 unittest.expect(
2812 queryMap["fields"]!.first,
2813 unittest.equals(arg_$fields),
2814 );
Martin Kustermann12cdd522018-08-27 10:46:50 +02002815
2816 var h = {
Kevin Moored0251702021-01-15 06:41:08 -08002817 'content-type': 'application/json; charset=utf-8',
Martin Kustermann12cdd522018-08-27 10:46:50 +02002818 };
2819 var resp = convert.json.encode(buildLien());
Kevin Moore6d21e902021-01-15 06:41:08 -08002820 return async.Future.value(stringResponse(200, h, resp));
Martin Kustermann12cdd522018-08-27 10:46:50 +02002821 }), true);
Kevin Moore341348b2021-02-25 11:55:18 -08002822 final response = await res.get(arg_name, $fields: arg_$fields);
2823 checkLien(response as api.Lien);
Martin Kustermann12cdd522018-08-27 10:46:50 +02002824 });
2825
Kevin Moore341348b2021-02-25 11:55:18 -08002826 unittest.test('method--list', () async {
Kevin Moore6d21e902021-01-15 06:41:08 -08002827 var mock = HttpServerMock();
Kevin Moore5889af72021-01-28 13:31:53 -08002828 var res = api.CloudResourceManagerApi(mock).liens;
Jonas Finnemann Jensenef0c8a32020-10-07 20:58:20 +02002829 var arg_pageSize = 42;
Kevin Moored0251702021-01-15 06:41:08 -08002830 var arg_pageToken = 'foo';
Kevin Moore8810e8b2021-01-19 13:22:15 -08002831 var arg_parent = 'foo';
Kevin Moored0251702021-01-15 06:41:08 -08002832 var arg_$fields = 'foo';
Martin Kustermann3953f0d2017-06-12 16:59:53 +02002833 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
Martin Kustermann77f42ff2017-03-06 13:56:35 +01002834 var path = (req.url).path;
2835 var pathOffset = 0;
Kevin Moore6d21e902021-01-15 06:41:08 -08002836 core.int index;
2837 core.String subPart;
Martin Kustermann5eb85c12017-09-11 12:35:54 +02002838 unittest.expect(
Kevin Moore58e22332021-02-25 10:11:41 -08002839 path.substring(pathOffset, pathOffset + 1),
2840 unittest.equals("/"),
2841 );
Martin Kustermann77f42ff2017-03-06 13:56:35 +01002842 pathOffset += 1;
Kevin Moore58e22332021-02-25 10:11:41 -08002843 unittest.expect(
2844 path.substring(pathOffset, pathOffset + 8),
2845 unittest.equals("v1/liens"),
2846 );
Martin Kustermann77f42ff2017-03-06 13:56:35 +01002847 pathOffset += 8;
2848
2849 var query = (req.url).query;
2850 var queryOffset = 0;
Jakob Andersen52715df2018-05-01 13:58:48 +02002851 var queryMap = <core.String, core.List<core.String>>{};
Kevin Moore91f7e3e2021-01-26 07:51:20 -08002852 void addQueryParam(core.String n, core.String v) =>
2853 queryMap.putIfAbsent(n, () => []).add(v);
Martin Kustermann5eb85c12017-09-11 12:35:54 +02002854
Kevin Moore6d21e902021-01-15 06:41:08 -08002855 if (query.isNotEmpty) {
Kevin Moored0251702021-01-15 06:41:08 -08002856 for (var part in query.split('&')) {
2857 var keyValue = part.split('=');
Kevin Moore6d21e902021-01-15 06:41:08 -08002858 addQueryParam(
2859 core.Uri.decodeQueryComponent(keyValue[0]),
2860 core.Uri.decodeQueryComponent(keyValue[1]),
2861 );
Martin Kustermann77f42ff2017-03-06 13:56:35 +01002862 }
2863 }
Jonas Finnemann Jensenb223bd52020-10-09 13:02:08 +02002864 unittest.expect(
Kevin Moore58e22332021-02-25 10:11:41 -08002865 core.int.parse(queryMap["pageSize"]!.first),
2866 unittest.equals(arg_pageSize),
2867 );
2868 unittest.expect(
2869 queryMap["pageToken"]!.first,
2870 unittest.equals(arg_pageToken),
2871 );
2872 unittest.expect(
2873 queryMap["parent"]!.first,
2874 unittest.equals(arg_parent),
2875 );
2876 unittest.expect(
2877 queryMap["fields"]!.first,
2878 unittest.equals(arg_$fields),
2879 );
Martin Kustermann77f42ff2017-03-06 13:56:35 +01002880
2881 var h = {
Kevin Moored0251702021-01-15 06:41:08 -08002882 'content-type': 'application/json; charset=utf-8',
Martin Kustermann77f42ff2017-03-06 13:56:35 +01002883 };
Jakob Andersen52715df2018-05-01 13:58:48 +02002884 var resp = convert.json.encode(buildListLiensResponse());
Kevin Moore6d21e902021-01-15 06:41:08 -08002885 return async.Future.value(stringResponse(200, h, resp));
Martin Kustermann77f42ff2017-03-06 13:56:35 +01002886 }), true);
Kevin Moore341348b2021-02-25 11:55:18 -08002887 final response = await res.list(
2888 pageSize: arg_pageSize,
2889 pageToken: arg_pageToken,
2890 parent: arg_parent,
2891 $fields: arg_$fields);
2892 checkListLiensResponse(response as api.ListLiensResponse);
Martin Kustermann77f42ff2017-03-06 13:56:35 +01002893 });
Martin Kustermann77f42ff2017-03-06 13:56:35 +01002894 });
2895
Kevin Moore88512712021-01-28 14:43:28 -08002896 unittest.group('resource-OperationsResource', () {
Kevin Moore341348b2021-02-25 11:55:18 -08002897 unittest.test('method--get', () async {
Kevin Moore6d21e902021-01-15 06:41:08 -08002898 var mock = HttpServerMock();
Kevin Moore5889af72021-01-28 13:31:53 -08002899 var res = api.CloudResourceManagerApi(mock).operations;
Kevin Moored0251702021-01-15 06:41:08 -08002900 var arg_name = 'foo';
2901 var arg_$fields = 'foo';
Martin Kustermann3953f0d2017-06-12 16:59:53 +02002902 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
Søren Gjessee98c52c2016-06-27 11:06:50 +02002903 var path = (req.url).path;
2904 var pathOffset = 0;
Kevin Moore6d21e902021-01-15 06:41:08 -08002905 core.int index;
2906 core.String subPart;
Martin Kustermann5eb85c12017-09-11 12:35:54 +02002907 unittest.expect(
Kevin Moore58e22332021-02-25 10:11:41 -08002908 path.substring(pathOffset, pathOffset + 1),
2909 unittest.equals("/"),
2910 );
Søren Gjessee98c52c2016-06-27 11:06:50 +02002911 pathOffset += 1;
Martin Kustermann5eb85c12017-09-11 12:35:54 +02002912 unittest.expect(
Kevin Moore58e22332021-02-25 10:11:41 -08002913 path.substring(pathOffset, pathOffset + 3),
2914 unittest.equals("v1/"),
2915 );
Søren Gjessee98c52c2016-06-27 11:06:50 +02002916 pathOffset += 3;
2917 // NOTE: We cannot test reserved expansions due to the inability to reverse the operation;
2918
2919 var query = (req.url).query;
2920 var queryOffset = 0;
Jakob Andersen52715df2018-05-01 13:58:48 +02002921 var queryMap = <core.String, core.List<core.String>>{};
Kevin Moore91f7e3e2021-01-26 07:51:20 -08002922 void addQueryParam(core.String n, core.String v) =>
2923 queryMap.putIfAbsent(n, () => []).add(v);
Martin Kustermann5eb85c12017-09-11 12:35:54 +02002924
Kevin Moore6d21e902021-01-15 06:41:08 -08002925 if (query.isNotEmpty) {
Kevin Moored0251702021-01-15 06:41:08 -08002926 for (var part in query.split('&')) {
2927 var keyValue = part.split('=');
Kevin Moore6d21e902021-01-15 06:41:08 -08002928 addQueryParam(
2929 core.Uri.decodeQueryComponent(keyValue[0]),
2930 core.Uri.decodeQueryComponent(keyValue[1]),
2931 );
Søren Gjessee98c52c2016-06-27 11:06:50 +02002932 }
2933 }
Kevin Moore58e22332021-02-25 10:11:41 -08002934 unittest.expect(
2935 queryMap["fields"]!.first,
2936 unittest.equals(arg_$fields),
2937 );
Søren Gjessee98c52c2016-06-27 11:06:50 +02002938
Søren Gjessee98c52c2016-06-27 11:06:50 +02002939 var h = {
Kevin Moored0251702021-01-15 06:41:08 -08002940 'content-type': 'application/json; charset=utf-8',
Søren Gjessee98c52c2016-06-27 11:06:50 +02002941 };
Jakob Andersen52715df2018-05-01 13:58:48 +02002942 var resp = convert.json.encode(buildOperation());
Kevin Moore6d21e902021-01-15 06:41:08 -08002943 return async.Future.value(stringResponse(200, h, resp));
Søren Gjessee98c52c2016-06-27 11:06:50 +02002944 }), true);
Kevin Moore341348b2021-02-25 11:55:18 -08002945 final response = await res.get(arg_name, $fields: arg_$fields);
2946 checkOperation(response as api.Operation);
Søren Gjessee98c52c2016-06-27 11:06:50 +02002947 });
Søren Gjessee98c52c2016-06-27 11:06:50 +02002948 });
2949
Kevin Moore88512712021-01-28 14:43:28 -08002950 unittest.group('resource-OrganizationsResource', () {
Kevin Moore341348b2021-02-25 11:55:18 -08002951 unittest.test('method--clearOrgPolicy', () async {
Kevin Moore6d21e902021-01-15 06:41:08 -08002952 var mock = HttpServerMock();
Kevin Moore5889af72021-01-28 13:31:53 -08002953 var res = api.CloudResourceManagerApi(mock).organizations;
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002954 var arg_request = buildClearOrgPolicyRequest();
Kevin Moored0251702021-01-15 06:41:08 -08002955 var arg_resource = 'foo';
2956 var arg_$fields = 'foo';
Martin Kustermann3953f0d2017-06-12 16:59:53 +02002957 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
Kevin Moorec4dbd8e2021-01-26 14:40:35 -08002958 var obj = api.ClearOrgPolicyRequest.fromJson(
2959 json as core.Map<core.String, core.dynamic>);
2960 checkClearOrgPolicyRequest(obj as api.ClearOrgPolicyRequest);
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002961
2962 var path = (req.url).path;
2963 var pathOffset = 0;
Kevin Moore6d21e902021-01-15 06:41:08 -08002964 core.int index;
2965 core.String subPart;
Martin Kustermann5eb85c12017-09-11 12:35:54 +02002966 unittest.expect(
Kevin Moore58e22332021-02-25 10:11:41 -08002967 path.substring(pathOffset, pathOffset + 1),
2968 unittest.equals("/"),
2969 );
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002970 pathOffset += 1;
Martin Kustermann5eb85c12017-09-11 12:35:54 +02002971 unittest.expect(
Kevin Moore58e22332021-02-25 10:11:41 -08002972 path.substring(pathOffset, pathOffset + 3),
2973 unittest.equals("v1/"),
2974 );
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002975 pathOffset += 3;
2976 // NOTE: We cannot test reserved expansions due to the inability to reverse the operation;
2977
2978 var query = (req.url).query;
2979 var queryOffset = 0;
Jakob Andersen52715df2018-05-01 13:58:48 +02002980 var queryMap = <core.String, core.List<core.String>>{};
Kevin Moore91f7e3e2021-01-26 07:51:20 -08002981 void addQueryParam(core.String n, core.String v) =>
2982 queryMap.putIfAbsent(n, () => []).add(v);
Martin Kustermann5eb85c12017-09-11 12:35:54 +02002983
Kevin Moore6d21e902021-01-15 06:41:08 -08002984 if (query.isNotEmpty) {
Kevin Moored0251702021-01-15 06:41:08 -08002985 for (var part in query.split('&')) {
2986 var keyValue = part.split('=');
Kevin Moore6d21e902021-01-15 06:41:08 -08002987 addQueryParam(
2988 core.Uri.decodeQueryComponent(keyValue[0]),
2989 core.Uri.decodeQueryComponent(keyValue[1]),
2990 );
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002991 }
2992 }
Kevin Moore58e22332021-02-25 10:11:41 -08002993 unittest.expect(
2994 queryMap["fields"]!.first,
2995 unittest.equals(arg_$fields),
2996 );
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002997
Martin Kustermanna6d0a322017-03-27 13:52:31 +02002998 var h = {
Kevin Moored0251702021-01-15 06:41:08 -08002999 'content-type': 'application/json; charset=utf-8',
Martin Kustermanna6d0a322017-03-27 13:52:31 +02003000 };
Jakob Andersen52715df2018-05-01 13:58:48 +02003001 var resp = convert.json.encode(buildEmpty());
Kevin Moore6d21e902021-01-15 06:41:08 -08003002 return async.Future.value(stringResponse(200, h, resp));
Martin Kustermanna6d0a322017-03-27 13:52:31 +02003003 }), true);
Kevin Moore341348b2021-02-25 11:55:18 -08003004 final response = await res.clearOrgPolicy(arg_request, arg_resource,
3005 $fields: arg_$fields);
3006 checkEmpty(response as api.Empty);
Martin Kustermanna6d0a322017-03-27 13:52:31 +02003007 });
3008
Kevin Moore341348b2021-02-25 11:55:18 -08003009 unittest.test('method--get', () async {
Kevin Moore6d21e902021-01-15 06:41:08 -08003010 var mock = HttpServerMock();
Kevin Moore5889af72021-01-28 13:31:53 -08003011 var res = api.CloudResourceManagerApi(mock).organizations;
Kevin Moored0251702021-01-15 06:41:08 -08003012 var arg_name = 'foo';
3013 var arg_$fields = 'foo';
Martin Kustermann3953f0d2017-06-12 16:59:53 +02003014 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
Martin Kustermann4ff71db2016-11-09 10:46:40 +01003015 var path = (req.url).path;
3016 var pathOffset = 0;
Kevin Moore6d21e902021-01-15 06:41:08 -08003017 core.int index;
3018 core.String subPart;
Martin Kustermann5eb85c12017-09-11 12:35:54 +02003019 unittest.expect(
Kevin Moore58e22332021-02-25 10:11:41 -08003020 path.substring(pathOffset, pathOffset + 1),
3021 unittest.equals("/"),
3022 );
Martin Kustermann4ff71db2016-11-09 10:46:40 +01003023 pathOffset += 1;
Martin Kustermann5eb85c12017-09-11 12:35:54 +02003024 unittest.expect(
Kevin Moore58e22332021-02-25 10:11:41 -08003025 path.substring(pathOffset, pathOffset + 3),
3026 unittest.equals("v1/"),
3027 );
Martin Kustermann4ff71db2016-11-09 10:46:40 +01003028 pathOffset += 3;
3029 // NOTE: We cannot test reserved expansions due to the inability to reverse the operation;
3030
3031 var query = (req.url).query;
3032 var queryOffset = 0;
Jakob Andersen52715df2018-05-01 13:58:48 +02003033 var queryMap = <core.String, core.List<core.String>>{};
Kevin Moore91f7e3e2021-01-26 07:51:20 -08003034 void addQueryParam(core.String n, core.String v) =>
3035 queryMap.putIfAbsent(n, () => []).add(v);
Martin Kustermann5eb85c12017-09-11 12:35:54 +02003036
Kevin Moore6d21e902021-01-15 06:41:08 -08003037 if (query.isNotEmpty) {
Kevin Moored0251702021-01-15 06:41:08 -08003038 for (var part in query.split('&')) {
3039 var keyValue = part.split('=');
Kevin Moore6d21e902021-01-15 06:41:08 -08003040 addQueryParam(
3041 core.Uri.decodeQueryComponent(keyValue[0]),
3042 core.Uri.decodeQueryComponent(keyValue[1]),
3043 );
Martin Kustermann4ff71db2016-11-09 10:46:40 +01003044 }
3045 }
Kevin Moore58e22332021-02-25 10:11:41 -08003046 unittest.expect(
3047 queryMap["fields"]!.first,
3048 unittest.equals(arg_$fields),
3049 );
Martin Kustermann4ff71db2016-11-09 10:46:40 +01003050
Martin Kustermann4ff71db2016-11-09 10:46:40 +01003051 var h = {
Kevin Moored0251702021-01-15 06:41:08 -08003052 'content-type': 'application/json; charset=utf-8',
Martin Kustermann4ff71db2016-11-09 10:46:40 +01003053 };
Jakob Andersen52715df2018-05-01 13:58:48 +02003054 var resp = convert.json.encode(buildOrganization());
Kevin Moore6d21e902021-01-15 06:41:08 -08003055 return async.Future.value(stringResponse(200, h, resp));
Martin Kustermann4ff71db2016-11-09 10:46:40 +01003056 }), true);
Kevin Moore341348b2021-02-25 11:55:18 -08003057 final response = await res.get(arg_name, $fields: arg_$fields);
3058 checkOrganization(response as api.Organization);
Martin Kustermann4ff71db2016-11-09 10:46:40 +01003059 });
3060
Kevin Moore341348b2021-02-25 11:55:18 -08003061 unittest.test('method--getEffectiveOrgPolicy', () async {
Kevin Moore6d21e902021-01-15 06:41:08 -08003062 var mock = HttpServerMock();
Kevin Moore5889af72021-01-28 13:31:53 -08003063 var res = api.CloudResourceManagerApi(mock).organizations;
Martin Kustermanna6d0a322017-03-27 13:52:31 +02003064 var arg_request = buildGetEffectiveOrgPolicyRequest();
Kevin Moored0251702021-01-15 06:41:08 -08003065 var arg_resource = 'foo';
3066 var arg_$fields = 'foo';
Martin Kustermann3953f0d2017-06-12 16:59:53 +02003067 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
Kevin Moorec4dbd8e2021-01-26 14:40:35 -08003068 var obj = api.GetEffectiveOrgPolicyRequest.fromJson(
3069 json as core.Map<core.String, core.dynamic>);
3070 checkGetEffectiveOrgPolicyRequest(
3071 obj as api.GetEffectiveOrgPolicyRequest);
Martin Kustermanna6d0a322017-03-27 13:52:31 +02003072
3073 var path = (req.url).path;
3074 var pathOffset = 0;
Kevin Moore6d21e902021-01-15 06:41:08 -08003075 core.int index;
3076 core.String subPart;
Martin Kustermann5eb85c12017-09-11 12:35:54 +02003077 unittest.expect(
Kevin Moore58e22332021-02-25 10:11:41 -08003078 path.substring(pathOffset, pathOffset + 1),
3079 unittest.equals("/"),
3080 );
Martin Kustermanna6d0a322017-03-27 13:52:31 +02003081 pathOffset += 1;
Martin Kustermann5eb85c12017-09-11 12:35:54 +02003082 unittest.expect(
Kevin Moore58e22332021-02-25 10:11:41 -08003083 path.substring(pathOffset, pathOffset + 3),
3084 unittest.equals("v1/"),
3085 );
Martin Kustermanna6d0a322017-03-27 13:52:31 +02003086 pathOffset += 3;
3087 // NOTE: We cannot test reserved expansions due to the inability to reverse the operation;
3088
3089 var query = (req.url).query;
3090 var queryOffset = 0;
Jakob Andersen52715df2018-05-01 13:58:48 +02003091 var queryMap = <core.String, core.List<core.String>>{};
Kevin Moore91f7e3e2021-01-26 07:51:20 -08003092 void addQueryParam(core.String n, core.String v) =>
3093 queryMap.putIfAbsent(n, () => []).add(v);
Martin Kustermann5eb85c12017-09-11 12:35:54 +02003094
Kevin Moore6d21e902021-01-15 06:41:08 -08003095 if (query.isNotEmpty) {
Kevin Moored0251702021-01-15 06:41:08 -08003096 for (var part in query.split('&')) {
3097 var keyValue = part.split('=');
Kevin Moore6d21e902021-01-15 06:41:08 -08003098 addQueryParam(
3099 core.Uri.decodeQueryComponent(keyValue[0]),
3100 core.Uri.decodeQueryComponent(keyValue[1]),
3101 );
Martin Kustermanna6d0a322017-03-27 13:52:31 +02003102 }
3103 }
Kevin Moore58e22332021-02-25 10:11:41 -08003104 unittest.expect(
3105 queryMap["fields"]!.first,
3106 unittest.equals(arg_$fields),
3107 );
Martin Kustermanna6d0a322017-03-27 13:52:31 +02003108
Martin Kustermanna6d0a322017-03-27 13:52:31 +02003109 var h = {
Kevin Moored0251702021-01-15 06:41:08 -08003110 'content-type': 'application/json; charset=utf-8',
Martin Kustermanna6d0a322017-03-27 13:52:31 +02003111 };
Jakob Andersen52715df2018-05-01 13:58:48 +02003112 var resp = convert.json.encode(buildOrgPolicy());
Kevin Moore6d21e902021-01-15 06:41:08 -08003113 return async.Future.value(stringResponse(200, h, resp));
Martin Kustermanna6d0a322017-03-27 13:52:31 +02003114 }), true);
Kevin Moore341348b2021-02-25 11:55:18 -08003115 final response = await res.getEffectiveOrgPolicy(
3116 arg_request, arg_resource,
3117 $fields: arg_$fields);
3118 checkOrgPolicy(response as api.OrgPolicy);
Martin Kustermanna6d0a322017-03-27 13:52:31 +02003119 });
3120
Kevin Moore341348b2021-02-25 11:55:18 -08003121 unittest.test('method--getIamPolicy', () async {
Kevin Moore6d21e902021-01-15 06:41:08 -08003122 var mock = HttpServerMock();
Kevin Moore5889af72021-01-28 13:31:53 -08003123 var res = api.CloudResourceManagerApi(mock).organizations;
Martin Kustermann4ff71db2016-11-09 10:46:40 +01003124 var arg_request = buildGetIamPolicyRequest();
Kevin Moored0251702021-01-15 06:41:08 -08003125 var arg_resource = 'foo';
3126 var arg_$fields = 'foo';
Martin Kustermann3953f0d2017-06-12 16:59:53 +02003127 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
Kevin Moorec4dbd8e2021-01-26 14:40:35 -08003128 var obj = api.GetIamPolicyRequest.fromJson(
3129 json as core.Map<core.String, core.dynamic>);
3130 checkGetIamPolicyRequest(obj as api.GetIamPolicyRequest);
Martin Kustermann4ff71db2016-11-09 10:46:40 +01003131
3132 var path = (req.url).path;
3133 var pathOffset = 0;
Kevin Moore6d21e902021-01-15 06:41:08 -08003134 core.int index;
3135 core.String subPart;
Martin Kustermann5eb85c12017-09-11 12:35:54 +02003136 unittest.expect(
Kevin Moore58e22332021-02-25 10:11:41 -08003137 path.substring(pathOffset, pathOffset + 1),
3138 unittest.equals("/"),
3139 );
Martin Kustermann4ff71db2016-11-09 10:46:40 +01003140 pathOffset += 1;
Martin Kustermann5eb85c12017-09-11 12:35:54 +02003141 unittest.expect(
Kevin Moore58e22332021-02-25 10:11:41 -08003142 path.substring(pathOffset, pathOffset + 3),
3143 unittest.equals("v1/"),
3144 );
Martin Kustermann4ff71db2016-11-09 10:46:40 +01003145 pathOffset += 3;
3146 // NOTE: We cannot test reserved expansions due to the inability to reverse the operation;
3147
3148 var query = (req.url).query;
3149 var queryOffset = 0;
Jakob Andersen52715df2018-05-01 13:58:48 +02003150 var queryMap = <core.String, core.List<core.String>>{};
Kevin Moore91f7e3e2021-01-26 07:51:20 -08003151 void addQueryParam(core.String n, core.String v) =>
3152 queryMap.putIfAbsent(n, () => []).add(v);
Martin Kustermann5eb85c12017-09-11 12:35:54 +02003153
Kevin Moore6d21e902021-01-15 06:41:08 -08003154 if (query.isNotEmpty) {
Kevin Moored0251702021-01-15 06:41:08 -08003155 for (var part in query.split('&')) {
3156 var keyValue = part.split('=');
Kevin Moore6d21e902021-01-15 06:41:08 -08003157 addQueryParam(
3158 core.Uri.decodeQueryComponent(keyValue[0]),
3159 core.Uri.decodeQueryComponent(keyValue[1]),
3160 );
Martin Kustermann4ff71db2016-11-09 10:46:40 +01003161 }
3162 }
Kevin Moore58e22332021-02-25 10:11:41 -08003163 unittest.expect(
3164 queryMap["fields"]!.first,
3165 unittest.equals(arg_$fields),
3166 );
Martin Kustermann4ff71db2016-11-09 10:46:40 +01003167
Martin Kustermann4ff71db2016-11-09 10:46:40 +01003168 var h = {
Kevin Moored0251702021-01-15 06:41:08 -08003169 'content-type': 'application/json; charset=utf-8',
Martin Kustermann4ff71db2016-11-09 10:46:40 +01003170 };
Jakob Andersen52715df2018-05-01 13:58:48 +02003171 var resp = convert.json.encode(buildPolicy());
Kevin Moore6d21e902021-01-15 06:41:08 -08003172 return async.Future.value(stringResponse(200, h, resp));
Martin Kustermann4ff71db2016-11-09 10:46:40 +01003173 }), true);
Kevin Moore341348b2021-02-25 11:55:18 -08003174 final response = await res.getIamPolicy(arg_request, arg_resource,
3175 $fields: arg_$fields);
3176 checkPolicy(response as api.Policy);
Martin Kustermann4ff71db2016-11-09 10:46:40 +01003177 });
3178
Kevin Moore341348b2021-02-25 11:55:18 -08003179 unittest.test('method--getOrgPolicy', () async {
Kevin Moore6d21e902021-01-15 06:41:08 -08003180 var mock = HttpServerMock();
Kevin Moore5889af72021-01-28 13:31:53 -08003181 var res = api.CloudResourceManagerApi(mock).organizations;
Martin Kustermanna6d0a322017-03-27 13:52:31 +02003182 var arg_request = buildGetOrgPolicyRequest();
Kevin Moored0251702021-01-15 06:41:08 -08003183 var arg_resource = 'foo';
3184 var arg_$fields = 'foo';
Martin Kustermann3953f0d2017-06-12 16:59:53 +02003185 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
Kevin Moorec4dbd8e2021-01-26 14:40:35 -08003186 var obj = api.GetOrgPolicyRequest.fromJson(
3187 json as core.Map<core.String, core.dynamic>);
3188 checkGetOrgPolicyRequest(obj as api.GetOrgPolicyRequest);
Martin Kustermanna6d0a322017-03-27 13:52:31 +02003189
3190 var path = (req.url).path;
3191 var pathOffset = 0;
Kevin Moore6d21e902021-01-15 06:41:08 -08003192 core.int index;
3193 core.String subPart;
Martin Kustermann5eb85c12017-09-11 12:35:54 +02003194 unittest.expect(
Kevin Moore58e22332021-02-25 10:11:41 -08003195 path.substring(pathOffset, pathOffset + 1),
3196 unittest.equals("/"),
3197 );
Martin Kustermanna6d0a322017-03-27 13:52:31 +02003198 pathOffset += 1;
Martin Kustermann5eb85c12017-09-11 12:35:54 +02003199 unittest.expect(
Kevin Moore58e22332021-02-25 10:11:41 -08003200 path.substring(pathOffset, pathOffset + 3),
3201 unittest.equals("v1/"),
3202 );
Martin Kustermanna6d0a322017-03-27 13:52:31 +02003203 pathOffset += 3;
3204 // NOTE: We cannot test reserved expansions due to the inability to reverse the operation;
3205
3206 var query = (req.url).query;
3207 var queryOffset = 0;
Jakob Andersen52715df2018-05-01 13:58:48 +02003208 var queryMap = <core.String, core.List<core.String>>{};
Kevin Moore91f7e3e2021-01-26 07:51:20 -08003209 void addQueryParam(core.String n, core.String v) =>
3210 queryMap.putIfAbsent(n, () => []).add(v);
Martin Kustermann5eb85c12017-09-11 12:35:54 +02003211
Kevin Moore6d21e902021-01-15 06:41:08 -08003212 if (query.isNotEmpty) {
Kevin Moored0251702021-01-15 06:41:08 -08003213 for (var part in query.split('&')) {
3214 var keyValue = part.split('=');
Kevin Moore6d21e902021-01-15 06:41:08 -08003215 addQueryParam(
3216 core.Uri.decodeQueryComponent(keyValue[0]),
3217 core.Uri.decodeQueryComponent(keyValue[1]),
3218 );
Martin Kustermanna6d0a322017-03-27 13:52:31 +02003219 }
3220 }
Kevin Moore58e22332021-02-25 10:11:41 -08003221 unittest.expect(
3222 queryMap["fields"]!.first,
3223 unittest.equals(arg_$fields),
3224 );
Martin Kustermanna6d0a322017-03-27 13:52:31 +02003225
Martin Kustermanna6d0a322017-03-27 13:52:31 +02003226 var h = {
Kevin Moored0251702021-01-15 06:41:08 -08003227 'content-type': 'application/json; charset=utf-8',
Martin Kustermanna6d0a322017-03-27 13:52:31 +02003228 };
Jakob Andersen52715df2018-05-01 13:58:48 +02003229 var resp = convert.json.encode(buildOrgPolicy());
Kevin Moore6d21e902021-01-15 06:41:08 -08003230 return async.Future.value(stringResponse(200, h, resp));
Martin Kustermanna6d0a322017-03-27 13:52:31 +02003231 }), true);
Kevin Moore341348b2021-02-25 11:55:18 -08003232 final response = await res.getOrgPolicy(arg_request, arg_resource,
3233 $fields: arg_$fields);
3234 checkOrgPolicy(response as api.OrgPolicy);
Martin Kustermanna6d0a322017-03-27 13:52:31 +02003235 });
3236
Kevin Moore341348b2021-02-25 11:55:18 -08003237 unittest.test('method--listAvailableOrgPolicyConstraints', () async {
Kevin Moore6d21e902021-01-15 06:41:08 -08003238 var mock = HttpServerMock();
Kevin Moore5889af72021-01-28 13:31:53 -08003239 var res = api.CloudResourceManagerApi(mock).organizations;
Martin Kustermanna6d0a322017-03-27 13:52:31 +02003240 var arg_request = buildListAvailableOrgPolicyConstraintsRequest();
Kevin Moored0251702021-01-15 06:41:08 -08003241 var arg_resource = 'foo';
3242 var arg_$fields = 'foo';
Martin Kustermann3953f0d2017-06-12 16:59:53 +02003243 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
Kevin Moorec4dbd8e2021-01-26 14:40:35 -08003244 var obj = api.ListAvailableOrgPolicyConstraintsRequest.fromJson(
3245 json as core.Map<core.String, core.dynamic>);
3246 checkListAvailableOrgPolicyConstraintsRequest(
3247 obj as api.ListAvailableOrgPolicyConstraintsRequest);
Martin Kustermanna6d0a322017-03-27 13:52:31 +02003248
3249 var path = (req.url).path;
3250 var pathOffset = 0;
Kevin Moore6d21e902021-01-15 06:41:08 -08003251 core.int index;
3252 core.String subPart;
Martin Kustermann5eb85c12017-09-11 12:35:54 +02003253 unittest.expect(
Kevin Moore58e22332021-02-25 10:11:41 -08003254 path.substring(pathOffset, pathOffset + 1),
3255 unittest.equals("/"),
3256 );
Martin Kustermanna6d0a322017-03-27 13:52:31 +02003257 pathOffset += 1;
Martin Kustermann5eb85c12017-09-11 12:35:54 +02003258 unittest.expect(
Kevin Moore58e22332021-02-25 10:11:41 -08003259 path.substring(pathOffset, pathOffset + 3),
3260 unittest.equals("v1/"),
3261 );
Martin Kustermanna6d0a322017-03-27 13:52:31 +02003262 pathOffset += 3;
3263 // NOTE: We cannot test reserved expansions due to the inability to reverse the operation;
3264
3265 var query = (req.url).query;
3266 var queryOffset = 0;
Jakob Andersen52715df2018-05-01 13:58:48 +02003267 var queryMap = <core.String, core.List<core.String>>{};
Kevin Moore91f7e3e2021-01-26 07:51:20 -08003268 void addQueryParam(core.String n, core.String v) =>
3269 queryMap.putIfAbsent(n, () => []).add(v);
Martin Kustermann5eb85c12017-09-11 12:35:54 +02003270
Kevin Moore6d21e902021-01-15 06:41:08 -08003271 if (query.isNotEmpty) {
Kevin Moored0251702021-01-15 06:41:08 -08003272 for (var part in query.split('&')) {
3273 var keyValue = part.split('=');
Kevin Moore6d21e902021-01-15 06:41:08 -08003274 addQueryParam(
3275 core.Uri.decodeQueryComponent(keyValue[0]),
3276 core.Uri.decodeQueryComponent(keyValue[1]),
3277 );
Martin Kustermanna6d0a322017-03-27 13:52:31 +02003278 }
3279 }
Kevin Moore58e22332021-02-25 10:11:41 -08003280 unittest.expect(
3281 queryMap["fields"]!.first,
3282 unittest.equals(arg_$fields),
3283 );
Martin Kustermanna6d0a322017-03-27 13:52:31 +02003284
Martin Kustermanna6d0a322017-03-27 13:52:31 +02003285 var h = {
Kevin Moored0251702021-01-15 06:41:08 -08003286 'content-type': 'application/json; charset=utf-8',
Martin Kustermanna6d0a322017-03-27 13:52:31 +02003287 };
Jakob Andersen52715df2018-05-01 13:58:48 +02003288 var resp = convert.json
Martin Kustermann5eb85c12017-09-11 12:35:54 +02003289 .encode(buildListAvailableOrgPolicyConstraintsResponse());
Kevin Moore6d21e902021-01-15 06:41:08 -08003290 return async.Future.value(stringResponse(200, h, resp));
Martin Kustermanna6d0a322017-03-27 13:52:31 +02003291 }), true);
Kevin Moore341348b2021-02-25 11:55:18 -08003292 final response = await res.listAvailableOrgPolicyConstraints(
3293 arg_request, arg_resource,
3294 $fields: arg_$fields);
3295 checkListAvailableOrgPolicyConstraintsResponse(
3296 response as api.ListAvailableOrgPolicyConstraintsResponse);
Martin Kustermanna6d0a322017-03-27 13:52:31 +02003297 });
3298
Kevin Moore341348b2021-02-25 11:55:18 -08003299 unittest.test('method--listOrgPolicies', () async {
Kevin Moore6d21e902021-01-15 06:41:08 -08003300 var mock = HttpServerMock();
Kevin Moore5889af72021-01-28 13:31:53 -08003301 var res = api.CloudResourceManagerApi(mock).organizations;
Martin Kustermanna6d0a322017-03-27 13:52:31 +02003302 var arg_request = buildListOrgPoliciesRequest();
Kevin Moored0251702021-01-15 06:41:08 -08003303 var arg_resource = 'foo';
3304 var arg_$fields = 'foo';
Martin Kustermann3953f0d2017-06-12 16:59:53 +02003305 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
Kevin Moorec4dbd8e2021-01-26 14:40:35 -08003306 var obj = api.ListOrgPoliciesRequest.fromJson(
3307 json as core.Map<core.String, core.dynamic>);
3308 checkListOrgPoliciesRequest(obj as api.ListOrgPoliciesRequest);
Martin Kustermanna6d0a322017-03-27 13:52:31 +02003309
3310 var path = (req.url).path;
3311 var pathOffset = 0;
Kevin Moore6d21e902021-01-15 06:41:08 -08003312 core.int index;
3313 core.String subPart;
Martin Kustermann5eb85c12017-09-11 12:35:54 +02003314 unittest.expect(
Kevin Moore58e22332021-02-25 10:11:41 -08003315 path.substring(pathOffset, pathOffset + 1),
3316 unittest.equals("/"),
3317 );
Martin Kustermanna6d0a322017-03-27 13:52:31 +02003318 pathOffset += 1;
Martin Kustermann5eb85c12017-09-11 12:35:54 +02003319 unittest.expect(
Kevin Moore58e22332021-02-25 10:11:41 -08003320 path.substring(pathOffset, pathOffset + 3),
3321 unittest.equals("v1/"),
3322 );
Martin Kustermanna6d0a322017-03-27 13:52:31 +02003323 pathOffset += 3;
3324 // NOTE: We cannot test reserved expansions due to the inability to reverse the operation;
3325
3326 var query = (req.url).query;
3327 var queryOffset = 0;
Jakob Andersen52715df2018-05-01 13:58:48 +02003328 var queryMap = <core.String, core.List<core.String>>{};
Kevin Moore91f7e3e2021-01-26 07:51:20 -08003329 void addQueryParam(core.String n, core.String v) =>
3330 queryMap.putIfAbsent(n, () => []).add(v);
Martin Kustermann5eb85c12017-09-11 12:35:54 +02003331
Kevin Moore6d21e902021-01-15 06:41:08 -08003332 if (query.isNotEmpty) {
Kevin Moored0251702021-01-15 06:41:08 -08003333 for (var part in query.split('&')) {
3334 var keyValue = part.split('=');
Kevin Moore6d21e902021-01-15 06:41:08 -08003335 addQueryParam(
3336 core.Uri.decodeQueryComponent(keyValue[0]),
3337 core.Uri.decodeQueryComponent(keyValue[1]),
3338 );
Martin Kustermanna6d0a322017-03-27 13:52:31 +02003339 }
3340 }
Kevin Moore58e22332021-02-25 10:11:41 -08003341 unittest.expect(
3342 queryMap["fields"]!.first,
3343 unittest.equals(arg_$fields),
3344 );
Martin Kustermanna6d0a322017-03-27 13:52:31 +02003345
Martin Kustermanna6d0a322017-03-27 13:52:31 +02003346 var h = {
Kevin Moored0251702021-01-15 06:41:08 -08003347 'content-type': 'application/json; charset=utf-8',
Martin Kustermanna6d0a322017-03-27 13:52:31 +02003348 };
Jakob Andersen52715df2018-05-01 13:58:48 +02003349 var resp = convert.json.encode(buildListOrgPoliciesResponse());
Kevin Moore6d21e902021-01-15 06:41:08 -08003350 return async.Future.value(stringResponse(200, h, resp));
Martin Kustermanna6d0a322017-03-27 13:52:31 +02003351 }), true);
Kevin Moore341348b2021-02-25 11:55:18 -08003352 final response = await res.listOrgPolicies(arg_request, arg_resource,
3353 $fields: arg_$fields);
3354 checkListOrgPoliciesResponse(response as api.ListOrgPoliciesResponse);
Martin Kustermanna6d0a322017-03-27 13:52:31 +02003355 });
3356
Kevin Moore341348b2021-02-25 11:55:18 -08003357 unittest.test('method--search', () async {
Kevin Moore6d21e902021-01-15 06:41:08 -08003358 var mock = HttpServerMock();
Kevin Moore5889af72021-01-28 13:31:53 -08003359 var res = api.CloudResourceManagerApi(mock).organizations;
Martin Kustermann4ff71db2016-11-09 10:46:40 +01003360 var arg_request = buildSearchOrganizationsRequest();
Kevin Moored0251702021-01-15 06:41:08 -08003361 var arg_$fields = 'foo';
Martin Kustermann3953f0d2017-06-12 16:59:53 +02003362 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
Kevin Moorec4dbd8e2021-01-26 14:40:35 -08003363 var obj = api.SearchOrganizationsRequest.fromJson(
3364 json as core.Map<core.String, core.dynamic>);
3365 checkSearchOrganizationsRequest(obj as api.SearchOrganizationsRequest);
Martin Kustermann4ff71db2016-11-09 10:46:40 +01003366
3367 var path = (req.url).path;
3368 var pathOffset = 0;
Kevin Moore6d21e902021-01-15 06:41:08 -08003369 core.int index;
3370 core.String subPart;
Martin Kustermann5eb85c12017-09-11 12:35:54 +02003371 unittest.expect(
Kevin Moore58e22332021-02-25 10:11:41 -08003372 path.substring(pathOffset, pathOffset + 1),
3373 unittest.equals("/"),
3374 );
Martin Kustermann4ff71db2016-11-09 10:46:40 +01003375 pathOffset += 1;
Kevin Moore58e22332021-02-25 10:11:41 -08003376 unittest.expect(
3377 path.substring(pathOffset, pathOffset + 23),
3378 unittest.equals("v1/organizations:search"),
3379 );
Martin Kustermann4ff71db2016-11-09 10:46:40 +01003380 pathOffset += 23;
3381
3382 var query = (req.url).query;
3383 var queryOffset = 0;
Jakob Andersen52715df2018-05-01 13:58:48 +02003384 var queryMap = <core.String, core.List<core.String>>{};
Kevin Moore91f7e3e2021-01-26 07:51:20 -08003385 void addQueryParam(core.String n, core.String v) =>
3386 queryMap.putIfAbsent(n, () => []).add(v);
Martin Kustermann5eb85c12017-09-11 12:35:54 +02003387
Kevin Moore6d21e902021-01-15 06:41:08 -08003388 if (query.isNotEmpty) {
Kevin Moored0251702021-01-15 06:41:08 -08003389 for (var part in query.split('&')) {
3390 var keyValue = part.split('=');
Kevin Moore6d21e902021-01-15 06:41:08 -08003391 addQueryParam(
3392 core.Uri.decodeQueryComponent(keyValue[0]),
3393 core.Uri.decodeQueryComponent(keyValue[1]),
3394 );
Martin Kustermann4ff71db2016-11-09 10:46:40 +01003395 }
3396 }
Kevin Moore58e22332021-02-25 10:11:41 -08003397 unittest.expect(
3398 queryMap["fields"]!.first,
3399 unittest.equals(arg_$fields),
3400 );
Martin Kustermann4ff71db2016-11-09 10:46:40 +01003401
Martin Kustermann4ff71db2016-11-09 10:46:40 +01003402 var h = {
Kevin Moored0251702021-01-15 06:41:08 -08003403 'content-type': 'application/json; charset=utf-8',
Martin Kustermann4ff71db2016-11-09 10:46:40 +01003404 };
Jakob Andersen52715df2018-05-01 13:58:48 +02003405 var resp = convert.json.encode(buildSearchOrganizationsResponse());
Kevin Moore6d21e902021-01-15 06:41:08 -08003406 return async.Future.value(stringResponse(200, h, resp));
Martin Kustermann4ff71db2016-11-09 10:46:40 +01003407 }), true);
Kevin Moore341348b2021-02-25 11:55:18 -08003408 final response = await res.search(arg_request, $fields: arg_$fields);
3409 checkSearchOrganizationsResponse(
3410 response as api.SearchOrganizationsResponse);
Martin Kustermann4ff71db2016-11-09 10:46:40 +01003411 });
3412
Kevin Moore341348b2021-02-25 11:55:18 -08003413 unittest.test('method--setIamPolicy', () async {
Kevin Moore6d21e902021-01-15 06:41:08 -08003414 var mock = HttpServerMock();
Kevin Moore5889af72021-01-28 13:31:53 -08003415 var res = api.CloudResourceManagerApi(mock).organizations;
Martin Kustermann4ff71db2016-11-09 10:46:40 +01003416 var arg_request = buildSetIamPolicyRequest();
Kevin Moored0251702021-01-15 06:41:08 -08003417 var arg_resource = 'foo';
3418 var arg_$fields = 'foo';
Martin Kustermann3953f0d2017-06-12 16:59:53 +02003419 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
Kevin Moorec4dbd8e2021-01-26 14:40:35 -08003420 var obj = api.SetIamPolicyRequest.fromJson(
3421 json as core.Map<core.String, core.dynamic>);
3422 checkSetIamPolicyRequest(obj as api.SetIamPolicyRequest);
Martin Kustermann4ff71db2016-11-09 10:46:40 +01003423
3424 var path = (req.url).path;
3425 var pathOffset = 0;
Kevin Moore6d21e902021-01-15 06:41:08 -08003426 core.int index;
3427 core.String subPart;
Martin Kustermann5eb85c12017-09-11 12:35:54 +02003428 unittest.expect(
Kevin Moore58e22332021-02-25 10:11:41 -08003429 path.substring(pathOffset, pathOffset + 1),
3430 unittest.equals("/"),
3431 );
Martin Kustermann4ff71db2016-11-09 10:46:40 +01003432 pathOffset += 1;
Martin Kustermann5eb85c12017-09-11 12:35:54 +02003433 unittest.expect(
Kevin Moore58e22332021-02-25 10:11:41 -08003434 path.substring(pathOffset, pathOffset + 3),
3435 unittest.equals("v1/"),
3436 );
Martin Kustermann4ff71db2016-11-09 10:46:40 +01003437 pathOffset += 3;
3438 // NOTE: We cannot test reserved expansions due to the inability to reverse the operation;
3439
3440 var query = (req.url).query;
3441 var queryOffset = 0;
Jakob Andersen52715df2018-05-01 13:58:48 +02003442 var queryMap = <core.String, core.List<core.String>>{};
Kevin Moore91f7e3e2021-01-26 07:51:20 -08003443 void addQueryParam(core.String n, core.String v) =>
3444 queryMap.putIfAbsent(n, () => []).add(v);
Martin Kustermann5eb85c12017-09-11 12:35:54 +02003445
Kevin Moore6d21e902021-01-15 06:41:08 -08003446 if (query.isNotEmpty) {
Kevin Moored0251702021-01-15 06:41:08 -08003447 for (var part in query.split('&')) {
3448 var keyValue = part.split('=');
Kevin Moore6d21e902021-01-15 06:41:08 -08003449 addQueryParam(
3450 core.Uri.decodeQueryComponent(keyValue[0]),
3451 core.Uri.decodeQueryComponent(keyValue[1]),
3452 );
Martin Kustermann4ff71db2016-11-09 10:46:40 +01003453 }
3454 }
Kevin Moore58e22332021-02-25 10:11:41 -08003455 unittest.expect(
3456 queryMap["fields"]!.first,
3457 unittest.equals(arg_$fields),
3458 );
Martin Kustermann4ff71db2016-11-09 10:46:40 +01003459
Martin Kustermann4ff71db2016-11-09 10:46:40 +01003460 var h = {
Kevin Moored0251702021-01-15 06:41:08 -08003461 'content-type': 'application/json; charset=utf-8',
Martin Kustermann4ff71db2016-11-09 10:46:40 +01003462 };
Jakob Andersen52715df2018-05-01 13:58:48 +02003463 var resp = convert.json.encode(buildPolicy());
Kevin Moore6d21e902021-01-15 06:41:08 -08003464 return async.Future.value(stringResponse(200, h, resp));
Martin Kustermann4ff71db2016-11-09 10:46:40 +01003465 }), true);
Kevin Moore341348b2021-02-25 11:55:18 -08003466 final response = await res.setIamPolicy(arg_request, arg_resource,
3467 $fields: arg_$fields);
3468 checkPolicy(response as api.Policy);
Martin Kustermann4ff71db2016-11-09 10:46:40 +01003469 });
3470
Kevin Moore341348b2021-02-25 11:55:18 -08003471 unittest.test('method--setOrgPolicy', () async {
Kevin Moore6d21e902021-01-15 06:41:08 -08003472 var mock = HttpServerMock();
Kevin Moore5889af72021-01-28 13:31:53 -08003473 var res = api.CloudResourceManagerApi(mock).organizations;
Martin Kustermanna6d0a322017-03-27 13:52:31 +02003474 var arg_request = buildSetOrgPolicyRequest();
Kevin Moored0251702021-01-15 06:41:08 -08003475 var arg_resource = 'foo';
3476 var arg_$fields = 'foo';
Martin Kustermann3953f0d2017-06-12 16:59:53 +02003477 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
Kevin Moorec4dbd8e2021-01-26 14:40:35 -08003478 var obj = api.SetOrgPolicyRequest.fromJson(
3479 json as core.Map<core.String, core.dynamic>);
3480 checkSetOrgPolicyRequest(obj as api.SetOrgPolicyRequest);
Martin Kustermanna6d0a322017-03-27 13:52:31 +02003481
3482 var path = (req.url).path;
3483 var pathOffset = 0;
Kevin Moore6d21e902021-01-15 06:41:08 -08003484 core.int index;
3485 core.String subPart;
Martin Kustermann5eb85c12017-09-11 12:35:54 +02003486 unittest.expect(
Kevin Moore58e22332021-02-25 10:11:41 -08003487 path.substring(pathOffset, pathOffset + 1),
3488 unittest.equals("/"),
3489 );
Martin Kustermanna6d0a322017-03-27 13:52:31 +02003490 pathOffset += 1;
Martin Kustermann5eb85c12017-09-11 12:35:54 +02003491 unittest.expect(
Kevin Moore58e22332021-02-25 10:11:41 -08003492 path.substring(pathOffset, pathOffset + 3),
3493 unittest.equals("v1/"),
3494 );
Martin Kustermanna6d0a322017-03-27 13:52:31 +02003495 pathOffset += 3;
3496 // NOTE: We cannot test reserved expansions due to the inability to reverse the operation;
3497
3498 var query = (req.url).query;
3499 var queryOffset = 0;
Jakob Andersen52715df2018-05-01 13:58:48 +02003500 var queryMap = <core.String, core.List<core.String>>{};
Kevin Moore91f7e3e2021-01-26 07:51:20 -08003501 void addQueryParam(core.String n, core.String v) =>
3502 queryMap.putIfAbsent(n, () => []).add(v);
Martin Kustermann5eb85c12017-09-11 12:35:54 +02003503
Kevin Moore6d21e902021-01-15 06:41:08 -08003504 if (query.isNotEmpty) {
Kevin Moored0251702021-01-15 06:41:08 -08003505 for (var part in query.split('&')) {
3506 var keyValue = part.split('=');
Kevin Moore6d21e902021-01-15 06:41:08 -08003507 addQueryParam(
3508 core.Uri.decodeQueryComponent(keyValue[0]),
3509 core.Uri.decodeQueryComponent(keyValue[1]),
3510 );
Martin Kustermanna6d0a322017-03-27 13:52:31 +02003511 }
3512 }
Kevin Moore58e22332021-02-25 10:11:41 -08003513 unittest.expect(
3514 queryMap["fields"]!.first,
3515 unittest.equals(arg_$fields),
3516 );
Martin Kustermanna6d0a322017-03-27 13:52:31 +02003517
Martin Kustermanna6d0a322017-03-27 13:52:31 +02003518 var h = {
Kevin Moored0251702021-01-15 06:41:08 -08003519 'content-type': 'application/json; charset=utf-8',
Martin Kustermanna6d0a322017-03-27 13:52:31 +02003520 };
Jakob Andersen52715df2018-05-01 13:58:48 +02003521 var resp = convert.json.encode(buildOrgPolicy());
Kevin Moore6d21e902021-01-15 06:41:08 -08003522 return async.Future.value(stringResponse(200, h, resp));
Martin Kustermanna6d0a322017-03-27 13:52:31 +02003523 }), true);
Kevin Moore341348b2021-02-25 11:55:18 -08003524 final response = await res.setOrgPolicy(arg_request, arg_resource,
3525 $fields: arg_$fields);
3526 checkOrgPolicy(response as api.OrgPolicy);
Martin Kustermanna6d0a322017-03-27 13:52:31 +02003527 });
3528
Kevin Moore341348b2021-02-25 11:55:18 -08003529 unittest.test('method--testIamPermissions', () async {
Kevin Moore6d21e902021-01-15 06:41:08 -08003530 var mock = HttpServerMock();
Kevin Moore5889af72021-01-28 13:31:53 -08003531 var res = api.CloudResourceManagerApi(mock).organizations;
Martin Kustermann4ff71db2016-11-09 10:46:40 +01003532 var arg_request = buildTestIamPermissionsRequest();
Kevin Moored0251702021-01-15 06:41:08 -08003533 var arg_resource = 'foo';
3534 var arg_$fields = 'foo';
Martin Kustermann3953f0d2017-06-12 16:59:53 +02003535 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
Kevin Moorec4dbd8e2021-01-26 14:40:35 -08003536 var obj = api.TestIamPermissionsRequest.fromJson(
3537 json as core.Map<core.String, core.dynamic>);
3538 checkTestIamPermissionsRequest(obj as api.TestIamPermissionsRequest);
Martin Kustermann4ff71db2016-11-09 10:46:40 +01003539
3540 var path = (req.url).path;
3541 var pathOffset = 0;
Kevin Moore6d21e902021-01-15 06:41:08 -08003542 core.int index;
3543 core.String subPart;
Martin Kustermann5eb85c12017-09-11 12:35:54 +02003544 unittest.expect(
Kevin Moore58e22332021-02-25 10:11:41 -08003545 path.substring(pathOffset, pathOffset + 1),
3546 unittest.equals("/"),
3547 );
Martin Kustermann4ff71db2016-11-09 10:46:40 +01003548 pathOffset += 1;
Martin Kustermann5eb85c12017-09-11 12:35:54 +02003549 unittest.expect(
Kevin Moore58e22332021-02-25 10:11:41 -08003550 path.substring(pathOffset, pathOffset + 3),
3551 unittest.equals("v1/"),
3552 );
Martin Kustermann4ff71db2016-11-09 10:46:40 +01003553 pathOffset += 3;
3554 // NOTE: We cannot test reserved expansions due to the inability to reverse the operation;
3555
3556 var query = (req.url).query;
3557 var queryOffset = 0;
Jakob Andersen52715df2018-05-01 13:58:48 +02003558 var queryMap = <core.String, core.List<core.String>>{};
Kevin Moore91f7e3e2021-01-26 07:51:20 -08003559 void addQueryParam(core.String n, core.String v) =>
3560 queryMap.putIfAbsent(n, () => []).add(v);
Martin Kustermann5eb85c12017-09-11 12:35:54 +02003561
Kevin Moore6d21e902021-01-15 06:41:08 -08003562 if (query.isNotEmpty) {
Kevin Moored0251702021-01-15 06:41:08 -08003563 for (var part in query.split('&')) {
3564 var keyValue = part.split('=');
Kevin Moore6d21e902021-01-15 06:41:08 -08003565 addQueryParam(
3566 core.Uri.decodeQueryComponent(keyValue[0]),
3567 core.Uri.decodeQueryComponent(keyValue[1]),
3568 );
Martin Kustermann4ff71db2016-11-09 10:46:40 +01003569 }
3570 }
Kevin Moore58e22332021-02-25 10:11:41 -08003571 unittest.expect(
3572 queryMap["fields"]!.first,
3573 unittest.equals(arg_$fields),
3574 );
Martin Kustermann4ff71db2016-11-09 10:46:40 +01003575
Martin Kustermann4ff71db2016-11-09 10:46:40 +01003576 var h = {
Kevin Moored0251702021-01-15 06:41:08 -08003577 'content-type': 'application/json; charset=utf-8',
Martin Kustermann4ff71db2016-11-09 10:46:40 +01003578 };
Jakob Andersen52715df2018-05-01 13:58:48 +02003579 var resp = convert.json.encode(buildTestIamPermissionsResponse());
Kevin Moore6d21e902021-01-15 06:41:08 -08003580 return async.Future.value(stringResponse(200, h, resp));
Martin Kustermann4ff71db2016-11-09 10:46:40 +01003581 }), true);
Kevin Moore341348b2021-02-25 11:55:18 -08003582 final response = await res.testIamPermissions(arg_request, arg_resource,
3583 $fields: arg_$fields);
3584 checkTestIamPermissionsResponse(
3585 response as api.TestIamPermissionsResponse);
Martin Kustermann4ff71db2016-11-09 10:46:40 +01003586 });
Martin Kustermann4ff71db2016-11-09 10:46:40 +01003587 });
3588
Kevin Moore88512712021-01-28 14:43:28 -08003589 unittest.group('resource-ProjectsResource', () {
Kevin Moore341348b2021-02-25 11:55:18 -08003590 unittest.test('method--clearOrgPolicy', () async {
Kevin Moore6d21e902021-01-15 06:41:08 -08003591 var mock = HttpServerMock();
Kevin Moore5889af72021-01-28 13:31:53 -08003592 var res = api.CloudResourceManagerApi(mock).projects;
Martin Kustermanna6d0a322017-03-27 13:52:31 +02003593 var arg_request = buildClearOrgPolicyRequest();
Kevin Moored0251702021-01-15 06:41:08 -08003594 var arg_resource = 'foo';
3595 var arg_$fields = 'foo';
Martin Kustermann3953f0d2017-06-12 16:59:53 +02003596 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
Kevin Moorec4dbd8e2021-01-26 14:40:35 -08003597 var obj = api.ClearOrgPolicyRequest.fromJson(
3598 json as core.Map<core.String, core.dynamic>);
3599 checkClearOrgPolicyRequest(obj as api.ClearOrgPolicyRequest);
Martin Kustermanna6d0a322017-03-27 13:52:31 +02003600
3601 var path = (req.url).path;
3602 var pathOffset = 0;
Kevin Moore6d21e902021-01-15 06:41:08 -08003603 core.int index;
3604 core.String subPart;
Martin Kustermann5eb85c12017-09-11 12:35:54 +02003605 unittest.expect(
Kevin Moore58e22332021-02-25 10:11:41 -08003606 path.substring(pathOffset, pathOffset + 1),
3607 unittest.equals("/"),
3608 );
Martin Kustermanna6d0a322017-03-27 13:52:31 +02003609 pathOffset += 1;
Martin Kustermann5eb85c12017-09-11 12:35:54 +02003610 unittest.expect(
Kevin Moore58e22332021-02-25 10:11:41 -08003611 path.substring(pathOffset, pathOffset + 3),
3612 unittest.equals("v1/"),
3613 );
Martin Kustermanna6d0a322017-03-27 13:52:31 +02003614 pathOffset += 3;
3615 // NOTE: We cannot test reserved expansions due to the inability to reverse the operation;
3616
3617 var query = (req.url).query;
3618 var queryOffset = 0;
Jakob Andersen52715df2018-05-01 13:58:48 +02003619 var queryMap = <core.String, core.List<core.String>>{};
Kevin Moore91f7e3e2021-01-26 07:51:20 -08003620 void addQueryParam(core.String n, core.String v) =>
3621 queryMap.putIfAbsent(n, () => []).add(v);
Martin Kustermann5eb85c12017-09-11 12:35:54 +02003622
Kevin Moore6d21e902021-01-15 06:41:08 -08003623 if (query.isNotEmpty) {
Kevin Moored0251702021-01-15 06:41:08 -08003624 for (var part in query.split('&')) {
3625 var keyValue = part.split('=');
Kevin Moore6d21e902021-01-15 06:41:08 -08003626 addQueryParam(
3627 core.Uri.decodeQueryComponent(keyValue[0]),
3628 core.Uri.decodeQueryComponent(keyValue[1]),
3629 );
Martin Kustermanna6d0a322017-03-27 13:52:31 +02003630 }
3631 }
Kevin Moore58e22332021-02-25 10:11:41 -08003632 unittest.expect(
3633 queryMap["fields"]!.first,
3634 unittest.equals(arg_$fields),
3635 );
Martin Kustermanna6d0a322017-03-27 13:52:31 +02003636
Martin Kustermanna6d0a322017-03-27 13:52:31 +02003637 var h = {
Kevin Moored0251702021-01-15 06:41:08 -08003638 'content-type': 'application/json; charset=utf-8',
Martin Kustermanna6d0a322017-03-27 13:52:31 +02003639 };
Jakob Andersen52715df2018-05-01 13:58:48 +02003640 var resp = convert.json.encode(buildEmpty());
Kevin Moore6d21e902021-01-15 06:41:08 -08003641 return async.Future.value(stringResponse(200, h, resp));
Martin Kustermanna6d0a322017-03-27 13:52:31 +02003642 }), true);
Kevin Moore341348b2021-02-25 11:55:18 -08003643 final response = await res.clearOrgPolicy(arg_request, arg_resource,
3644 $fields: arg_$fields);
3645 checkEmpty(response as api.Empty);
Martin Kustermanna6d0a322017-03-27 13:52:31 +02003646 });
3647
Kevin Moore341348b2021-02-25 11:55:18 -08003648 unittest.test('method--create', () async {
Kevin Moore6d21e902021-01-15 06:41:08 -08003649 var mock = HttpServerMock();
Kevin Moore5889af72021-01-28 13:31:53 -08003650 var res = api.CloudResourceManagerApi(mock).projects;
Martin Kustermann4ff71db2016-11-09 10:46:40 +01003651 var arg_request = buildProject();
Kevin Moored0251702021-01-15 06:41:08 -08003652 var arg_$fields = 'foo';
Martin Kustermann3953f0d2017-06-12 16:59:53 +02003653 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
Kevin Moorec4dbd8e2021-01-26 14:40:35 -08003654 var obj =
3655 api.Project.fromJson(json as core.Map<core.String, core.dynamic>);
3656 checkProject(obj as api.Project);
Martin Kustermann4ff71db2016-11-09 10:46:40 +01003657
3658 var path = (req.url).path;
3659 var pathOffset = 0;
Kevin Moore6d21e902021-01-15 06:41:08 -08003660 core.int index;
3661 core.String subPart;
Martin Kustermann5eb85c12017-09-11 12:35:54 +02003662 unittest.expect(
Kevin Moore58e22332021-02-25 10:11:41 -08003663 path.substring(pathOffset, pathOffset + 1),
3664 unittest.equals("/"),
3665 );
Martin Kustermann4ff71db2016-11-09 10:46:40 +01003666 pathOffset += 1;
Kevin Moore58e22332021-02-25 10:11:41 -08003667 unittest.expect(
3668 path.substring(pathOffset, pathOffset + 11),
3669 unittest.equals("v1/projects"),
3670 );
Martin Kustermann4ff71db2016-11-09 10:46:40 +01003671 pathOffset += 11;
3672
3673 var query = (req.url).query;
3674 var queryOffset = 0;
Jakob Andersen52715df2018-05-01 13:58:48 +02003675 var queryMap = <core.String, core.List<core.String>>{};
Kevin Moore91f7e3e2021-01-26 07:51:20 -08003676 void addQueryParam(core.String n, core.String v) =>
3677 queryMap.putIfAbsent(n, () => []).add(v);
Martin Kustermann5eb85c12017-09-11 12:35:54 +02003678
Kevin Moore6d21e902021-01-15 06:41:08 -08003679 if (query.isNotEmpty) {
Kevin Moored0251702021-01-15 06:41:08 -08003680 for (var part in query.split('&')) {
3681 var keyValue = part.split('=');
Kevin Moore6d21e902021-01-15 06:41:08 -08003682 addQueryParam(
3683 core.Uri.decodeQueryComponent(keyValue[0]),
3684 core.Uri.decodeQueryComponent(keyValue[1]),
3685 );
Martin Kustermann4ff71db2016-11-09 10:46:40 +01003686 }
3687 }
Kevin Moore58e22332021-02-25 10:11:41 -08003688 unittest.expect(
3689 queryMap["fields"]!.first,
3690 unittest.equals(arg_$fields),
3691 );
Martin Kustermann4ff71db2016-11-09 10:46:40 +01003692
Martin Kustermann4ff71db2016-11-09 10:46:40 +01003693 var h = {
Kevin Moored0251702021-01-15 06:41:08 -08003694 'content-type': 'application/json; charset=utf-8',
Martin Kustermann4ff71db2016-11-09 10:46:40 +01003695 };
Jakob Andersen52715df2018-05-01 13:58:48 +02003696 var resp = convert.json.encode(buildOperation());
Kevin Moore6d21e902021-01-15 06:41:08 -08003697 return async.Future.value(stringResponse(200, h, resp));
Martin Kustermann4ff71db2016-11-09 10:46:40 +01003698 }), true);
Kevin Moore341348b2021-02-25 11:55:18 -08003699 final response = await res.create(arg_request, $fields: arg_$fields);
3700 checkOperation(response as api.Operation);
Martin Kustermann4ff71db2016-11-09 10:46:40 +01003701 });
3702
Kevin Moore341348b2021-02-25 11:55:18 -08003703 unittest.test('method--delete', () async {
Kevin Moore6d21e902021-01-15 06:41:08 -08003704 var mock = HttpServerMock();
Kevin Moore5889af72021-01-28 13:31:53 -08003705 var res = api.CloudResourceManagerApi(mock).projects;
Kevin Moored0251702021-01-15 06:41:08 -08003706 var arg_projectId = 'foo';
3707 var arg_$fields = 'foo';
Martin Kustermann3953f0d2017-06-12 16:59:53 +02003708 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
Martin Kustermannf6325572016-03-14 14:25:28 +01003709 var path = (req.url).path;
3710 var pathOffset = 0;
Kevin Moore6d21e902021-01-15 06:41:08 -08003711 core.int index;
3712 core.String subPart;
Martin Kustermann5eb85c12017-09-11 12:35:54 +02003713 unittest.expect(
Kevin Moore58e22332021-02-25 10:11:41 -08003714 path.substring(pathOffset, pathOffset + 1),
3715 unittest.equals("/"),
3716 );
Martin Kustermannf6325572016-03-14 14:25:28 +01003717 pathOffset += 1;
Kevin Moore58e22332021-02-25 10:11:41 -08003718 unittest.expect(
3719 path.substring(pathOffset, pathOffset + 12),
3720 unittest.equals("v1/projects/"),
3721 );
Martin Kustermannf6325572016-03-14 14:25:28 +01003722 pathOffset += 12;
3723 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset));
3724 pathOffset = path.length;
Kevin Moore58e22332021-02-25 10:11:41 -08003725 unittest.expect(
3726 subPart,
3727 unittest.equals('$arg_projectId'),
3728 );
Martin Kustermannf6325572016-03-14 14:25:28 +01003729
3730 var query = (req.url).query;
3731 var queryOffset = 0;
Jakob Andersen52715df2018-05-01 13:58:48 +02003732 var queryMap = <core.String, core.List<core.String>>{};
Kevin Moore91f7e3e2021-01-26 07:51:20 -08003733 void addQueryParam(core.String n, core.String v) =>
3734 queryMap.putIfAbsent(n, () => []).add(v);
Martin Kustermann5eb85c12017-09-11 12:35:54 +02003735
Kevin Moore6d21e902021-01-15 06:41:08 -08003736 if (query.isNotEmpty) {
Kevin Moored0251702021-01-15 06:41:08 -08003737 for (var part in query.split('&')) {
3738 var keyValue = part.split('=');
Kevin Moore6d21e902021-01-15 06:41:08 -08003739 addQueryParam(
3740 core.Uri.decodeQueryComponent(keyValue[0]),
3741 core.Uri.decodeQueryComponent(keyValue[1]),
3742 );
Martin Kustermannf6325572016-03-14 14:25:28 +01003743 }
3744 }
Kevin Moore58e22332021-02-25 10:11:41 -08003745 unittest.expect(
3746 queryMap["fields"]!.first,
3747 unittest.equals(arg_$fields),
3748 );
Martin Kustermannf6325572016-03-14 14:25:28 +01003749
Martin Kustermannf6325572016-03-14 14:25:28 +01003750 var h = {
Kevin Moored0251702021-01-15 06:41:08 -08003751 'content-type': 'application/json; charset=utf-8',
Martin Kustermannf6325572016-03-14 14:25:28 +01003752 };
Jakob Andersen52715df2018-05-01 13:58:48 +02003753 var resp = convert.json.encode(buildEmpty());
Kevin Moore6d21e902021-01-15 06:41:08 -08003754 return async.Future.value(stringResponse(200, h, resp));
Martin Kustermannf6325572016-03-14 14:25:28 +01003755 }), true);
Kevin Moore341348b2021-02-25 11:55:18 -08003756 final response = await res.delete(arg_projectId, $fields: arg_$fields);
3757 checkEmpty(response as api.Empty);
Martin Kustermannf6325572016-03-14 14:25:28 +01003758 });
3759
Kevin Moore341348b2021-02-25 11:55:18 -08003760 unittest.test('method--get', () async {
Kevin Moore6d21e902021-01-15 06:41:08 -08003761 var mock = HttpServerMock();
Kevin Moore5889af72021-01-28 13:31:53 -08003762 var res = api.CloudResourceManagerApi(mock).projects;
Kevin Moored0251702021-01-15 06:41:08 -08003763 var arg_projectId = 'foo';
3764 var arg_$fields = 'foo';
Martin Kustermann3953f0d2017-06-12 16:59:53 +02003765 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
Martin Kustermannf6325572016-03-14 14:25:28 +01003766 var path = (req.url).path;
3767 var pathOffset = 0;
Kevin Moore6d21e902021-01-15 06:41:08 -08003768 core.int index;
3769 core.String subPart;
Martin Kustermann5eb85c12017-09-11 12:35:54 +02003770 unittest.expect(
Kevin Moore58e22332021-02-25 10:11:41 -08003771 path.substring(pathOffset, pathOffset + 1),
3772 unittest.equals("/"),
3773 );
Martin Kustermannf6325572016-03-14 14:25:28 +01003774 pathOffset += 1;
Kevin Moore58e22332021-02-25 10:11:41 -08003775 unittest.expect(
3776 path.substring(pathOffset, pathOffset + 12),
3777 unittest.equals("v1/projects/"),
3778 );
Martin Kustermannf6325572016-03-14 14:25:28 +01003779 pathOffset += 12;
3780 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset));
3781 pathOffset = path.length;
Kevin Moore58e22332021-02-25 10:11:41 -08003782 unittest.expect(
3783 subPart,
3784 unittest.equals('$arg_projectId'),
3785 );
Martin Kustermannf6325572016-03-14 14:25:28 +01003786
3787 var query = (req.url).query;
3788 var queryOffset = 0;
Jakob Andersen52715df2018-05-01 13:58:48 +02003789 var queryMap = <core.String, core.List<core.String>>{};
Kevin Moore91f7e3e2021-01-26 07:51:20 -08003790 void addQueryParam(core.String n, core.String v) =>
3791 queryMap.putIfAbsent(n, () => []).add(v);
Martin Kustermann5eb85c12017-09-11 12:35:54 +02003792
Kevin Moore6d21e902021-01-15 06:41:08 -08003793 if (query.isNotEmpty) {
Kevin Moored0251702021-01-15 06:41:08 -08003794 for (var part in query.split('&')) {
3795 var keyValue = part.split('=');
Kevin Moore6d21e902021-01-15 06:41:08 -08003796 addQueryParam(
3797 core.Uri.decodeQueryComponent(keyValue[0]),
3798 core.Uri.decodeQueryComponent(keyValue[1]),
3799 );
Martin Kustermannf6325572016-03-14 14:25:28 +01003800 }
3801 }
Kevin Moore58e22332021-02-25 10:11:41 -08003802 unittest.expect(
3803 queryMap["fields"]!.first,
3804 unittest.equals(arg_$fields),
3805 );
Martin Kustermannf6325572016-03-14 14:25:28 +01003806
Martin Kustermannf6325572016-03-14 14:25:28 +01003807 var h = {
Kevin Moored0251702021-01-15 06:41:08 -08003808 'content-type': 'application/json; charset=utf-8',
Martin Kustermannf6325572016-03-14 14:25:28 +01003809 };
Jakob Andersen52715df2018-05-01 13:58:48 +02003810 var resp = convert.json.encode(buildProject());
Kevin Moore6d21e902021-01-15 06:41:08 -08003811 return async.Future.value(stringResponse(200, h, resp));
Martin Kustermannf6325572016-03-14 14:25:28 +01003812 }), true);
Kevin Moore341348b2021-02-25 11:55:18 -08003813 final response = await res.get(arg_projectId, $fields: arg_$fields);
3814 checkProject(response as api.Project);
Martin Kustermannf6325572016-03-14 14:25:28 +01003815 });
3816
Kevin Moore341348b2021-02-25 11:55:18 -08003817 unittest.test('method--getAncestry', () async {
Kevin Moore6d21e902021-01-15 06:41:08 -08003818 var mock = HttpServerMock();
Kevin Moore5889af72021-01-28 13:31:53 -08003819 var res = api.CloudResourceManagerApi(mock).projects;
Martin Kustermannb25a7842016-12-13 16:42:27 +01003820 var arg_request = buildGetAncestryRequest();
Kevin Moored0251702021-01-15 06:41:08 -08003821 var arg_projectId = 'foo';
3822 var arg_$fields = 'foo';
Martin Kustermann3953f0d2017-06-12 16:59:53 +02003823 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
Kevin Moorec4dbd8e2021-01-26 14:40:35 -08003824 var obj = api.GetAncestryRequest.fromJson(
3825 json as core.Map<core.String, core.dynamic>);
3826 checkGetAncestryRequest(obj as api.GetAncestryRequest);
Martin Kustermannb25a7842016-12-13 16:42:27 +01003827
3828 var path = (req.url).path;
3829 var pathOffset = 0;
Kevin Moore6d21e902021-01-15 06:41:08 -08003830 core.int index;
3831 core.String subPart;
Martin Kustermann5eb85c12017-09-11 12:35:54 +02003832 unittest.expect(
Kevin Moore58e22332021-02-25 10:11:41 -08003833 path.substring(pathOffset, pathOffset + 1),
3834 unittest.equals("/"),
3835 );
Martin Kustermannb25a7842016-12-13 16:42:27 +01003836 pathOffset += 1;
Kevin Moore58e22332021-02-25 10:11:41 -08003837 unittest.expect(
3838 path.substring(pathOffset, pathOffset + 12),
3839 unittest.equals("v1/projects/"),
3840 );
Martin Kustermannb25a7842016-12-13 16:42:27 +01003841 pathOffset += 12;
Kevin Moored0251702021-01-15 06:41:08 -08003842 index = path.indexOf(':getAncestry', pathOffset);
Martin Kustermannb25a7842016-12-13 16:42:27 +01003843 unittest.expect(index >= 0, unittest.isTrue);
Martin Kustermann5eb85c12017-09-11 12:35:54 +02003844 subPart =
3845 core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
Martin Kustermannb25a7842016-12-13 16:42:27 +01003846 pathOffset = index;
Kevin Moore58e22332021-02-25 10:11:41 -08003847 unittest.expect(
3848 subPart,
3849 unittest.equals('$arg_projectId'),
3850 );
3851 unittest.expect(
3852 path.substring(pathOffset, pathOffset + 12),
3853 unittest.equals(":getAncestry"),
3854 );
Martin Kustermannb25a7842016-12-13 16:42:27 +01003855 pathOffset += 12;
3856
3857 var query = (req.url).query;
3858 var queryOffset = 0;
Jakob Andersen52715df2018-05-01 13:58:48 +02003859 var queryMap = <core.String, core.List<core.String>>{};
Kevin Moore91f7e3e2021-01-26 07:51:20 -08003860 void addQueryParam(core.String n, core.String v) =>
3861 queryMap.putIfAbsent(n, () => []).add(v);
Martin Kustermann5eb85c12017-09-11 12:35:54 +02003862
Kevin Moore6d21e902021-01-15 06:41:08 -08003863 if (query.isNotEmpty) {
Kevin Moored0251702021-01-15 06:41:08 -08003864 for (var part in query.split('&')) {
3865 var keyValue = part.split('=');
Kevin Moore6d21e902021-01-15 06:41:08 -08003866 addQueryParam(
3867 core.Uri.decodeQueryComponent(keyValue[0]),
3868 core.Uri.decodeQueryComponent(keyValue[1]),
3869 );
Martin Kustermannb25a7842016-12-13 16:42:27 +01003870 }
3871 }
Kevin Moore58e22332021-02-25 10:11:41 -08003872 unittest.expect(
3873 queryMap["fields"]!.first,
3874 unittest.equals(arg_$fields),
3875 );
Martin Kustermannb25a7842016-12-13 16:42:27 +01003876
Martin Kustermannb25a7842016-12-13 16:42:27 +01003877 var h = {
Kevin Moored0251702021-01-15 06:41:08 -08003878 'content-type': 'application/json; charset=utf-8',
Martin Kustermannb25a7842016-12-13 16:42:27 +01003879 };
Jakob Andersen52715df2018-05-01 13:58:48 +02003880 var resp = convert.json.encode(buildGetAncestryResponse());
Kevin Moore6d21e902021-01-15 06:41:08 -08003881 return async.Future.value(stringResponse(200, h, resp));
Martin Kustermannb25a7842016-12-13 16:42:27 +01003882 }), true);
Kevin Moore341348b2021-02-25 11:55:18 -08003883 final response = await res.getAncestry(arg_request, arg_projectId,
3884 $fields: arg_$fields);
3885 checkGetAncestryResponse(response as api.GetAncestryResponse);
Martin Kustermannb25a7842016-12-13 16:42:27 +01003886 });
3887
Kevin Moore341348b2021-02-25 11:55:18 -08003888 unittest.test('method--getEffectiveOrgPolicy', () async {
Kevin Moore6d21e902021-01-15 06:41:08 -08003889 var mock = HttpServerMock();
Kevin Moore5889af72021-01-28 13:31:53 -08003890 var res = api.CloudResourceManagerApi(mock).projects;
Martin Kustermanna6d0a322017-03-27 13:52:31 +02003891 var arg_request = buildGetEffectiveOrgPolicyRequest();
Kevin Moored0251702021-01-15 06:41:08 -08003892 var arg_resource = 'foo';
3893 var arg_$fields = 'foo';
Martin Kustermann3953f0d2017-06-12 16:59:53 +02003894 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
Kevin Moorec4dbd8e2021-01-26 14:40:35 -08003895 var obj = api.GetEffectiveOrgPolicyRequest.fromJson(
3896 json as core.Map<core.String, core.dynamic>);
3897 checkGetEffectiveOrgPolicyRequest(
3898 obj as api.GetEffectiveOrgPolicyRequest);
Martin Kustermanna6d0a322017-03-27 13:52:31 +02003899
3900 var path = (req.url).path;
3901 var pathOffset = 0;
Kevin Moore6d21e902021-01-15 06:41:08 -08003902 core.int index;
3903 core.String subPart;
Martin Kustermann5eb85c12017-09-11 12:35:54 +02003904 unittest.expect(
Kevin Moore58e22332021-02-25 10:11:41 -08003905 path.substring(pathOffset, pathOffset + 1),
3906 unittest.equals("/"),
3907 );
Martin Kustermanna6d0a322017-03-27 13:52:31 +02003908 pathOffset += 1;
Martin Kustermann5eb85c12017-09-11 12:35:54 +02003909 unittest.expect(
Kevin Moore58e22332021-02-25 10:11:41 -08003910 path.substring(pathOffset, pathOffset + 3),
3911 unittest.equals("v1/"),
3912 );
Martin Kustermanna6d0a322017-03-27 13:52:31 +02003913 pathOffset += 3;
3914 // NOTE: We cannot test reserved expansions due to the inability to reverse the operation;
3915
3916 var query = (req.url).query;
3917 var queryOffset = 0;
Jakob Andersen52715df2018-05-01 13:58:48 +02003918 var queryMap = <core.String, core.List<core.String>>{};
Kevin Moore91f7e3e2021-01-26 07:51:20 -08003919 void addQueryParam(core.String n, core.String v) =>
3920 queryMap.putIfAbsent(n, () => []).add(v);
Martin Kustermann5eb85c12017-09-11 12:35:54 +02003921
Kevin Moore6d21e902021-01-15 06:41:08 -08003922 if (query.isNotEmpty) {
Kevin Moored0251702021-01-15 06:41:08 -08003923 for (var part in query.split('&')) {
3924 var keyValue = part.split('=');
Kevin Moore6d21e902021-01-15 06:41:08 -08003925 addQueryParam(
3926 core.Uri.decodeQueryComponent(keyValue[0]),
3927 core.Uri.decodeQueryComponent(keyValue[1]),
3928 );
Martin Kustermanna6d0a322017-03-27 13:52:31 +02003929 }
3930 }
Kevin Moore58e22332021-02-25 10:11:41 -08003931 unittest.expect(
3932 queryMap["fields"]!.first,
3933 unittest.equals(arg_$fields),
3934 );
Martin Kustermanna6d0a322017-03-27 13:52:31 +02003935
Martin Kustermanna6d0a322017-03-27 13:52:31 +02003936 var h = {
Kevin Moored0251702021-01-15 06:41:08 -08003937 'content-type': 'application/json; charset=utf-8',
Martin Kustermanna6d0a322017-03-27 13:52:31 +02003938 };
Jakob Andersen52715df2018-05-01 13:58:48 +02003939 var resp = convert.json.encode(buildOrgPolicy());
Kevin Moore6d21e902021-01-15 06:41:08 -08003940 return async.Future.value(stringResponse(200, h, resp));
Martin Kustermanna6d0a322017-03-27 13:52:31 +02003941 }), true);
Kevin Moore341348b2021-02-25 11:55:18 -08003942 final response = await res.getEffectiveOrgPolicy(
3943 arg_request, arg_resource,
3944 $fields: arg_$fields);
3945 checkOrgPolicy(response as api.OrgPolicy);
Martin Kustermanna6d0a322017-03-27 13:52:31 +02003946 });
3947
Kevin Moore341348b2021-02-25 11:55:18 -08003948 unittest.test('method--getIamPolicy', () async {
Kevin Moore6d21e902021-01-15 06:41:08 -08003949 var mock = HttpServerMock();
Kevin Moore5889af72021-01-28 13:31:53 -08003950 var res = api.CloudResourceManagerApi(mock).projects;
Martin Kustermannf6325572016-03-14 14:25:28 +01003951 var arg_request = buildGetIamPolicyRequest();
Kevin Moored0251702021-01-15 06:41:08 -08003952 var arg_resource = 'foo';
3953 var arg_$fields = 'foo';
Martin Kustermann3953f0d2017-06-12 16:59:53 +02003954 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
Kevin Moorec4dbd8e2021-01-26 14:40:35 -08003955 var obj = api.GetIamPolicyRequest.fromJson(
3956 json as core.Map<core.String, core.dynamic>);
3957 checkGetIamPolicyRequest(obj as api.GetIamPolicyRequest);
Martin Kustermannf6325572016-03-14 14:25:28 +01003958
3959 var path = (req.url).path;
3960 var pathOffset = 0;
Kevin Moore6d21e902021-01-15 06:41:08 -08003961 core.int index;
3962 core.String subPart;
Martin Kustermann5eb85c12017-09-11 12:35:54 +02003963 unittest.expect(
Kevin Moore58e22332021-02-25 10:11:41 -08003964 path.substring(pathOffset, pathOffset + 1),
3965 unittest.equals("/"),
3966 );
Martin Kustermannf6325572016-03-14 14:25:28 +01003967 pathOffset += 1;
Kevin Moore58e22332021-02-25 10:11:41 -08003968 unittest.expect(
3969 path.substring(pathOffset, pathOffset + 12),
3970 unittest.equals("v1/projects/"),
3971 );
Martin Kustermannf6325572016-03-14 14:25:28 +01003972 pathOffset += 12;
Kevin Moored0251702021-01-15 06:41:08 -08003973 index = path.indexOf(':getIamPolicy', pathOffset);
Martin Kustermannf6325572016-03-14 14:25:28 +01003974 unittest.expect(index >= 0, unittest.isTrue);
Martin Kustermann5eb85c12017-09-11 12:35:54 +02003975 subPart =
3976 core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
Martin Kustermannf6325572016-03-14 14:25:28 +01003977 pathOffset = index;
Kevin Moore58e22332021-02-25 10:11:41 -08003978 unittest.expect(
3979 subPart,
3980 unittest.equals('$arg_resource'),
3981 );
3982 unittest.expect(
3983 path.substring(pathOffset, pathOffset + 13),
3984 unittest.equals(":getIamPolicy"),
3985 );
Martin Kustermannf6325572016-03-14 14:25:28 +01003986 pathOffset += 13;
3987
3988 var query = (req.url).query;
3989 var queryOffset = 0;
Jakob Andersen52715df2018-05-01 13:58:48 +02003990 var queryMap = <core.String, core.List<core.String>>{};
Kevin Moore91f7e3e2021-01-26 07:51:20 -08003991 void addQueryParam(core.String n, core.String v) =>
3992 queryMap.putIfAbsent(n, () => []).add(v);
Martin Kustermann5eb85c12017-09-11 12:35:54 +02003993
Kevin Moore6d21e902021-01-15 06:41:08 -08003994 if (query.isNotEmpty) {
Kevin Moored0251702021-01-15 06:41:08 -08003995 for (var part in query.split('&')) {
3996 var keyValue = part.split('=');
Kevin Moore6d21e902021-01-15 06:41:08 -08003997 addQueryParam(
3998 core.Uri.decodeQueryComponent(keyValue[0]),
3999 core.Uri.decodeQueryComponent(keyValue[1]),
4000 );
Martin Kustermannf6325572016-03-14 14:25:28 +01004001 }
4002 }
Kevin Moore58e22332021-02-25 10:11:41 -08004003 unittest.expect(
4004 queryMap["fields"]!.first,
4005 unittest.equals(arg_$fields),
4006 );
Martin Kustermannf6325572016-03-14 14:25:28 +01004007
Martin Kustermannf6325572016-03-14 14:25:28 +01004008 var h = {
Kevin Moored0251702021-01-15 06:41:08 -08004009 'content-type': 'application/json; charset=utf-8',
Martin Kustermannf6325572016-03-14 14:25:28 +01004010 };
Jakob Andersen52715df2018-05-01 13:58:48 +02004011 var resp = convert.json.encode(buildPolicy());
Kevin Moore6d21e902021-01-15 06:41:08 -08004012 return async.Future.value(stringResponse(200, h, resp));
Martin Kustermannf6325572016-03-14 14:25:28 +01004013 }), true);
Kevin Moore341348b2021-02-25 11:55:18 -08004014 final response = await res.getIamPolicy(arg_request, arg_resource,
4015 $fields: arg_$fields);
4016 checkPolicy(response as api.Policy);
Martin Kustermannf6325572016-03-14 14:25:28 +01004017 });
4018
Kevin Moore341348b2021-02-25 11:55:18 -08004019 unittest.test('method--getOrgPolicy', () async {
Kevin Moore6d21e902021-01-15 06:41:08 -08004020 var mock = HttpServerMock();
Kevin Moore5889af72021-01-28 13:31:53 -08004021 var res = api.CloudResourceManagerApi(mock).projects;
Martin Kustermanna6d0a322017-03-27 13:52:31 +02004022 var arg_request = buildGetOrgPolicyRequest();
Kevin Moored0251702021-01-15 06:41:08 -08004023 var arg_resource = 'foo';
4024 var arg_$fields = 'foo';
Martin Kustermann3953f0d2017-06-12 16:59:53 +02004025 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
Kevin Moorec4dbd8e2021-01-26 14:40:35 -08004026 var obj = api.GetOrgPolicyRequest.fromJson(
4027 json as core.Map<core.String, core.dynamic>);
4028 checkGetOrgPolicyRequest(obj as api.GetOrgPolicyRequest);
Martin Kustermanna6d0a322017-03-27 13:52:31 +02004029
4030 var path = (req.url).path;
4031 var pathOffset = 0;
Kevin Moore6d21e902021-01-15 06:41:08 -08004032 core.int index;
4033 core.String subPart;
Martin Kustermann5eb85c12017-09-11 12:35:54 +02004034 unittest.expect(
Kevin Moore58e22332021-02-25 10:11:41 -08004035 path.substring(pathOffset, pathOffset + 1),
4036 unittest.equals("/"),
4037 );
Martin Kustermanna6d0a322017-03-27 13:52:31 +02004038 pathOffset += 1;
Martin Kustermann5eb85c12017-09-11 12:35:54 +02004039 unittest.expect(
Kevin Moore58e22332021-02-25 10:11:41 -08004040 path.substring(pathOffset, pathOffset + 3),
4041 unittest.equals("v1/"),
4042 );
Martin Kustermanna6d0a322017-03-27 13:52:31 +02004043 pathOffset += 3;
4044 // NOTE: We cannot test reserved expansions due to the inability to reverse the operation;
4045
4046 var query = (req.url).query;
4047 var queryOffset = 0;
Jakob Andersen52715df2018-05-01 13:58:48 +02004048 var queryMap = <core.String, core.List<core.String>>{};
Kevin Moore91f7e3e2021-01-26 07:51:20 -08004049 void addQueryParam(core.String n, core.String v) =>
4050 queryMap.putIfAbsent(n, () => []).add(v);
Martin Kustermann5eb85c12017-09-11 12:35:54 +02004051
Kevin Moore6d21e902021-01-15 06:41:08 -08004052 if (query.isNotEmpty) {
Kevin Moored0251702021-01-15 06:41:08 -08004053 for (var part in query.split('&')) {
4054 var keyValue = part.split('=');
Kevin Moore6d21e902021-01-15 06:41:08 -08004055 addQueryParam(
4056 core.Uri.decodeQueryComponent(keyValue[0]),
4057 core.Uri.decodeQueryComponent(keyValue[1]),
4058 );
Martin Kustermanna6d0a322017-03-27 13:52:31 +02004059 }
4060 }
Kevin Moore58e22332021-02-25 10:11:41 -08004061 unittest.expect(
4062 queryMap["fields"]!.first,
4063 unittest.equals(arg_$fields),
4064 );
Martin Kustermanna6d0a322017-03-27 13:52:31 +02004065
Martin Kustermanna6d0a322017-03-27 13:52:31 +02004066 var h = {
Kevin Moored0251702021-01-15 06:41:08 -08004067 'content-type': 'application/json; charset=utf-8',
Martin Kustermanna6d0a322017-03-27 13:52:31 +02004068 };
Jakob Andersen52715df2018-05-01 13:58:48 +02004069 var resp = convert.json.encode(buildOrgPolicy());
Kevin Moore6d21e902021-01-15 06:41:08 -08004070 return async.Future.value(stringResponse(200, h, resp));
Martin Kustermanna6d0a322017-03-27 13:52:31 +02004071 }), true);
Kevin Moore341348b2021-02-25 11:55:18 -08004072 final response = await res.getOrgPolicy(arg_request, arg_resource,
4073 $fields: arg_$fields);
4074 checkOrgPolicy(response as api.OrgPolicy);
Martin Kustermanna6d0a322017-03-27 13:52:31 +02004075 });
4076
Kevin Moore341348b2021-02-25 11:55:18 -08004077 unittest.test('method--list', () async {
Kevin Moore6d21e902021-01-15 06:41:08 -08004078 var mock = HttpServerMock();
Kevin Moore5889af72021-01-28 13:31:53 -08004079 var res = api.CloudResourceManagerApi(mock).projects;
Kevin Moore8810e8b2021-01-19 13:22:15 -08004080 var arg_filter = 'foo';
Martin Kustermann67f25a22018-01-26 23:31:34 +01004081 var arg_pageSize = 42;
Kevin Moored0251702021-01-15 06:41:08 -08004082 var arg_pageToken = 'foo';
Kevin Moored0251702021-01-15 06:41:08 -08004083 var arg_$fields = 'foo';
Martin Kustermann3953f0d2017-06-12 16:59:53 +02004084 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
Martin Kustermannf6325572016-03-14 14:25:28 +01004085 var path = (req.url).path;
4086 var pathOffset = 0;
Kevin Moore6d21e902021-01-15 06:41:08 -08004087 core.int index;
4088 core.String subPart;
Martin Kustermann5eb85c12017-09-11 12:35:54 +02004089 unittest.expect(
Kevin Moore58e22332021-02-25 10:11:41 -08004090 path.substring(pathOffset, pathOffset + 1),
4091 unittest.equals("/"),
4092 );
Martin Kustermannf6325572016-03-14 14:25:28 +01004093 pathOffset += 1;
Kevin Moore58e22332021-02-25 10:11:41 -08004094 unittest.expect(
4095 path.substring(pathOffset, pathOffset + 11),
4096 unittest.equals("v1/projects"),
4097 );
Martin Kustermannf6325572016-03-14 14:25:28 +01004098 pathOffset += 11;
4099
4100 var query = (req.url).query;
4101 var queryOffset = 0;
Jakob Andersen52715df2018-05-01 13:58:48 +02004102 var queryMap = <core.String, core.List<core.String>>{};
Kevin Moore91f7e3e2021-01-26 07:51:20 -08004103 void addQueryParam(core.String n, core.String v) =>
4104 queryMap.putIfAbsent(n, () => []).add(v);
Martin Kustermann5eb85c12017-09-11 12:35:54 +02004105
Kevin Moore6d21e902021-01-15 06:41:08 -08004106 if (query.isNotEmpty) {
Kevin Moored0251702021-01-15 06:41:08 -08004107 for (var part in query.split('&')) {
4108 var keyValue = part.split('=');
Kevin Moore6d21e902021-01-15 06:41:08 -08004109 addQueryParam(
4110 core.Uri.decodeQueryComponent(keyValue[0]),
4111 core.Uri.decodeQueryComponent(keyValue[1]),
4112 );
Martin Kustermannf6325572016-03-14 14:25:28 +01004113 }
4114 }
Jonas Finnemann Jensenef0c8a32020-10-07 20:58:20 +02004115 unittest.expect(
Kevin Moore58e22332021-02-25 10:11:41 -08004116 queryMap["filter"]!.first,
4117 unittest.equals(arg_filter),
4118 );
4119 unittest.expect(
4120 core.int.parse(queryMap["pageSize"]!.first),
4121 unittest.equals(arg_pageSize),
4122 );
4123 unittest.expect(
4124 queryMap["pageToken"]!.first,
4125 unittest.equals(arg_pageToken),
4126 );
4127 unittest.expect(
4128 queryMap["fields"]!.first,
4129 unittest.equals(arg_$fields),
4130 );
Martin Kustermannf6325572016-03-14 14:25:28 +01004131
4132 var h = {
Kevin Moored0251702021-01-15 06:41:08 -08004133 'content-type': 'application/json; charset=utf-8',
Martin Kustermannf6325572016-03-14 14:25:28 +01004134 };
Jakob Andersen52715df2018-05-01 13:58:48 +02004135 var resp = convert.json.encode(buildListProjectsResponse());
Kevin Moore6d21e902021-01-15 06:41:08 -08004136 return async.Future.value(stringResponse(200, h, resp));
Martin Kustermannf6325572016-03-14 14:25:28 +01004137 }), true);
Kevin Moore341348b2021-02-25 11:55:18 -08004138 final response = await res.list(
4139 filter: arg_filter,
4140 pageSize: arg_pageSize,
4141 pageToken: arg_pageToken,
4142 $fields: arg_$fields);
4143 checkListProjectsResponse(response as api.ListProjectsResponse);
Martin Kustermannf6325572016-03-14 14:25:28 +01004144 });
4145
Kevin Moore341348b2021-02-25 11:55:18 -08004146 unittest.test('method--listAvailableOrgPolicyConstraints', () async {
Kevin Moore6d21e902021-01-15 06:41:08 -08004147 var mock = HttpServerMock();
Kevin Moore5889af72021-01-28 13:31:53 -08004148 var res = api.CloudResourceManagerApi(mock).projects;
Martin Kustermanna6d0a322017-03-27 13:52:31 +02004149 var arg_request = buildListAvailableOrgPolicyConstraintsRequest();
Kevin Moored0251702021-01-15 06:41:08 -08004150 var arg_resource = 'foo';
4151 var arg_$fields = 'foo';
Martin Kustermann3953f0d2017-06-12 16:59:53 +02004152 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
Kevin Moorec4dbd8e2021-01-26 14:40:35 -08004153 var obj = api.ListAvailableOrgPolicyConstraintsRequest.fromJson(
4154 json as core.Map<core.String, core.dynamic>);
4155 checkListAvailableOrgPolicyConstraintsRequest(
4156 obj as api.ListAvailableOrgPolicyConstraintsRequest);
Martin Kustermanna6d0a322017-03-27 13:52:31 +02004157
4158 var path = (req.url).path;
4159 var pathOffset = 0;
Kevin Moore6d21e902021-01-15 06:41:08 -08004160 core.int index;
4161 core.String subPart;
Martin Kustermann5eb85c12017-09-11 12:35:54 +02004162 unittest.expect(
Kevin Moore58e22332021-02-25 10:11:41 -08004163 path.substring(pathOffset, pathOffset + 1),
4164 unittest.equals("/"),
4165 );
Martin Kustermanna6d0a322017-03-27 13:52:31 +02004166 pathOffset += 1;
Martin Kustermann5eb85c12017-09-11 12:35:54 +02004167 unittest.expect(
Kevin Moore58e22332021-02-25 10:11:41 -08004168 path.substring(pathOffset, pathOffset + 3),
4169 unittest.equals("v1/"),
4170 );
Martin Kustermanna6d0a322017-03-27 13:52:31 +02004171 pathOffset += 3;
4172 // NOTE: We cannot test reserved expansions due to the inability to reverse the operation;
4173
4174 var query = (req.url).query;
4175 var queryOffset = 0;
Jakob Andersen52715df2018-05-01 13:58:48 +02004176 var queryMap = <core.String, core.List<core.String>>{};
Kevin Moore91f7e3e2021-01-26 07:51:20 -08004177 void addQueryParam(core.String n, core.String v) =>
4178 queryMap.putIfAbsent(n, () => []).add(v);
Martin Kustermann5eb85c12017-09-11 12:35:54 +02004179
Kevin Moore6d21e902021-01-15 06:41:08 -08004180 if (query.isNotEmpty) {
Kevin Moored0251702021-01-15 06:41:08 -08004181 for (var part in query.split('&')) {
4182 var keyValue = part.split('=');
Kevin Moore6d21e902021-01-15 06:41:08 -08004183 addQueryParam(
4184 core.Uri.decodeQueryComponent(keyValue[0]),
4185 core.Uri.decodeQueryComponent(keyValue[1]),
4186 );
Martin Kustermanna6d0a322017-03-27 13:52:31 +02004187 }
4188 }
Kevin Moore58e22332021-02-25 10:11:41 -08004189 unittest.expect(
4190 queryMap["fields"]!.first,
4191 unittest.equals(arg_$fields),
4192 );
Martin Kustermanna6d0a322017-03-27 13:52:31 +02004193
Martin Kustermanna6d0a322017-03-27 13:52:31 +02004194 var h = {
Kevin Moored0251702021-01-15 06:41:08 -08004195 'content-type': 'application/json; charset=utf-8',
Martin Kustermanna6d0a322017-03-27 13:52:31 +02004196 };
Jakob Andersen52715df2018-05-01 13:58:48 +02004197 var resp = convert.json
Martin Kustermann5eb85c12017-09-11 12:35:54 +02004198 .encode(buildListAvailableOrgPolicyConstraintsResponse());
Kevin Moore6d21e902021-01-15 06:41:08 -08004199 return async.Future.value(stringResponse(200, h, resp));
Martin Kustermanna6d0a322017-03-27 13:52:31 +02004200 }), true);
Kevin Moore341348b2021-02-25 11:55:18 -08004201 final response = await res.listAvailableOrgPolicyConstraints(
4202 arg_request, arg_resource,
4203 $fields: arg_$fields);
4204 checkListAvailableOrgPolicyConstraintsResponse(
4205 response as api.ListAvailableOrgPolicyConstraintsResponse);
Martin Kustermanna6d0a322017-03-27 13:52:31 +02004206 });
4207
Kevin Moore341348b2021-02-25 11:55:18 -08004208 unittest.test('method--listOrgPolicies', () async {
Kevin Moore6d21e902021-01-15 06:41:08 -08004209 var mock = HttpServerMock();
Kevin Moore5889af72021-01-28 13:31:53 -08004210 var res = api.CloudResourceManagerApi(mock).projects;
Martin Kustermanna6d0a322017-03-27 13:52:31 +02004211 var arg_request = buildListOrgPoliciesRequest();
Kevin Moored0251702021-01-15 06:41:08 -08004212 var arg_resource = 'foo';
4213 var arg_$fields = 'foo';
Martin Kustermann3953f0d2017-06-12 16:59:53 +02004214 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
Kevin Moorec4dbd8e2021-01-26 14:40:35 -08004215 var obj = api.ListOrgPoliciesRequest.fromJson(
4216 json as core.Map<core.String, core.dynamic>);
4217 checkListOrgPoliciesRequest(obj as api.ListOrgPoliciesRequest);
Martin Kustermanna6d0a322017-03-27 13:52:31 +02004218
4219 var path = (req.url).path;
4220 var pathOffset = 0;
Kevin Moore6d21e902021-01-15 06:41:08 -08004221 core.int index;
4222 core.String subPart;
Martin Kustermann5eb85c12017-09-11 12:35:54 +02004223 unittest.expect(
Kevin Moore58e22332021-02-25 10:11:41 -08004224 path.substring(pathOffset, pathOffset + 1),
4225 unittest.equals("/"),
4226 );
Martin Kustermanna6d0a322017-03-27 13:52:31 +02004227 pathOffset += 1;
Martin Kustermann5eb85c12017-09-11 12:35:54 +02004228 unittest.expect(
Kevin Moore58e22332021-02-25 10:11:41 -08004229 path.substring(pathOffset, pathOffset + 3),
4230 unittest.equals("v1/"),
4231 );
Martin Kustermanna6d0a322017-03-27 13:52:31 +02004232 pathOffset += 3;
4233 // NOTE: We cannot test reserved expansions due to the inability to reverse the operation;
4234
4235 var query = (req.url).query;
4236 var queryOffset = 0;
Jakob Andersen52715df2018-05-01 13:58:48 +02004237 var queryMap = <core.String, core.List<core.String>>{};
Kevin Moore91f7e3e2021-01-26 07:51:20 -08004238 void addQueryParam(core.String n, core.String v) =>
4239 queryMap.putIfAbsent(n, () => []).add(v);
Martin Kustermann5eb85c12017-09-11 12:35:54 +02004240
Kevin Moore6d21e902021-01-15 06:41:08 -08004241 if (query.isNotEmpty) {
Kevin Moored0251702021-01-15 06:41:08 -08004242 for (var part in query.split('&')) {
4243 var keyValue = part.split('=');
Kevin Moore6d21e902021-01-15 06:41:08 -08004244 addQueryParam(
4245 core.Uri.decodeQueryComponent(keyValue[0]),
4246 core.Uri.decodeQueryComponent(keyValue[1]),
4247 );
Martin Kustermanna6d0a322017-03-27 13:52:31 +02004248 }
4249 }
Kevin Moore58e22332021-02-25 10:11:41 -08004250 unittest.expect(
4251 queryMap["fields"]!.first,
4252 unittest.equals(arg_$fields),
4253 );
Martin Kustermanna6d0a322017-03-27 13:52:31 +02004254
Martin Kustermanna6d0a322017-03-27 13:52:31 +02004255 var h = {
Kevin Moored0251702021-01-15 06:41:08 -08004256 'content-type': 'application/json; charset=utf-8',
Martin Kustermanna6d0a322017-03-27 13:52:31 +02004257 };
Jakob Andersen52715df2018-05-01 13:58:48 +02004258 var resp = convert.json.encode(buildListOrgPoliciesResponse());
Kevin Moore6d21e902021-01-15 06:41:08 -08004259 return async.Future.value(stringResponse(200, h, resp));
Martin Kustermanna6d0a322017-03-27 13:52:31 +02004260 }), true);
Kevin Moore341348b2021-02-25 11:55:18 -08004261 final response = await res.listOrgPolicies(arg_request, arg_resource,
4262 $fields: arg_$fields);
4263 checkListOrgPoliciesResponse(response as api.ListOrgPoliciesResponse);
Martin Kustermanna6d0a322017-03-27 13:52:31 +02004264 });
4265
Kevin Moore341348b2021-02-25 11:55:18 -08004266 unittest.test('method--setIamPolicy', () async {
Kevin Moore6d21e902021-01-15 06:41:08 -08004267 var mock = HttpServerMock();
Kevin Moore5889af72021-01-28 13:31:53 -08004268 var res = api.CloudResourceManagerApi(mock).projects;
Martin Kustermannf6325572016-03-14 14:25:28 +01004269 var arg_request = buildSetIamPolicyRequest();
Kevin Moored0251702021-01-15 06:41:08 -08004270 var arg_resource = 'foo';
4271 var arg_$fields = 'foo';
Martin Kustermann3953f0d2017-06-12 16:59:53 +02004272 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
Kevin Moorec4dbd8e2021-01-26 14:40:35 -08004273 var obj = api.SetIamPolicyRequest.fromJson(
4274 json as core.Map<core.String, core.dynamic>);
4275 checkSetIamPolicyRequest(obj as api.SetIamPolicyRequest);
Martin Kustermannf6325572016-03-14 14:25:28 +01004276
4277 var path = (req.url).path;
4278 var pathOffset = 0;
Kevin Moore6d21e902021-01-15 06:41:08 -08004279 core.int index;
4280 core.String subPart;
Martin Kustermann5eb85c12017-09-11 12:35:54 +02004281 unittest.expect(
Kevin Moore58e22332021-02-25 10:11:41 -08004282 path.substring(pathOffset, pathOffset + 1),
4283 unittest.equals("/"),
4284 );
Martin Kustermannf6325572016-03-14 14:25:28 +01004285 pathOffset += 1;
Kevin Moore58e22332021-02-25 10:11:41 -08004286 unittest.expect(
4287 path.substring(pathOffset, pathOffset + 12),
4288 unittest.equals("v1/projects/"),
4289 );
Martin Kustermannf6325572016-03-14 14:25:28 +01004290 pathOffset += 12;
Kevin Moored0251702021-01-15 06:41:08 -08004291 index = path.indexOf(':setIamPolicy', pathOffset);
Martin Kustermannf6325572016-03-14 14:25:28 +01004292 unittest.expect(index >= 0, unittest.isTrue);
Martin Kustermann5eb85c12017-09-11 12:35:54 +02004293 subPart =
4294 core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
Martin Kustermannf6325572016-03-14 14:25:28 +01004295 pathOffset = index;
Kevin Moore58e22332021-02-25 10:11:41 -08004296 unittest.expect(
4297 subPart,
4298 unittest.equals('$arg_resource'),
4299 );
4300 unittest.expect(
4301 path.substring(pathOffset, pathOffset + 13),
4302 unittest.equals(":setIamPolicy"),
4303 );
Martin Kustermannf6325572016-03-14 14:25:28 +01004304 pathOffset += 13;
4305
4306 var query = (req.url).query;
4307 var queryOffset = 0;
Jakob Andersen52715df2018-05-01 13:58:48 +02004308 var queryMap = <core.String, core.List<core.String>>{};
Kevin Moore91f7e3e2021-01-26 07:51:20 -08004309 void addQueryParam(core.String n, core.String v) =>
4310 queryMap.putIfAbsent(n, () => []).add(v);
Martin Kustermann5eb85c12017-09-11 12:35:54 +02004311
Kevin Moore6d21e902021-01-15 06:41:08 -08004312 if (query.isNotEmpty) {
Kevin Moored0251702021-01-15 06:41:08 -08004313 for (var part in query.split('&')) {
4314 var keyValue = part.split('=');
Kevin Moore6d21e902021-01-15 06:41:08 -08004315 addQueryParam(
4316 core.Uri.decodeQueryComponent(keyValue[0]),
4317 core.Uri.decodeQueryComponent(keyValue[1]),
4318 );
Martin Kustermannf6325572016-03-14 14:25:28 +01004319 }
4320 }
Kevin Moore58e22332021-02-25 10:11:41 -08004321 unittest.expect(
4322 queryMap["fields"]!.first,
4323 unittest.equals(arg_$fields),
4324 );
Martin Kustermannf6325572016-03-14 14:25:28 +01004325
Martin Kustermannf6325572016-03-14 14:25:28 +01004326 var h = {
Kevin Moored0251702021-01-15 06:41:08 -08004327 'content-type': 'application/json; charset=utf-8',
Martin Kustermannf6325572016-03-14 14:25:28 +01004328 };
Jakob Andersen52715df2018-05-01 13:58:48 +02004329 var resp = convert.json.encode(buildPolicy());
Kevin Moore6d21e902021-01-15 06:41:08 -08004330 return async.Future.value(stringResponse(200, h, resp));
Martin Kustermannf6325572016-03-14 14:25:28 +01004331 }), true);
Kevin Moore341348b2021-02-25 11:55:18 -08004332 final response = await res.setIamPolicy(arg_request, arg_resource,
4333 $fields: arg_$fields);
4334 checkPolicy(response as api.Policy);
Martin Kustermannf6325572016-03-14 14:25:28 +01004335 });
4336
Kevin Moore341348b2021-02-25 11:55:18 -08004337 unittest.test('method--setOrgPolicy', () async {
Kevin Moore6d21e902021-01-15 06:41:08 -08004338 var mock = HttpServerMock();
Kevin Moore5889af72021-01-28 13:31:53 -08004339 var res = api.CloudResourceManagerApi(mock).projects;
Martin Kustermanna6d0a322017-03-27 13:52:31 +02004340 var arg_request = buildSetOrgPolicyRequest();
Kevin Moored0251702021-01-15 06:41:08 -08004341 var arg_resource = 'foo';
4342 var arg_$fields = 'foo';
Martin Kustermann3953f0d2017-06-12 16:59:53 +02004343 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
Kevin Moorec4dbd8e2021-01-26 14:40:35 -08004344 var obj = api.SetOrgPolicyRequest.fromJson(
4345 json as core.Map<core.String, core.dynamic>);
4346 checkSetOrgPolicyRequest(obj as api.SetOrgPolicyRequest);
Martin Kustermanna6d0a322017-03-27 13:52:31 +02004347
4348 var path = (req.url).path;
4349 var pathOffset = 0;
Kevin Moore6d21e902021-01-15 06:41:08 -08004350 core.int index;
4351 core.String subPart;
Martin Kustermann5eb85c12017-09-11 12:35:54 +02004352 unittest.expect(
Kevin Moore58e22332021-02-25 10:11:41 -08004353 path.substring(pathOffset, pathOffset + 1),
4354 unittest.equals("/"),
4355 );
Martin Kustermanna6d0a322017-03-27 13:52:31 +02004356 pathOffset += 1;
Martin Kustermann5eb85c12017-09-11 12:35:54 +02004357 unittest.expect(
Kevin Moore58e22332021-02-25 10:11:41 -08004358 path.substring(pathOffset, pathOffset + 3),
4359 unittest.equals("v1/"),
4360 );
Martin Kustermanna6d0a322017-03-27 13:52:31 +02004361 pathOffset += 3;
4362 // NOTE: We cannot test reserved expansions due to the inability to reverse the operation;
4363
4364 var query = (req.url).query;
4365 var queryOffset = 0;
Jakob Andersen52715df2018-05-01 13:58:48 +02004366 var queryMap = <core.String, core.List<core.String>>{};
Kevin Moore91f7e3e2021-01-26 07:51:20 -08004367 void addQueryParam(core.String n, core.String v) =>
4368 queryMap.putIfAbsent(n, () => []).add(v);
Martin Kustermann5eb85c12017-09-11 12:35:54 +02004369
Kevin Moore6d21e902021-01-15 06:41:08 -08004370 if (query.isNotEmpty) {
Kevin Moored0251702021-01-15 06:41:08 -08004371 for (var part in query.split('&')) {
4372 var keyValue = part.split('=');
Kevin Moore6d21e902021-01-15 06:41:08 -08004373 addQueryParam(
4374 core.Uri.decodeQueryComponent(keyValue[0]),
4375 core.Uri.decodeQueryComponent(keyValue[1]),
4376 );
Martin Kustermanna6d0a322017-03-27 13:52:31 +02004377 }
4378 }
Kevin Moore58e22332021-02-25 10:11:41 -08004379 unittest.expect(
4380 queryMap["fields"]!.first,
4381 unittest.equals(arg_$fields),
4382 );
Martin Kustermanna6d0a322017-03-27 13:52:31 +02004383
Martin Kustermanna6d0a322017-03-27 13:52:31 +02004384 var h = {
Kevin Moored0251702021-01-15 06:41:08 -08004385 'content-type': 'application/json; charset=utf-8',
Martin Kustermanna6d0a322017-03-27 13:52:31 +02004386 };
Jakob Andersen52715df2018-05-01 13:58:48 +02004387 var resp = convert.json.encode(buildOrgPolicy());
Kevin Moore6d21e902021-01-15 06:41:08 -08004388 return async.Future.value(stringResponse(200, h, resp));
Martin Kustermanna6d0a322017-03-27 13:52:31 +02004389 }), true);
Kevin Moore341348b2021-02-25 11:55:18 -08004390 final response = await res.setOrgPolicy(arg_request, arg_resource,
4391 $fields: arg_$fields);
4392 checkOrgPolicy(response as api.OrgPolicy);
Martin Kustermanna6d0a322017-03-27 13:52:31 +02004393 });
4394
Kevin Moore341348b2021-02-25 11:55:18 -08004395 unittest.test('method--testIamPermissions', () async {
Kevin Moore6d21e902021-01-15 06:41:08 -08004396 var mock = HttpServerMock();
Kevin Moore5889af72021-01-28 13:31:53 -08004397 var res = api.CloudResourceManagerApi(mock).projects;
Martin Kustermannf6325572016-03-14 14:25:28 +01004398 var arg_request = buildTestIamPermissionsRequest();
Kevin Moored0251702021-01-15 06:41:08 -08004399 var arg_resource = 'foo';
4400 var arg_$fields = 'foo';
Martin Kustermann3953f0d2017-06-12 16:59:53 +02004401 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
Kevin Moorec4dbd8e2021-01-26 14:40:35 -08004402 var obj = api.TestIamPermissionsRequest.fromJson(
4403 json as core.Map<core.String, core.dynamic>);
4404 checkTestIamPermissionsRequest(obj as api.TestIamPermissionsRequest);
Martin Kustermannf6325572016-03-14 14:25:28 +01004405
4406 var path = (req.url).path;
4407 var pathOffset = 0;
Kevin Moore6d21e902021-01-15 06:41:08 -08004408 core.int index;
4409 core.String subPart;
Martin Kustermann5eb85c12017-09-11 12:35:54 +02004410 unittest.expect(
Kevin Moore58e22332021-02-25 10:11:41 -08004411 path.substring(pathOffset, pathOffset + 1),
4412 unittest.equals("/"),
4413 );
Martin Kustermannf6325572016-03-14 14:25:28 +01004414 pathOffset += 1;
Kevin Moore58e22332021-02-25 10:11:41 -08004415 unittest.expect(
4416 path.substring(pathOffset, pathOffset + 12),
4417 unittest.equals("v1/projects/"),
4418 );
Martin Kustermannf6325572016-03-14 14:25:28 +01004419 pathOffset += 12;
Kevin Moored0251702021-01-15 06:41:08 -08004420 index = path.indexOf(':testIamPermissions', pathOffset);
Martin Kustermannf6325572016-03-14 14:25:28 +01004421 unittest.expect(index >= 0, unittest.isTrue);
Martin Kustermann5eb85c12017-09-11 12:35:54 +02004422 subPart =
4423 core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
Martin Kustermannf6325572016-03-14 14:25:28 +01004424 pathOffset = index;
Kevin Moore58e22332021-02-25 10:11:41 -08004425 unittest.expect(
4426 subPart,
4427 unittest.equals('$arg_resource'),
4428 );
4429 unittest.expect(
4430 path.substring(pathOffset, pathOffset + 19),
4431 unittest.equals(":testIamPermissions"),
4432 );
Martin Kustermannf6325572016-03-14 14:25:28 +01004433 pathOffset += 19;
4434
4435 var query = (req.url).query;
4436 var queryOffset = 0;
Jakob Andersen52715df2018-05-01 13:58:48 +02004437 var queryMap = <core.String, core.List<core.String>>{};
Kevin Moore91f7e3e2021-01-26 07:51:20 -08004438 void addQueryParam(core.String n, core.String v) =>
4439 queryMap.putIfAbsent(n, () => []).add(v);
Martin Kustermann5eb85c12017-09-11 12:35:54 +02004440
Kevin Moore6d21e902021-01-15 06:41:08 -08004441 if (query.isNotEmpty) {
Kevin Moored0251702021-01-15 06:41:08 -08004442 for (var part in query.split('&')) {
4443 var keyValue = part.split('=');
Kevin Moore6d21e902021-01-15 06:41:08 -08004444 addQueryParam(
4445 core.Uri.decodeQueryComponent(keyValue[0]),
4446 core.Uri.decodeQueryComponent(keyValue[1]),
4447 );
Martin Kustermannf6325572016-03-14 14:25:28 +01004448 }
4449 }
Kevin Moore58e22332021-02-25 10:11:41 -08004450 unittest.expect(
4451 queryMap["fields"]!.first,
4452 unittest.equals(arg_$fields),
4453 );
Martin Kustermannf6325572016-03-14 14:25:28 +01004454
Martin Kustermannf6325572016-03-14 14:25:28 +01004455 var h = {
Kevin Moored0251702021-01-15 06:41:08 -08004456 'content-type': 'application/json; charset=utf-8',
Martin Kustermannf6325572016-03-14 14:25:28 +01004457 };
Jakob Andersen52715df2018-05-01 13:58:48 +02004458 var resp = convert.json.encode(buildTestIamPermissionsResponse());
Kevin Moore6d21e902021-01-15 06:41:08 -08004459 return async.Future.value(stringResponse(200, h, resp));
Martin Kustermannf6325572016-03-14 14:25:28 +01004460 }), true);
Kevin Moore341348b2021-02-25 11:55:18 -08004461 final response = await res.testIamPermissions(arg_request, arg_resource,
4462 $fields: arg_$fields);
4463 checkTestIamPermissionsResponse(
4464 response as api.TestIamPermissionsResponse);
Martin Kustermannf6325572016-03-14 14:25:28 +01004465 });
4466
Kevin Moore341348b2021-02-25 11:55:18 -08004467 unittest.test('method--undelete', () async {
Kevin Moore6d21e902021-01-15 06:41:08 -08004468 var mock = HttpServerMock();
Kevin Moore5889af72021-01-28 13:31:53 -08004469 var res = api.CloudResourceManagerApi(mock).projects;
Martin Kustermannf6325572016-03-14 14:25:28 +01004470 var arg_request = buildUndeleteProjectRequest();
Kevin Moored0251702021-01-15 06:41:08 -08004471 var arg_projectId = 'foo';
4472 var arg_$fields = 'foo';
Martin Kustermann3953f0d2017-06-12 16:59:53 +02004473 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
Kevin Moorec4dbd8e2021-01-26 14:40:35 -08004474 var obj = api.UndeleteProjectRequest.fromJson(
4475 json as core.Map<core.String, core.dynamic>);
4476 checkUndeleteProjectRequest(obj as api.UndeleteProjectRequest);
Martin Kustermannf6325572016-03-14 14:25:28 +01004477
4478 var path = (req.url).path;
4479 var pathOffset = 0;
Kevin Moore6d21e902021-01-15 06:41:08 -08004480 core.int index;
4481 core.String subPart;
Martin Kustermann5eb85c12017-09-11 12:35:54 +02004482 unittest.expect(
Kevin Moore58e22332021-02-25 10:11:41 -08004483 path.substring(pathOffset, pathOffset + 1),
4484 unittest.equals("/"),
4485 );
Martin Kustermannf6325572016-03-14 14:25:28 +01004486 pathOffset += 1;
Kevin Moore58e22332021-02-25 10:11:41 -08004487 unittest.expect(
4488 path.substring(pathOffset, pathOffset + 12),
4489 unittest.equals("v1/projects/"),
4490 );
Martin Kustermannf6325572016-03-14 14:25:28 +01004491 pathOffset += 12;
Kevin Moored0251702021-01-15 06:41:08 -08004492 index = path.indexOf(':undelete', pathOffset);
Martin Kustermannf6325572016-03-14 14:25:28 +01004493 unittest.expect(index >= 0, unittest.isTrue);
Martin Kustermann5eb85c12017-09-11 12:35:54 +02004494 subPart =
4495 core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
Martin Kustermannf6325572016-03-14 14:25:28 +01004496 pathOffset = index;
Kevin Moore58e22332021-02-25 10:11:41 -08004497 unittest.expect(
4498 subPart,
4499 unittest.equals('$arg_projectId'),
4500 );
4501 unittest.expect(
4502 path.substring(pathOffset, pathOffset + 9),
4503 unittest.equals(":undelete"),
4504 );
Martin Kustermannf6325572016-03-14 14:25:28 +01004505 pathOffset += 9;
4506
4507 var query = (req.url).query;
4508 var queryOffset = 0;
Jakob Andersen52715df2018-05-01 13:58:48 +02004509 var queryMap = <core.String, core.List<core.String>>{};
Kevin Moore91f7e3e2021-01-26 07:51:20 -08004510 void addQueryParam(core.String n, core.String v) =>
4511 queryMap.putIfAbsent(n, () => []).add(v);
Martin Kustermann5eb85c12017-09-11 12:35:54 +02004512
Kevin Moore6d21e902021-01-15 06:41:08 -08004513 if (query.isNotEmpty) {
Kevin Moored0251702021-01-15 06:41:08 -08004514 for (var part in query.split('&')) {
4515 var keyValue = part.split('=');
Kevin Moore6d21e902021-01-15 06:41:08 -08004516 addQueryParam(
4517 core.Uri.decodeQueryComponent(keyValue[0]),
4518 core.Uri.decodeQueryComponent(keyValue[1]),
4519 );
Martin Kustermannf6325572016-03-14 14:25:28 +01004520 }
4521 }
Kevin Moore58e22332021-02-25 10:11:41 -08004522 unittest.expect(
4523 queryMap["fields"]!.first,
4524 unittest.equals(arg_$fields),
4525 );
Martin Kustermannf6325572016-03-14 14:25:28 +01004526
Martin Kustermannf6325572016-03-14 14:25:28 +01004527 var h = {
Kevin Moored0251702021-01-15 06:41:08 -08004528 'content-type': 'application/json; charset=utf-8',
Martin Kustermannf6325572016-03-14 14:25:28 +01004529 };
Jakob Andersen52715df2018-05-01 13:58:48 +02004530 var resp = convert.json.encode(buildEmpty());
Kevin Moore6d21e902021-01-15 06:41:08 -08004531 return async.Future.value(stringResponse(200, h, resp));
Martin Kustermannf6325572016-03-14 14:25:28 +01004532 }), true);
Kevin Moore341348b2021-02-25 11:55:18 -08004533 final response =
4534 await res.undelete(arg_request, arg_projectId, $fields: arg_$fields);
4535 checkEmpty(response as api.Empty);
Martin Kustermannf6325572016-03-14 14:25:28 +01004536 });
4537
Kevin Moore341348b2021-02-25 11:55:18 -08004538 unittest.test('method--update', () async {
Kevin Moore6d21e902021-01-15 06:41:08 -08004539 var mock = HttpServerMock();
Kevin Moore5889af72021-01-28 13:31:53 -08004540 var res = api.CloudResourceManagerApi(mock).projects;
Martin Kustermannf6325572016-03-14 14:25:28 +01004541 var arg_request = buildProject();
Kevin Moored0251702021-01-15 06:41:08 -08004542 var arg_projectId = 'foo';
4543 var arg_$fields = 'foo';
Martin Kustermann3953f0d2017-06-12 16:59:53 +02004544 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
Kevin Moorec4dbd8e2021-01-26 14:40:35 -08004545 var obj =
4546 api.Project.fromJson(json as core.Map<core.String, core.dynamic>);
4547 checkProject(obj as api.Project);
Martin Kustermannf6325572016-03-14 14:25:28 +01004548
4549 var path = (req.url).path;
4550 var pathOffset = 0;
Kevin Moore6d21e902021-01-15 06:41:08 -08004551 core.int index;
4552 core.String subPart;
Martin Kustermann5eb85c12017-09-11 12:35:54 +02004553 unittest.expect(
Kevin Moore58e22332021-02-25 10:11:41 -08004554 path.substring(pathOffset, pathOffset + 1),
4555 unittest.equals("/"),
4556 );
Martin Kustermannf6325572016-03-14 14:25:28 +01004557 pathOffset += 1;
Kevin Moore58e22332021-02-25 10:11:41 -08004558 unittest.expect(
4559 path.substring(pathOffset, pathOffset + 12),
4560 unittest.equals("v1/projects/"),
4561 );
Martin Kustermannf6325572016-03-14 14:25:28 +01004562 pathOffset += 12;
4563 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset));
4564 pathOffset = path.length;
Kevin Moore58e22332021-02-25 10:11:41 -08004565 unittest.expect(
4566 subPart,
4567 unittest.equals('$arg_projectId'),
4568 );
Martin Kustermannf6325572016-03-14 14:25:28 +01004569
4570 var query = (req.url).query;
4571 var queryOffset = 0;
Jakob Andersen52715df2018-05-01 13:58:48 +02004572 var queryMap = <core.String, core.List<core.String>>{};
Kevin Moore91f7e3e2021-01-26 07:51:20 -08004573 void addQueryParam(core.String n, core.String v) =>
4574 queryMap.putIfAbsent(n, () => []).add(v);
Martin Kustermann5eb85c12017-09-11 12:35:54 +02004575
Kevin Moore6d21e902021-01-15 06:41:08 -08004576 if (query.isNotEmpty) {
Kevin Moored0251702021-01-15 06:41:08 -08004577 for (var part in query.split('&')) {
4578 var keyValue = part.split('=');
Kevin Moore6d21e902021-01-15 06:41:08 -08004579 addQueryParam(
4580 core.Uri.decodeQueryComponent(keyValue[0]),
4581 core.Uri.decodeQueryComponent(keyValue[1]),
4582 );
Martin Kustermannf6325572016-03-14 14:25:28 +01004583 }
4584 }
Kevin Moore58e22332021-02-25 10:11:41 -08004585 unittest.expect(
4586 queryMap["fields"]!.first,
4587 unittest.equals(arg_$fields),
4588 );
Martin Kustermannf6325572016-03-14 14:25:28 +01004589
Martin Kustermannf6325572016-03-14 14:25:28 +01004590 var h = {
Kevin Moored0251702021-01-15 06:41:08 -08004591 'content-type': 'application/json; charset=utf-8',
Martin Kustermannf6325572016-03-14 14:25:28 +01004592 };
Jakob Andersen52715df2018-05-01 13:58:48 +02004593 var resp = convert.json.encode(buildProject());
Kevin Moore6d21e902021-01-15 06:41:08 -08004594 return async.Future.value(stringResponse(200, h, resp));
Martin Kustermannf6325572016-03-14 14:25:28 +01004595 }), true);
Kevin Moore341348b2021-02-25 11:55:18 -08004596 final response =
4597 await res.update(arg_request, arg_projectId, $fields: arg_$fields);
4598 checkProject(response as api.Project);
Martin Kustermannf6325572016-03-14 14:25:28 +01004599 });
Martin Kustermannf6325572016-03-14 14:25:28 +01004600 });
Martin Kustermannf6325572016-03-14 14:25:28 +01004601}