OLD | NEW |
1 library googleapis_beta.cloudresourcemanager.v1beta1.test; | 1 library googleapis_beta.cloudresourcemanager.v1beta1.test; |
2 | 2 |
3 import "dart:core" as core; | 3 import "dart:core" as core; |
4 import "dart:collection" as collection; | |
5 import "dart:async" as async; | 4 import "dart:async" as async; |
6 import "dart:convert" as convert; | 5 import "dart:convert" as convert; |
7 | 6 |
8 import 'package:http/http.dart' as http; | 7 import 'package:http/http.dart' as http; |
9 import 'package:http/testing.dart' as http_testing; | |
10 import 'package:test/test.dart' as unittest; | 8 import 'package:test/test.dart' as unittest; |
11 | 9 |
12 import 'package:googleapis_beta/cloudresourcemanager/v1beta1.dart' as api; | 10 import 'package:googleapis_beta/cloudresourcemanager/v1beta1.dart' as api; |
13 | 11 |
14 class HttpServerMock extends http.BaseClient { | 12 class HttpServerMock extends http.BaseClient { |
15 core.Function _callback; | 13 core.Function _callback; |
16 core.bool _expectJson; | 14 core.bool _expectJson; |
17 | 15 |
18 void register(core.Function callback, core.bool expectJson) { | 16 void register(core.Function callback, core.bool expectJson) { |
19 _callback = callback; | 17 _callback = callback; |
20 _expectJson = expectJson; | 18 _expectJson = expectJson; |
21 } | 19 } |
22 | 20 |
23 async.Future<http.StreamedResponse> send(http.BaseRequest request) { | 21 async.Future<http.StreamedResponse> send(http.BaseRequest request) { |
24 if (_expectJson) { | 22 if (_expectJson) { |
25 return request.finalize() | 23 return request |
| 24 .finalize() |
26 .transform(convert.UTF8.decoder) | 25 .transform(convert.UTF8.decoder) |
27 .join('') | 26 .join('') |
28 .then((core.String jsonString) { | 27 .then((core.String jsonString) { |
29 if (jsonString.isEmpty) { | 28 if (jsonString.isEmpty) { |
30 return _callback(request, null); | 29 return _callback(request, null); |
31 } else { | 30 } else { |
32 return _callback(request, convert.JSON.decode(jsonString)); | 31 return _callback(request, convert.JSON.decode(jsonString)); |
33 } | 32 } |
34 }); | 33 }); |
35 } else { | 34 } else { |
36 var stream = request.finalize(); | 35 var stream = request.finalize(); |
37 if (stream == null) { | 36 if (stream == null) { |
38 return _callback(request, []); | 37 return _callback(request, []); |
39 } else { | 38 } else { |
40 return stream.toBytes().then((data) { | 39 return stream.toBytes().then((data) { |
41 return _callback(request, data); | 40 return _callback(request, data); |
42 }); | 41 }); |
43 } | 42 } |
44 } | 43 } |
45 } | 44 } |
46 } | 45 } |
47 | 46 |
48 http.StreamedResponse stringResponse( | 47 http.StreamedResponse stringResponse(core.int status, |
49 core.int status, core.Map<core.String, core.String> headers, core.String bod
y) { | 48 core.Map<core.String, core.String> headers, core.String body) { |
50 var stream = new async.Stream.fromIterable([convert.UTF8.encode(body)]); | 49 var stream = new async.Stream.fromIterable([convert.UTF8.encode(body)]); |
51 return new http.StreamedResponse(stream, status, headers: headers); | 50 return new http.StreamedResponse(stream, status, headers: headers); |
52 } | 51 } |
53 | 52 |
54 core.int buildCounterAncestor = 0; | 53 core.int buildCounterAncestor = 0; |
55 buildAncestor() { | 54 buildAncestor() { |
56 var o = new api.Ancestor(); | 55 var o = new api.Ancestor(); |
57 buildCounterAncestor++; | 56 buildCounterAncestor++; |
58 if (buildCounterAncestor < 3) { | 57 if (buildCounterAncestor < 3) { |
59 o.resourceId = buildResourceId(); | 58 o.resourceId = buildResourceId(); |
60 } | 59 } |
61 buildCounterAncestor--; | 60 buildCounterAncestor--; |
62 return o; | 61 return o; |
63 } | 62 } |
64 | 63 |
65 checkAncestor(api.Ancestor o) { | 64 checkAncestor(api.Ancestor o) { |
66 buildCounterAncestor++; | 65 buildCounterAncestor++; |
67 if (buildCounterAncestor < 3) { | 66 if (buildCounterAncestor < 3) { |
68 checkResourceId(o.resourceId); | 67 checkResourceId(o.resourceId); |
69 } | 68 } |
70 buildCounterAncestor--; | 69 buildCounterAncestor--; |
71 } | 70 } |
72 | 71 |
73 buildUnnamed3426() { | 72 buildUnnamed3431() { |
74 var o = new core.List<api.AuditLogConfig>(); | 73 var o = new core.List<api.AuditLogConfig>(); |
75 o.add(buildAuditLogConfig()); | 74 o.add(buildAuditLogConfig()); |
76 o.add(buildAuditLogConfig()); | 75 o.add(buildAuditLogConfig()); |
77 return o; | 76 return o; |
78 } | 77 } |
79 | 78 |
80 checkUnnamed3426(core.List<api.AuditLogConfig> o) { | 79 checkUnnamed3431(core.List<api.AuditLogConfig> o) { |
81 unittest.expect(o, unittest.hasLength(2)); | 80 unittest.expect(o, unittest.hasLength(2)); |
82 checkAuditLogConfig(o[0]); | 81 checkAuditLogConfig(o[0]); |
83 checkAuditLogConfig(o[1]); | 82 checkAuditLogConfig(o[1]); |
84 } | 83 } |
85 | 84 |
86 core.int buildCounterAuditConfig = 0; | 85 core.int buildCounterAuditConfig = 0; |
87 buildAuditConfig() { | 86 buildAuditConfig() { |
88 var o = new api.AuditConfig(); | 87 var o = new api.AuditConfig(); |
89 buildCounterAuditConfig++; | 88 buildCounterAuditConfig++; |
90 if (buildCounterAuditConfig < 3) { | 89 if (buildCounterAuditConfig < 3) { |
91 o.auditLogConfigs = buildUnnamed3426(); | 90 o.auditLogConfigs = buildUnnamed3431(); |
92 o.service = "foo"; | 91 o.service = "foo"; |
93 } | 92 } |
94 buildCounterAuditConfig--; | 93 buildCounterAuditConfig--; |
95 return o; | 94 return o; |
96 } | 95 } |
97 | 96 |
98 checkAuditConfig(api.AuditConfig o) { | 97 checkAuditConfig(api.AuditConfig o) { |
99 buildCounterAuditConfig++; | 98 buildCounterAuditConfig++; |
100 if (buildCounterAuditConfig < 3) { | 99 if (buildCounterAuditConfig < 3) { |
101 checkUnnamed3426(o.auditLogConfigs); | 100 checkUnnamed3431(o.auditLogConfigs); |
102 unittest.expect(o.service, unittest.equals('foo')); | 101 unittest.expect(o.service, unittest.equals('foo')); |
103 } | 102 } |
104 buildCounterAuditConfig--; | 103 buildCounterAuditConfig--; |
105 } | 104 } |
106 | 105 |
107 buildUnnamed3427() { | 106 buildUnnamed3432() { |
108 var o = new core.List<core.String>(); | 107 var o = new core.List<core.String>(); |
109 o.add("foo"); | 108 o.add("foo"); |
110 o.add("foo"); | 109 o.add("foo"); |
111 return o; | 110 return o; |
112 } | 111 } |
113 | 112 |
114 checkUnnamed3427(core.List<core.String> o) { | 113 checkUnnamed3432(core.List<core.String> o) { |
115 unittest.expect(o, unittest.hasLength(2)); | 114 unittest.expect(o, unittest.hasLength(2)); |
116 unittest.expect(o[0], unittest.equals('foo')); | 115 unittest.expect(o[0], unittest.equals('foo')); |
117 unittest.expect(o[1], unittest.equals('foo')); | 116 unittest.expect(o[1], unittest.equals('foo')); |
118 } | 117 } |
119 | 118 |
120 core.int buildCounterAuditLogConfig = 0; | 119 core.int buildCounterAuditLogConfig = 0; |
121 buildAuditLogConfig() { | 120 buildAuditLogConfig() { |
122 var o = new api.AuditLogConfig(); | 121 var o = new api.AuditLogConfig(); |
123 buildCounterAuditLogConfig++; | 122 buildCounterAuditLogConfig++; |
124 if (buildCounterAuditLogConfig < 3) { | 123 if (buildCounterAuditLogConfig < 3) { |
125 o.exemptedMembers = buildUnnamed3427(); | 124 o.exemptedMembers = buildUnnamed3432(); |
126 o.logType = "foo"; | 125 o.logType = "foo"; |
127 } | 126 } |
128 buildCounterAuditLogConfig--; | 127 buildCounterAuditLogConfig--; |
129 return o; | 128 return o; |
130 } | 129 } |
131 | 130 |
132 checkAuditLogConfig(api.AuditLogConfig o) { | 131 checkAuditLogConfig(api.AuditLogConfig o) { |
133 buildCounterAuditLogConfig++; | 132 buildCounterAuditLogConfig++; |
134 if (buildCounterAuditLogConfig < 3) { | 133 if (buildCounterAuditLogConfig < 3) { |
135 checkUnnamed3427(o.exemptedMembers); | 134 checkUnnamed3432(o.exemptedMembers); |
136 unittest.expect(o.logType, unittest.equals('foo')); | 135 unittest.expect(o.logType, unittest.equals('foo')); |
137 } | 136 } |
138 buildCounterAuditLogConfig--; | 137 buildCounterAuditLogConfig--; |
139 } | 138 } |
140 | 139 |
141 buildUnnamed3428() { | 140 buildUnnamed3433() { |
142 var o = new core.List<core.String>(); | 141 var o = new core.List<core.String>(); |
143 o.add("foo"); | 142 o.add("foo"); |
144 o.add("foo"); | 143 o.add("foo"); |
145 return o; | 144 return o; |
146 } | 145 } |
147 | 146 |
148 checkUnnamed3428(core.List<core.String> o) { | 147 checkUnnamed3433(core.List<core.String> o) { |
149 unittest.expect(o, unittest.hasLength(2)); | 148 unittest.expect(o, unittest.hasLength(2)); |
150 unittest.expect(o[0], unittest.equals('foo')); | 149 unittest.expect(o[0], unittest.equals('foo')); |
151 unittest.expect(o[1], unittest.equals('foo')); | 150 unittest.expect(o[1], unittest.equals('foo')); |
152 } | 151 } |
153 | 152 |
154 core.int buildCounterBinding = 0; | 153 core.int buildCounterBinding = 0; |
155 buildBinding() { | 154 buildBinding() { |
156 var o = new api.Binding(); | 155 var o = new api.Binding(); |
157 buildCounterBinding++; | 156 buildCounterBinding++; |
158 if (buildCounterBinding < 3) { | 157 if (buildCounterBinding < 3) { |
159 o.members = buildUnnamed3428(); | 158 o.members = buildUnnamed3433(); |
160 o.role = "foo"; | 159 o.role = "foo"; |
161 } | 160 } |
162 buildCounterBinding--; | 161 buildCounterBinding--; |
163 return o; | 162 return o; |
164 } | 163 } |
165 | 164 |
166 checkBinding(api.Binding o) { | 165 checkBinding(api.Binding o) { |
167 buildCounterBinding++; | 166 buildCounterBinding++; |
168 if (buildCounterBinding < 3) { | 167 if (buildCounterBinding < 3) { |
169 checkUnnamed3428(o.members); | 168 checkUnnamed3433(o.members); |
170 unittest.expect(o.role, unittest.equals('foo')); | 169 unittest.expect(o.role, unittest.equals('foo')); |
171 } | 170 } |
172 buildCounterBinding--; | 171 buildCounterBinding--; |
173 } | 172 } |
174 | 173 |
175 core.int buildCounterEmpty = 0; | 174 core.int buildCounterEmpty = 0; |
176 buildEmpty() { | 175 buildEmpty() { |
177 var o = new api.Empty(); | 176 var o = new api.Empty(); |
178 buildCounterEmpty++; | 177 buildCounterEmpty++; |
179 if (buildCounterEmpty < 3) { | 178 if (buildCounterEmpty < 3) {} |
180 } | |
181 buildCounterEmpty--; | 179 buildCounterEmpty--; |
182 return o; | 180 return o; |
183 } | 181 } |
184 | 182 |
185 checkEmpty(api.Empty o) { | 183 checkEmpty(api.Empty o) { |
186 buildCounterEmpty++; | 184 buildCounterEmpty++; |
187 if (buildCounterEmpty < 3) { | 185 if (buildCounterEmpty < 3) {} |
188 } | |
189 buildCounterEmpty--; | 186 buildCounterEmpty--; |
190 } | 187 } |
191 | 188 |
192 core.int buildCounterFolderOperation = 0; | 189 core.int buildCounterFolderOperation = 0; |
193 buildFolderOperation() { | 190 buildFolderOperation() { |
194 var o = new api.FolderOperation(); | 191 var o = new api.FolderOperation(); |
195 buildCounterFolderOperation++; | 192 buildCounterFolderOperation++; |
196 if (buildCounterFolderOperation < 3) { | 193 if (buildCounterFolderOperation < 3) { |
197 o.destinationParent = "foo"; | 194 o.destinationParent = "foo"; |
198 o.displayName = "foo"; | 195 o.displayName = "foo"; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 if (buildCounterFolderOperationError < 3) { | 227 if (buildCounterFolderOperationError < 3) { |
231 unittest.expect(o.errorMessageId, unittest.equals('foo')); | 228 unittest.expect(o.errorMessageId, unittest.equals('foo')); |
232 } | 229 } |
233 buildCounterFolderOperationError--; | 230 buildCounterFolderOperationError--; |
234 } | 231 } |
235 | 232 |
236 core.int buildCounterGetAncestryRequest = 0; | 233 core.int buildCounterGetAncestryRequest = 0; |
237 buildGetAncestryRequest() { | 234 buildGetAncestryRequest() { |
238 var o = new api.GetAncestryRequest(); | 235 var o = new api.GetAncestryRequest(); |
239 buildCounterGetAncestryRequest++; | 236 buildCounterGetAncestryRequest++; |
240 if (buildCounterGetAncestryRequest < 3) { | 237 if (buildCounterGetAncestryRequest < 3) {} |
241 } | |
242 buildCounterGetAncestryRequest--; | 238 buildCounterGetAncestryRequest--; |
243 return o; | 239 return o; |
244 } | 240 } |
245 | 241 |
246 checkGetAncestryRequest(api.GetAncestryRequest o) { | 242 checkGetAncestryRequest(api.GetAncestryRequest o) { |
247 buildCounterGetAncestryRequest++; | 243 buildCounterGetAncestryRequest++; |
248 if (buildCounterGetAncestryRequest < 3) { | 244 if (buildCounterGetAncestryRequest < 3) {} |
249 } | |
250 buildCounterGetAncestryRequest--; | 245 buildCounterGetAncestryRequest--; |
251 } | 246 } |
252 | 247 |
253 buildUnnamed3429() { | 248 buildUnnamed3434() { |
254 var o = new core.List<api.Ancestor>(); | 249 var o = new core.List<api.Ancestor>(); |
255 o.add(buildAncestor()); | 250 o.add(buildAncestor()); |
256 o.add(buildAncestor()); | 251 o.add(buildAncestor()); |
257 return o; | 252 return o; |
258 } | 253 } |
259 | 254 |
260 checkUnnamed3429(core.List<api.Ancestor> o) { | 255 checkUnnamed3434(core.List<api.Ancestor> o) { |
261 unittest.expect(o, unittest.hasLength(2)); | 256 unittest.expect(o, unittest.hasLength(2)); |
262 checkAncestor(o[0]); | 257 checkAncestor(o[0]); |
263 checkAncestor(o[1]); | 258 checkAncestor(o[1]); |
264 } | 259 } |
265 | 260 |
266 core.int buildCounterGetAncestryResponse = 0; | 261 core.int buildCounterGetAncestryResponse = 0; |
267 buildGetAncestryResponse() { | 262 buildGetAncestryResponse() { |
268 var o = new api.GetAncestryResponse(); | 263 var o = new api.GetAncestryResponse(); |
269 buildCounterGetAncestryResponse++; | 264 buildCounterGetAncestryResponse++; |
270 if (buildCounterGetAncestryResponse < 3) { | 265 if (buildCounterGetAncestryResponse < 3) { |
271 o.ancestor = buildUnnamed3429(); | 266 o.ancestor = buildUnnamed3434(); |
272 } | 267 } |
273 buildCounterGetAncestryResponse--; | 268 buildCounterGetAncestryResponse--; |
274 return o; | 269 return o; |
275 } | 270 } |
276 | 271 |
277 checkGetAncestryResponse(api.GetAncestryResponse o) { | 272 checkGetAncestryResponse(api.GetAncestryResponse o) { |
278 buildCounterGetAncestryResponse++; | 273 buildCounterGetAncestryResponse++; |
279 if (buildCounterGetAncestryResponse < 3) { | 274 if (buildCounterGetAncestryResponse < 3) { |
280 checkUnnamed3429(o.ancestor); | 275 checkUnnamed3434(o.ancestor); |
281 } | 276 } |
282 buildCounterGetAncestryResponse--; | 277 buildCounterGetAncestryResponse--; |
283 } | 278 } |
284 | 279 |
285 core.int buildCounterGetIamPolicyRequest = 0; | 280 core.int buildCounterGetIamPolicyRequest = 0; |
286 buildGetIamPolicyRequest() { | 281 buildGetIamPolicyRequest() { |
287 var o = new api.GetIamPolicyRequest(); | 282 var o = new api.GetIamPolicyRequest(); |
288 buildCounterGetIamPolicyRequest++; | 283 buildCounterGetIamPolicyRequest++; |
289 if (buildCounterGetIamPolicyRequest < 3) { | 284 if (buildCounterGetIamPolicyRequest < 3) {} |
290 } | |
291 buildCounterGetIamPolicyRequest--; | 285 buildCounterGetIamPolicyRequest--; |
292 return o; | 286 return o; |
293 } | 287 } |
294 | 288 |
295 checkGetIamPolicyRequest(api.GetIamPolicyRequest o) { | 289 checkGetIamPolicyRequest(api.GetIamPolicyRequest o) { |
296 buildCounterGetIamPolicyRequest++; | 290 buildCounterGetIamPolicyRequest++; |
297 if (buildCounterGetIamPolicyRequest < 3) { | 291 if (buildCounterGetIamPolicyRequest < 3) {} |
298 } | |
299 buildCounterGetIamPolicyRequest--; | 292 buildCounterGetIamPolicyRequest--; |
300 } | 293 } |
301 | 294 |
302 buildUnnamed3430() { | 295 buildUnnamed3435() { |
303 var o = new core.List<api.Organization>(); | 296 var o = new core.List<api.Organization>(); |
304 o.add(buildOrganization()); | 297 o.add(buildOrganization()); |
305 o.add(buildOrganization()); | 298 o.add(buildOrganization()); |
306 return o; | 299 return o; |
307 } | 300 } |
308 | 301 |
309 checkUnnamed3430(core.List<api.Organization> o) { | 302 checkUnnamed3435(core.List<api.Organization> o) { |
310 unittest.expect(o, unittest.hasLength(2)); | 303 unittest.expect(o, unittest.hasLength(2)); |
311 checkOrganization(o[0]); | 304 checkOrganization(o[0]); |
312 checkOrganization(o[1]); | 305 checkOrganization(o[1]); |
313 } | 306 } |
314 | 307 |
315 core.int buildCounterListOrganizationsResponse = 0; | 308 core.int buildCounterListOrganizationsResponse = 0; |
316 buildListOrganizationsResponse() { | 309 buildListOrganizationsResponse() { |
317 var o = new api.ListOrganizationsResponse(); | 310 var o = new api.ListOrganizationsResponse(); |
318 buildCounterListOrganizationsResponse++; | 311 buildCounterListOrganizationsResponse++; |
319 if (buildCounterListOrganizationsResponse < 3) { | 312 if (buildCounterListOrganizationsResponse < 3) { |
320 o.nextPageToken = "foo"; | 313 o.nextPageToken = "foo"; |
321 o.organizations = buildUnnamed3430(); | 314 o.organizations = buildUnnamed3435(); |
322 } | 315 } |
323 buildCounterListOrganizationsResponse--; | 316 buildCounterListOrganizationsResponse--; |
324 return o; | 317 return o; |
325 } | 318 } |
326 | 319 |
327 checkListOrganizationsResponse(api.ListOrganizationsResponse o) { | 320 checkListOrganizationsResponse(api.ListOrganizationsResponse o) { |
328 buildCounterListOrganizationsResponse++; | 321 buildCounterListOrganizationsResponse++; |
329 if (buildCounterListOrganizationsResponse < 3) { | 322 if (buildCounterListOrganizationsResponse < 3) { |
330 unittest.expect(o.nextPageToken, unittest.equals('foo')); | 323 unittest.expect(o.nextPageToken, unittest.equals('foo')); |
331 checkUnnamed3430(o.organizations); | 324 checkUnnamed3435(o.organizations); |
332 } | 325 } |
333 buildCounterListOrganizationsResponse--; | 326 buildCounterListOrganizationsResponse--; |
334 } | 327 } |
335 | 328 |
336 buildUnnamed3431() { | 329 buildUnnamed3436() { |
337 var o = new core.List<api.Project>(); | 330 var o = new core.List<api.Project>(); |
338 o.add(buildProject()); | 331 o.add(buildProject()); |
339 o.add(buildProject()); | 332 o.add(buildProject()); |
340 return o; | 333 return o; |
341 } | 334 } |
342 | 335 |
343 checkUnnamed3431(core.List<api.Project> o) { | 336 checkUnnamed3436(core.List<api.Project> o) { |
344 unittest.expect(o, unittest.hasLength(2)); | 337 unittest.expect(o, unittest.hasLength(2)); |
345 checkProject(o[0]); | 338 checkProject(o[0]); |
346 checkProject(o[1]); | 339 checkProject(o[1]); |
347 } | 340 } |
348 | 341 |
349 core.int buildCounterListProjectsResponse = 0; | 342 core.int buildCounterListProjectsResponse = 0; |
350 buildListProjectsResponse() { | 343 buildListProjectsResponse() { |
351 var o = new api.ListProjectsResponse(); | 344 var o = new api.ListProjectsResponse(); |
352 buildCounterListProjectsResponse++; | 345 buildCounterListProjectsResponse++; |
353 if (buildCounterListProjectsResponse < 3) { | 346 if (buildCounterListProjectsResponse < 3) { |
354 o.nextPageToken = "foo"; | 347 o.nextPageToken = "foo"; |
355 o.projects = buildUnnamed3431(); | 348 o.projects = buildUnnamed3436(); |
356 } | 349 } |
357 buildCounterListProjectsResponse--; | 350 buildCounterListProjectsResponse--; |
358 return o; | 351 return o; |
359 } | 352 } |
360 | 353 |
361 checkListProjectsResponse(api.ListProjectsResponse o) { | 354 checkListProjectsResponse(api.ListProjectsResponse o) { |
362 buildCounterListProjectsResponse++; | 355 buildCounterListProjectsResponse++; |
363 if (buildCounterListProjectsResponse < 3) { | 356 if (buildCounterListProjectsResponse < 3) { |
364 unittest.expect(o.nextPageToken, unittest.equals('foo')); | 357 unittest.expect(o.nextPageToken, unittest.equals('foo')); |
365 checkUnnamed3431(o.projects); | 358 checkUnnamed3436(o.projects); |
366 } | 359 } |
367 buildCounterListProjectsResponse--; | 360 buildCounterListProjectsResponse--; |
368 } | 361 } |
369 | 362 |
370 core.int buildCounterOrganization = 0; | 363 core.int buildCounterOrganization = 0; |
371 buildOrganization() { | 364 buildOrganization() { |
372 var o = new api.Organization(); | 365 var o = new api.Organization(); |
373 buildCounterOrganization++; | 366 buildCounterOrganization++; |
374 if (buildCounterOrganization < 3) { | 367 if (buildCounterOrganization < 3) { |
375 o.creationTime = "foo"; | 368 o.creationTime = "foo"; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 } | 401 } |
409 | 402 |
410 checkOrganizationOwner(api.OrganizationOwner o) { | 403 checkOrganizationOwner(api.OrganizationOwner o) { |
411 buildCounterOrganizationOwner++; | 404 buildCounterOrganizationOwner++; |
412 if (buildCounterOrganizationOwner < 3) { | 405 if (buildCounterOrganizationOwner < 3) { |
413 unittest.expect(o.directoryCustomerId, unittest.equals('foo')); | 406 unittest.expect(o.directoryCustomerId, unittest.equals('foo')); |
414 } | 407 } |
415 buildCounterOrganizationOwner--; | 408 buildCounterOrganizationOwner--; |
416 } | 409 } |
417 | 410 |
418 buildUnnamed3432() { | 411 buildUnnamed3437() { |
419 var o = new core.List<api.AuditConfig>(); | 412 var o = new core.List<api.AuditConfig>(); |
420 o.add(buildAuditConfig()); | 413 o.add(buildAuditConfig()); |
421 o.add(buildAuditConfig()); | 414 o.add(buildAuditConfig()); |
422 return o; | 415 return o; |
423 } | 416 } |
424 | 417 |
425 checkUnnamed3432(core.List<api.AuditConfig> o) { | 418 checkUnnamed3437(core.List<api.AuditConfig> o) { |
426 unittest.expect(o, unittest.hasLength(2)); | 419 unittest.expect(o, unittest.hasLength(2)); |
427 checkAuditConfig(o[0]); | 420 checkAuditConfig(o[0]); |
428 checkAuditConfig(o[1]); | 421 checkAuditConfig(o[1]); |
429 } | 422 } |
430 | 423 |
431 buildUnnamed3433() { | 424 buildUnnamed3438() { |
432 var o = new core.List<api.Binding>(); | 425 var o = new core.List<api.Binding>(); |
433 o.add(buildBinding()); | 426 o.add(buildBinding()); |
434 o.add(buildBinding()); | 427 o.add(buildBinding()); |
435 return o; | 428 return o; |
436 } | 429 } |
437 | 430 |
438 checkUnnamed3433(core.List<api.Binding> o) { | 431 checkUnnamed3438(core.List<api.Binding> o) { |
439 unittest.expect(o, unittest.hasLength(2)); | 432 unittest.expect(o, unittest.hasLength(2)); |
440 checkBinding(o[0]); | 433 checkBinding(o[0]); |
441 checkBinding(o[1]); | 434 checkBinding(o[1]); |
442 } | 435 } |
443 | 436 |
444 core.int buildCounterPolicy = 0; | 437 core.int buildCounterPolicy = 0; |
445 buildPolicy() { | 438 buildPolicy() { |
446 var o = new api.Policy(); | 439 var o = new api.Policy(); |
447 buildCounterPolicy++; | 440 buildCounterPolicy++; |
448 if (buildCounterPolicy < 3) { | 441 if (buildCounterPolicy < 3) { |
449 o.auditConfigs = buildUnnamed3432(); | 442 o.auditConfigs = buildUnnamed3437(); |
450 o.bindings = buildUnnamed3433(); | 443 o.bindings = buildUnnamed3438(); |
451 o.etag = "foo"; | 444 o.etag = "foo"; |
452 o.version = 42; | 445 o.version = 42; |
453 } | 446 } |
454 buildCounterPolicy--; | 447 buildCounterPolicy--; |
455 return o; | 448 return o; |
456 } | 449 } |
457 | 450 |
458 checkPolicy(api.Policy o) { | 451 checkPolicy(api.Policy o) { |
459 buildCounterPolicy++; | 452 buildCounterPolicy++; |
460 if (buildCounterPolicy < 3) { | 453 if (buildCounterPolicy < 3) { |
461 checkUnnamed3432(o.auditConfigs); | 454 checkUnnamed3437(o.auditConfigs); |
462 checkUnnamed3433(o.bindings); | 455 checkUnnamed3438(o.bindings); |
463 unittest.expect(o.etag, unittest.equals('foo')); | 456 unittest.expect(o.etag, unittest.equals('foo')); |
464 unittest.expect(o.version, unittest.equals(42)); | 457 unittest.expect(o.version, unittest.equals(42)); |
465 } | 458 } |
466 buildCounterPolicy--; | 459 buildCounterPolicy--; |
467 } | 460 } |
468 | 461 |
469 buildUnnamed3434() { | 462 buildUnnamed3439() { |
470 var o = new core.Map<core.String, core.String>(); | 463 var o = new core.Map<core.String, core.String>(); |
471 o["x"] = "foo"; | 464 o["x"] = "foo"; |
472 o["y"] = "foo"; | 465 o["y"] = "foo"; |
473 return o; | 466 return o; |
474 } | 467 } |
475 | 468 |
476 checkUnnamed3434(core.Map<core.String, core.String> o) { | 469 checkUnnamed3439(core.Map<core.String, core.String> o) { |
477 unittest.expect(o, unittest.hasLength(2)); | 470 unittest.expect(o, unittest.hasLength(2)); |
478 unittest.expect(o["x"], unittest.equals('foo')); | 471 unittest.expect(o["x"], unittest.equals('foo')); |
479 unittest.expect(o["y"], unittest.equals('foo')); | 472 unittest.expect(o["y"], unittest.equals('foo')); |
480 } | 473 } |
481 | 474 |
482 core.int buildCounterProject = 0; | 475 core.int buildCounterProject = 0; |
483 buildProject() { | 476 buildProject() { |
484 var o = new api.Project(); | 477 var o = new api.Project(); |
485 buildCounterProject++; | 478 buildCounterProject++; |
486 if (buildCounterProject < 3) { | 479 if (buildCounterProject < 3) { |
487 o.createTime = "foo"; | 480 o.createTime = "foo"; |
488 o.labels = buildUnnamed3434(); | 481 o.labels = buildUnnamed3439(); |
489 o.lifecycleState = "foo"; | 482 o.lifecycleState = "foo"; |
490 o.name = "foo"; | 483 o.name = "foo"; |
491 o.parent = buildResourceId(); | 484 o.parent = buildResourceId(); |
492 o.projectId = "foo"; | 485 o.projectId = "foo"; |
493 o.projectNumber = "foo"; | 486 o.projectNumber = "foo"; |
494 } | 487 } |
495 buildCounterProject--; | 488 buildCounterProject--; |
496 return o; | 489 return o; |
497 } | 490 } |
498 | 491 |
499 checkProject(api.Project o) { | 492 checkProject(api.Project o) { |
500 buildCounterProject++; | 493 buildCounterProject++; |
501 if (buildCounterProject < 3) { | 494 if (buildCounterProject < 3) { |
502 unittest.expect(o.createTime, unittest.equals('foo')); | 495 unittest.expect(o.createTime, unittest.equals('foo')); |
503 checkUnnamed3434(o.labels); | 496 checkUnnamed3439(o.labels); |
504 unittest.expect(o.lifecycleState, unittest.equals('foo')); | 497 unittest.expect(o.lifecycleState, unittest.equals('foo')); |
505 unittest.expect(o.name, unittest.equals('foo')); | 498 unittest.expect(o.name, unittest.equals('foo')); |
506 checkResourceId(o.parent); | 499 checkResourceId(o.parent); |
507 unittest.expect(o.projectId, unittest.equals('foo')); | 500 unittest.expect(o.projectId, unittest.equals('foo')); |
508 unittest.expect(o.projectNumber, unittest.equals('foo')); | 501 unittest.expect(o.projectNumber, unittest.equals('foo')); |
509 } | 502 } |
510 buildCounterProject--; | 503 buildCounterProject--; |
511 } | 504 } |
512 | 505 |
513 core.int buildCounterProjectCreationStatus = 0; | 506 core.int buildCounterProjectCreationStatus = 0; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
568 | 561 |
569 checkSetIamPolicyRequest(api.SetIamPolicyRequest o) { | 562 checkSetIamPolicyRequest(api.SetIamPolicyRequest o) { |
570 buildCounterSetIamPolicyRequest++; | 563 buildCounterSetIamPolicyRequest++; |
571 if (buildCounterSetIamPolicyRequest < 3) { | 564 if (buildCounterSetIamPolicyRequest < 3) { |
572 checkPolicy(o.policy); | 565 checkPolicy(o.policy); |
573 unittest.expect(o.updateMask, unittest.equals('foo')); | 566 unittest.expect(o.updateMask, unittest.equals('foo')); |
574 } | 567 } |
575 buildCounterSetIamPolicyRequest--; | 568 buildCounterSetIamPolicyRequest--; |
576 } | 569 } |
577 | 570 |
578 buildUnnamed3435() { | 571 buildUnnamed3440() { |
579 var o = new core.List<core.String>(); | 572 var o = new core.List<core.String>(); |
580 o.add("foo"); | 573 o.add("foo"); |
581 o.add("foo"); | 574 o.add("foo"); |
582 return o; | 575 return o; |
583 } | 576 } |
584 | 577 |
585 checkUnnamed3435(core.List<core.String> o) { | 578 checkUnnamed3440(core.List<core.String> o) { |
586 unittest.expect(o, unittest.hasLength(2)); | 579 unittest.expect(o, unittest.hasLength(2)); |
587 unittest.expect(o[0], unittest.equals('foo')); | 580 unittest.expect(o[0], unittest.equals('foo')); |
588 unittest.expect(o[1], unittest.equals('foo')); | 581 unittest.expect(o[1], unittest.equals('foo')); |
589 } | 582 } |
590 | 583 |
591 core.int buildCounterTestIamPermissionsRequest = 0; | 584 core.int buildCounterTestIamPermissionsRequest = 0; |
592 buildTestIamPermissionsRequest() { | 585 buildTestIamPermissionsRequest() { |
593 var o = new api.TestIamPermissionsRequest(); | 586 var o = new api.TestIamPermissionsRequest(); |
594 buildCounterTestIamPermissionsRequest++; | 587 buildCounterTestIamPermissionsRequest++; |
595 if (buildCounterTestIamPermissionsRequest < 3) { | 588 if (buildCounterTestIamPermissionsRequest < 3) { |
596 o.permissions = buildUnnamed3435(); | 589 o.permissions = buildUnnamed3440(); |
597 } | 590 } |
598 buildCounterTestIamPermissionsRequest--; | 591 buildCounterTestIamPermissionsRequest--; |
599 return o; | 592 return o; |
600 } | 593 } |
601 | 594 |
602 checkTestIamPermissionsRequest(api.TestIamPermissionsRequest o) { | 595 checkTestIamPermissionsRequest(api.TestIamPermissionsRequest o) { |
603 buildCounterTestIamPermissionsRequest++; | 596 buildCounterTestIamPermissionsRequest++; |
604 if (buildCounterTestIamPermissionsRequest < 3) { | 597 if (buildCounterTestIamPermissionsRequest < 3) { |
605 checkUnnamed3435(o.permissions); | 598 checkUnnamed3440(o.permissions); |
606 } | 599 } |
607 buildCounterTestIamPermissionsRequest--; | 600 buildCounterTestIamPermissionsRequest--; |
608 } | 601 } |
609 | 602 |
610 buildUnnamed3436() { | 603 buildUnnamed3441() { |
611 var o = new core.List<core.String>(); | 604 var o = new core.List<core.String>(); |
612 o.add("foo"); | 605 o.add("foo"); |
613 o.add("foo"); | 606 o.add("foo"); |
614 return o; | 607 return o; |
615 } | 608 } |
616 | 609 |
617 checkUnnamed3436(core.List<core.String> o) { | 610 checkUnnamed3441(core.List<core.String> o) { |
618 unittest.expect(o, unittest.hasLength(2)); | 611 unittest.expect(o, unittest.hasLength(2)); |
619 unittest.expect(o[0], unittest.equals('foo')); | 612 unittest.expect(o[0], unittest.equals('foo')); |
620 unittest.expect(o[1], unittest.equals('foo')); | 613 unittest.expect(o[1], unittest.equals('foo')); |
621 } | 614 } |
622 | 615 |
623 core.int buildCounterTestIamPermissionsResponse = 0; | 616 core.int buildCounterTestIamPermissionsResponse = 0; |
624 buildTestIamPermissionsResponse() { | 617 buildTestIamPermissionsResponse() { |
625 var o = new api.TestIamPermissionsResponse(); | 618 var o = new api.TestIamPermissionsResponse(); |
626 buildCounterTestIamPermissionsResponse++; | 619 buildCounterTestIamPermissionsResponse++; |
627 if (buildCounterTestIamPermissionsResponse < 3) { | 620 if (buildCounterTestIamPermissionsResponse < 3) { |
628 o.permissions = buildUnnamed3436(); | 621 o.permissions = buildUnnamed3441(); |
629 } | 622 } |
630 buildCounterTestIamPermissionsResponse--; | 623 buildCounterTestIamPermissionsResponse--; |
631 return o; | 624 return o; |
632 } | 625 } |
633 | 626 |
634 checkTestIamPermissionsResponse(api.TestIamPermissionsResponse o) { | 627 checkTestIamPermissionsResponse(api.TestIamPermissionsResponse o) { |
635 buildCounterTestIamPermissionsResponse++; | 628 buildCounterTestIamPermissionsResponse++; |
636 if (buildCounterTestIamPermissionsResponse < 3) { | 629 if (buildCounterTestIamPermissionsResponse < 3) { |
637 checkUnnamed3436(o.permissions); | 630 checkUnnamed3441(o.permissions); |
638 } | 631 } |
639 buildCounterTestIamPermissionsResponse--; | 632 buildCounterTestIamPermissionsResponse--; |
640 } | 633 } |
641 | 634 |
642 core.int buildCounterUndeleteProjectRequest = 0; | 635 core.int buildCounterUndeleteProjectRequest = 0; |
643 buildUndeleteProjectRequest() { | 636 buildUndeleteProjectRequest() { |
644 var o = new api.UndeleteProjectRequest(); | 637 var o = new api.UndeleteProjectRequest(); |
645 buildCounterUndeleteProjectRequest++; | 638 buildCounterUndeleteProjectRequest++; |
646 if (buildCounterUndeleteProjectRequest < 3) { | 639 if (buildCounterUndeleteProjectRequest < 3) {} |
647 } | |
648 buildCounterUndeleteProjectRequest--; | 640 buildCounterUndeleteProjectRequest--; |
649 return o; | 641 return o; |
650 } | 642 } |
651 | 643 |
652 checkUndeleteProjectRequest(api.UndeleteProjectRequest o) { | 644 checkUndeleteProjectRequest(api.UndeleteProjectRequest o) { |
653 buildCounterUndeleteProjectRequest++; | 645 buildCounterUndeleteProjectRequest++; |
654 if (buildCounterUndeleteProjectRequest < 3) { | 646 if (buildCounterUndeleteProjectRequest < 3) {} |
655 } | |
656 buildCounterUndeleteProjectRequest--; | 647 buildCounterUndeleteProjectRequest--; |
657 } | 648 } |
658 | 649 |
659 | |
660 main() { | 650 main() { |
661 unittest.group("obj-schema-Ancestor", () { | 651 unittest.group("obj-schema-Ancestor", () { |
662 unittest.test("to-json--from-json", () { | 652 unittest.test("to-json--from-json", () { |
663 var o = buildAncestor(); | 653 var o = buildAncestor(); |
664 var od = new api.Ancestor.fromJson(o.toJson()); | 654 var od = new api.Ancestor.fromJson(o.toJson()); |
665 checkAncestor(od); | 655 checkAncestor(od); |
666 }); | 656 }); |
667 }); | 657 }); |
668 | 658 |
669 | |
670 unittest.group("obj-schema-AuditConfig", () { | 659 unittest.group("obj-schema-AuditConfig", () { |
671 unittest.test("to-json--from-json", () { | 660 unittest.test("to-json--from-json", () { |
672 var o = buildAuditConfig(); | 661 var o = buildAuditConfig(); |
673 var od = new api.AuditConfig.fromJson(o.toJson()); | 662 var od = new api.AuditConfig.fromJson(o.toJson()); |
674 checkAuditConfig(od); | 663 checkAuditConfig(od); |
675 }); | 664 }); |
676 }); | 665 }); |
677 | 666 |
678 | |
679 unittest.group("obj-schema-AuditLogConfig", () { | 667 unittest.group("obj-schema-AuditLogConfig", () { |
680 unittest.test("to-json--from-json", () { | 668 unittest.test("to-json--from-json", () { |
681 var o = buildAuditLogConfig(); | 669 var o = buildAuditLogConfig(); |
682 var od = new api.AuditLogConfig.fromJson(o.toJson()); | 670 var od = new api.AuditLogConfig.fromJson(o.toJson()); |
683 checkAuditLogConfig(od); | 671 checkAuditLogConfig(od); |
684 }); | 672 }); |
685 }); | 673 }); |
686 | 674 |
687 | |
688 unittest.group("obj-schema-Binding", () { | 675 unittest.group("obj-schema-Binding", () { |
689 unittest.test("to-json--from-json", () { | 676 unittest.test("to-json--from-json", () { |
690 var o = buildBinding(); | 677 var o = buildBinding(); |
691 var od = new api.Binding.fromJson(o.toJson()); | 678 var od = new api.Binding.fromJson(o.toJson()); |
692 checkBinding(od); | 679 checkBinding(od); |
693 }); | 680 }); |
694 }); | 681 }); |
695 | 682 |
696 | |
697 unittest.group("obj-schema-Empty", () { | 683 unittest.group("obj-schema-Empty", () { |
698 unittest.test("to-json--from-json", () { | 684 unittest.test("to-json--from-json", () { |
699 var o = buildEmpty(); | 685 var o = buildEmpty(); |
700 var od = new api.Empty.fromJson(o.toJson()); | 686 var od = new api.Empty.fromJson(o.toJson()); |
701 checkEmpty(od); | 687 checkEmpty(od); |
702 }); | 688 }); |
703 }); | 689 }); |
704 | 690 |
705 | |
706 unittest.group("obj-schema-FolderOperation", () { | 691 unittest.group("obj-schema-FolderOperation", () { |
707 unittest.test("to-json--from-json", () { | 692 unittest.test("to-json--from-json", () { |
708 var o = buildFolderOperation(); | 693 var o = buildFolderOperation(); |
709 var od = new api.FolderOperation.fromJson(o.toJson()); | 694 var od = new api.FolderOperation.fromJson(o.toJson()); |
710 checkFolderOperation(od); | 695 checkFolderOperation(od); |
711 }); | 696 }); |
712 }); | 697 }); |
713 | 698 |
714 | |
715 unittest.group("obj-schema-FolderOperationError", () { | 699 unittest.group("obj-schema-FolderOperationError", () { |
716 unittest.test("to-json--from-json", () { | 700 unittest.test("to-json--from-json", () { |
717 var o = buildFolderOperationError(); | 701 var o = buildFolderOperationError(); |
718 var od = new api.FolderOperationError.fromJson(o.toJson()); | 702 var od = new api.FolderOperationError.fromJson(o.toJson()); |
719 checkFolderOperationError(od); | 703 checkFolderOperationError(od); |
720 }); | 704 }); |
721 }); | 705 }); |
722 | 706 |
723 | |
724 unittest.group("obj-schema-GetAncestryRequest", () { | 707 unittest.group("obj-schema-GetAncestryRequest", () { |
725 unittest.test("to-json--from-json", () { | 708 unittest.test("to-json--from-json", () { |
726 var o = buildGetAncestryRequest(); | 709 var o = buildGetAncestryRequest(); |
727 var od = new api.GetAncestryRequest.fromJson(o.toJson()); | 710 var od = new api.GetAncestryRequest.fromJson(o.toJson()); |
728 checkGetAncestryRequest(od); | 711 checkGetAncestryRequest(od); |
729 }); | 712 }); |
730 }); | 713 }); |
731 | 714 |
732 | |
733 unittest.group("obj-schema-GetAncestryResponse", () { | 715 unittest.group("obj-schema-GetAncestryResponse", () { |
734 unittest.test("to-json--from-json", () { | 716 unittest.test("to-json--from-json", () { |
735 var o = buildGetAncestryResponse(); | 717 var o = buildGetAncestryResponse(); |
736 var od = new api.GetAncestryResponse.fromJson(o.toJson()); | 718 var od = new api.GetAncestryResponse.fromJson(o.toJson()); |
737 checkGetAncestryResponse(od); | 719 checkGetAncestryResponse(od); |
738 }); | 720 }); |
739 }); | 721 }); |
740 | 722 |
741 | |
742 unittest.group("obj-schema-GetIamPolicyRequest", () { | 723 unittest.group("obj-schema-GetIamPolicyRequest", () { |
743 unittest.test("to-json--from-json", () { | 724 unittest.test("to-json--from-json", () { |
744 var o = buildGetIamPolicyRequest(); | 725 var o = buildGetIamPolicyRequest(); |
745 var od = new api.GetIamPolicyRequest.fromJson(o.toJson()); | 726 var od = new api.GetIamPolicyRequest.fromJson(o.toJson()); |
746 checkGetIamPolicyRequest(od); | 727 checkGetIamPolicyRequest(od); |
747 }); | 728 }); |
748 }); | 729 }); |
749 | 730 |
750 | |
751 unittest.group("obj-schema-ListOrganizationsResponse", () { | 731 unittest.group("obj-schema-ListOrganizationsResponse", () { |
752 unittest.test("to-json--from-json", () { | 732 unittest.test("to-json--from-json", () { |
753 var o = buildListOrganizationsResponse(); | 733 var o = buildListOrganizationsResponse(); |
754 var od = new api.ListOrganizationsResponse.fromJson(o.toJson()); | 734 var od = new api.ListOrganizationsResponse.fromJson(o.toJson()); |
755 checkListOrganizationsResponse(od); | 735 checkListOrganizationsResponse(od); |
756 }); | 736 }); |
757 }); | 737 }); |
758 | 738 |
759 | |
760 unittest.group("obj-schema-ListProjectsResponse", () { | 739 unittest.group("obj-schema-ListProjectsResponse", () { |
761 unittest.test("to-json--from-json", () { | 740 unittest.test("to-json--from-json", () { |
762 var o = buildListProjectsResponse(); | 741 var o = buildListProjectsResponse(); |
763 var od = new api.ListProjectsResponse.fromJson(o.toJson()); | 742 var od = new api.ListProjectsResponse.fromJson(o.toJson()); |
764 checkListProjectsResponse(od); | 743 checkListProjectsResponse(od); |
765 }); | 744 }); |
766 }); | 745 }); |
767 | 746 |
768 | |
769 unittest.group("obj-schema-Organization", () { | 747 unittest.group("obj-schema-Organization", () { |
770 unittest.test("to-json--from-json", () { | 748 unittest.test("to-json--from-json", () { |
771 var o = buildOrganization(); | 749 var o = buildOrganization(); |
772 var od = new api.Organization.fromJson(o.toJson()); | 750 var od = new api.Organization.fromJson(o.toJson()); |
773 checkOrganization(od); | 751 checkOrganization(od); |
774 }); | 752 }); |
775 }); | 753 }); |
776 | 754 |
777 | |
778 unittest.group("obj-schema-OrganizationOwner", () { | 755 unittest.group("obj-schema-OrganizationOwner", () { |
779 unittest.test("to-json--from-json", () { | 756 unittest.test("to-json--from-json", () { |
780 var o = buildOrganizationOwner(); | 757 var o = buildOrganizationOwner(); |
781 var od = new api.OrganizationOwner.fromJson(o.toJson()); | 758 var od = new api.OrganizationOwner.fromJson(o.toJson()); |
782 checkOrganizationOwner(od); | 759 checkOrganizationOwner(od); |
783 }); | 760 }); |
784 }); | 761 }); |
785 | 762 |
786 | |
787 unittest.group("obj-schema-Policy", () { | 763 unittest.group("obj-schema-Policy", () { |
788 unittest.test("to-json--from-json", () { | 764 unittest.test("to-json--from-json", () { |
789 var o = buildPolicy(); | 765 var o = buildPolicy(); |
790 var od = new api.Policy.fromJson(o.toJson()); | 766 var od = new api.Policy.fromJson(o.toJson()); |
791 checkPolicy(od); | 767 checkPolicy(od); |
792 }); | 768 }); |
793 }); | 769 }); |
794 | 770 |
795 | |
796 unittest.group("obj-schema-Project", () { | 771 unittest.group("obj-schema-Project", () { |
797 unittest.test("to-json--from-json", () { | 772 unittest.test("to-json--from-json", () { |
798 var o = buildProject(); | 773 var o = buildProject(); |
799 var od = new api.Project.fromJson(o.toJson()); | 774 var od = new api.Project.fromJson(o.toJson()); |
800 checkProject(od); | 775 checkProject(od); |
801 }); | 776 }); |
802 }); | 777 }); |
803 | 778 |
804 | |
805 unittest.group("obj-schema-ProjectCreationStatus", () { | 779 unittest.group("obj-schema-ProjectCreationStatus", () { |
806 unittest.test("to-json--from-json", () { | 780 unittest.test("to-json--from-json", () { |
807 var o = buildProjectCreationStatus(); | 781 var o = buildProjectCreationStatus(); |
808 var od = new api.ProjectCreationStatus.fromJson(o.toJson()); | 782 var od = new api.ProjectCreationStatus.fromJson(o.toJson()); |
809 checkProjectCreationStatus(od); | 783 checkProjectCreationStatus(od); |
810 }); | 784 }); |
811 }); | 785 }); |
812 | 786 |
813 | |
814 unittest.group("obj-schema-ResourceId", () { | 787 unittest.group("obj-schema-ResourceId", () { |
815 unittest.test("to-json--from-json", () { | 788 unittest.test("to-json--from-json", () { |
816 var o = buildResourceId(); | 789 var o = buildResourceId(); |
817 var od = new api.ResourceId.fromJson(o.toJson()); | 790 var od = new api.ResourceId.fromJson(o.toJson()); |
818 checkResourceId(od); | 791 checkResourceId(od); |
819 }); | 792 }); |
820 }); | 793 }); |
821 | 794 |
822 | |
823 unittest.group("obj-schema-SetIamPolicyRequest", () { | 795 unittest.group("obj-schema-SetIamPolicyRequest", () { |
824 unittest.test("to-json--from-json", () { | 796 unittest.test("to-json--from-json", () { |
825 var o = buildSetIamPolicyRequest(); | 797 var o = buildSetIamPolicyRequest(); |
826 var od = new api.SetIamPolicyRequest.fromJson(o.toJson()); | 798 var od = new api.SetIamPolicyRequest.fromJson(o.toJson()); |
827 checkSetIamPolicyRequest(od); | 799 checkSetIamPolicyRequest(od); |
828 }); | 800 }); |
829 }); | 801 }); |
830 | 802 |
831 | |
832 unittest.group("obj-schema-TestIamPermissionsRequest", () { | 803 unittest.group("obj-schema-TestIamPermissionsRequest", () { |
833 unittest.test("to-json--from-json", () { | 804 unittest.test("to-json--from-json", () { |
834 var o = buildTestIamPermissionsRequest(); | 805 var o = buildTestIamPermissionsRequest(); |
835 var od = new api.TestIamPermissionsRequest.fromJson(o.toJson()); | 806 var od = new api.TestIamPermissionsRequest.fromJson(o.toJson()); |
836 checkTestIamPermissionsRequest(od); | 807 checkTestIamPermissionsRequest(od); |
837 }); | 808 }); |
838 }); | 809 }); |
839 | 810 |
840 | |
841 unittest.group("obj-schema-TestIamPermissionsResponse", () { | 811 unittest.group("obj-schema-TestIamPermissionsResponse", () { |
842 unittest.test("to-json--from-json", () { | 812 unittest.test("to-json--from-json", () { |
843 var o = buildTestIamPermissionsResponse(); | 813 var o = buildTestIamPermissionsResponse(); |
844 var od = new api.TestIamPermissionsResponse.fromJson(o.toJson()); | 814 var od = new api.TestIamPermissionsResponse.fromJson(o.toJson()); |
845 checkTestIamPermissionsResponse(od); | 815 checkTestIamPermissionsResponse(od); |
846 }); | 816 }); |
847 }); | 817 }); |
848 | 818 |
849 | |
850 unittest.group("obj-schema-UndeleteProjectRequest", () { | 819 unittest.group("obj-schema-UndeleteProjectRequest", () { |
851 unittest.test("to-json--from-json", () { | 820 unittest.test("to-json--from-json", () { |
852 var o = buildUndeleteProjectRequest(); | 821 var o = buildUndeleteProjectRequest(); |
853 var od = new api.UndeleteProjectRequest.fromJson(o.toJson()); | 822 var od = new api.UndeleteProjectRequest.fromJson(o.toJson()); |
854 checkUndeleteProjectRequest(od); | 823 checkUndeleteProjectRequest(od); |
855 }); | 824 }); |
856 }); | 825 }); |
857 | 826 |
858 | |
859 unittest.group("resource-OrganizationsResourceApi", () { | 827 unittest.group("resource-OrganizationsResourceApi", () { |
860 unittest.test("method--get", () { | 828 unittest.test("method--get", () { |
861 | |
862 var mock = new HttpServerMock(); | 829 var mock = new HttpServerMock(); |
863 api.OrganizationsResourceApi res = new api.CloudresourcemanagerApi(mock).o
rganizations; | 830 api.OrganizationsResourceApi res = |
| 831 new api.CloudresourcemanagerApi(mock).organizations; |
864 var arg_name = "foo"; | 832 var arg_name = "foo"; |
865 var arg_organizationId = "foo"; | 833 var arg_organizationId = "foo"; |
866 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 834 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
867 var path = (req.url).path; | 835 var path = (req.url).path; |
868 var pathOffset = 0; | 836 var pathOffset = 0; |
869 var index; | 837 var index; |
870 var subPart; | 838 var subPart; |
871 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 839 unittest.expect( |
| 840 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
872 pathOffset += 1; | 841 pathOffset += 1; |
873 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("v1beta1/")); | 842 unittest.expect(path.substring(pathOffset, pathOffset + 8), |
| 843 unittest.equals("v1beta1/")); |
874 pathOffset += 8; | 844 pathOffset += 8; |
875 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 845 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
876 | 846 |
877 var query = (req.url).query; | 847 var query = (req.url).query; |
878 var queryOffset = 0; | 848 var queryOffset = 0; |
879 var queryMap = {}; | 849 var queryMap = {}; |
880 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 850 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
881 parseBool(n) { | 851 parseBool(n) { |
882 if (n == "true") return true; | 852 if (n == "true") return true; |
883 if (n == "false") return false; | 853 if (n == "false") return false; |
884 if (n == null) return null; | 854 if (n == null) return null; |
885 throw new core.ArgumentError("Invalid boolean: $n"); | 855 throw new core.ArgumentError("Invalid boolean: $n"); |
886 } | 856 } |
| 857 |
887 if (query.length > 0) { | 858 if (query.length > 0) { |
888 for (var part in query.split("&")) { | 859 for (var part in query.split("&")) { |
889 var keyvalue = part.split("="); | 860 var keyvalue = part.split("="); |
890 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 861 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 862 core.Uri.decodeQueryComponent(keyvalue[1])); |
891 } | 863 } |
892 } | 864 } |
893 unittest.expect(queryMap["organizationId"].first, unittest.equals(arg_or
ganizationId)); | 865 unittest.expect(queryMap["organizationId"].first, |
894 | 866 unittest.equals(arg_organizationId)); |
895 | 867 |
896 var h = { | 868 var h = { |
897 "content-type" : "application/json; charset=utf-8", | 869 "content-type": "application/json; charset=utf-8", |
898 }; | 870 }; |
899 var resp = convert.JSON.encode(buildOrganization()); | 871 var resp = convert.JSON.encode(buildOrganization()); |
900 return new async.Future.value(stringResponse(200, h, resp)); | 872 return new async.Future.value(stringResponse(200, h, resp)); |
901 }), true); | 873 }), true); |
902 res.get(arg_name, organizationId: arg_organizationId).then(unittest.expect
Async1(((api.Organization response) { | 874 res |
| 875 .get(arg_name, organizationId: arg_organizationId) |
| 876 .then(unittest.expectAsync1(((api.Organization response) { |
903 checkOrganization(response); | 877 checkOrganization(response); |
904 }))); | 878 }))); |
905 }); | 879 }); |
906 | 880 |
907 unittest.test("method--getIamPolicy", () { | 881 unittest.test("method--getIamPolicy", () { |
908 | |
909 var mock = new HttpServerMock(); | 882 var mock = new HttpServerMock(); |
910 api.OrganizationsResourceApi res = new api.CloudresourcemanagerApi(mock).o
rganizations; | 883 api.OrganizationsResourceApi res = |
| 884 new api.CloudresourcemanagerApi(mock).organizations; |
911 var arg_request = buildGetIamPolicyRequest(); | 885 var arg_request = buildGetIamPolicyRequest(); |
912 var arg_resource = "foo"; | 886 var arg_resource = "foo"; |
913 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 887 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
914 var obj = new api.GetIamPolicyRequest.fromJson(json); | 888 var obj = new api.GetIamPolicyRequest.fromJson(json); |
915 checkGetIamPolicyRequest(obj); | 889 checkGetIamPolicyRequest(obj); |
916 | 890 |
917 var path = (req.url).path; | 891 var path = (req.url).path; |
918 var pathOffset = 0; | 892 var pathOffset = 0; |
919 var index; | 893 var index; |
920 var subPart; | 894 var subPart; |
921 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 895 unittest.expect( |
| 896 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
922 pathOffset += 1; | 897 pathOffset += 1; |
923 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("v1beta1/")); | 898 unittest.expect(path.substring(pathOffset, pathOffset + 8), |
| 899 unittest.equals("v1beta1/")); |
924 pathOffset += 8; | 900 pathOffset += 8; |
925 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 901 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
926 | 902 |
927 var query = (req.url).query; | 903 var query = (req.url).query; |
928 var queryOffset = 0; | 904 var queryOffset = 0; |
929 var queryMap = {}; | 905 var queryMap = {}; |
930 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 906 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
931 parseBool(n) { | 907 parseBool(n) { |
932 if (n == "true") return true; | 908 if (n == "true") return true; |
933 if (n == "false") return false; | 909 if (n == "false") return false; |
934 if (n == null) return null; | 910 if (n == null) return null; |
935 throw new core.ArgumentError("Invalid boolean: $n"); | 911 throw new core.ArgumentError("Invalid boolean: $n"); |
936 } | 912 } |
| 913 |
937 if (query.length > 0) { | 914 if (query.length > 0) { |
938 for (var part in query.split("&")) { | 915 for (var part in query.split("&")) { |
939 var keyvalue = part.split("="); | 916 var keyvalue = part.split("="); |
940 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 917 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 918 core.Uri.decodeQueryComponent(keyvalue[1])); |
941 } | 919 } |
942 } | 920 } |
943 | 921 |
944 | |
945 var h = { | 922 var h = { |
946 "content-type" : "application/json; charset=utf-8", | 923 "content-type": "application/json; charset=utf-8", |
947 }; | 924 }; |
948 var resp = convert.JSON.encode(buildPolicy()); | 925 var resp = convert.JSON.encode(buildPolicy()); |
949 return new async.Future.value(stringResponse(200, h, resp)); | 926 return new async.Future.value(stringResponse(200, h, resp)); |
950 }), true); | 927 }), true); |
951 res.getIamPolicy(arg_request, arg_resource).then(unittest.expectAsync1(((a
pi.Policy response) { | 928 res |
| 929 .getIamPolicy(arg_request, arg_resource) |
| 930 .then(unittest.expectAsync1(((api.Policy response) { |
952 checkPolicy(response); | 931 checkPolicy(response); |
953 }))); | 932 }))); |
954 }); | 933 }); |
955 | 934 |
956 unittest.test("method--list", () { | 935 unittest.test("method--list", () { |
957 | |
958 var mock = new HttpServerMock(); | 936 var mock = new HttpServerMock(); |
959 api.OrganizationsResourceApi res = new api.CloudresourcemanagerApi(mock).o
rganizations; | 937 api.OrganizationsResourceApi res = |
960 var arg_filter = "foo"; | 938 new api.CloudresourcemanagerApi(mock).organizations; |
961 var arg_pageToken = "foo"; | 939 var arg_pageToken = "foo"; |
962 var arg_pageSize = 42; | 940 var arg_pageSize = 42; |
| 941 var arg_filter = "foo"; |
963 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 942 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
964 var path = (req.url).path; | 943 var path = (req.url).path; |
965 var pathOffset = 0; | 944 var pathOffset = 0; |
966 var index; | 945 var index; |
967 var subPart; | 946 var subPart; |
968 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 947 unittest.expect( |
| 948 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
969 pathOffset += 1; | 949 pathOffset += 1; |
970 unittest.expect(path.substring(pathOffset, pathOffset + 21), unittest.eq
uals("v1beta1/organizations")); | 950 unittest.expect(path.substring(pathOffset, pathOffset + 21), |
| 951 unittest.equals("v1beta1/organizations")); |
971 pathOffset += 21; | 952 pathOffset += 21; |
972 | 953 |
973 var query = (req.url).query; | 954 var query = (req.url).query; |
974 var queryOffset = 0; | 955 var queryOffset = 0; |
975 var queryMap = {}; | 956 var queryMap = {}; |
976 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 957 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
977 parseBool(n) { | 958 parseBool(n) { |
978 if (n == "true") return true; | 959 if (n == "true") return true; |
979 if (n == "false") return false; | 960 if (n == "false") return false; |
980 if (n == null) return null; | 961 if (n == null) return null; |
981 throw new core.ArgumentError("Invalid boolean: $n"); | 962 throw new core.ArgumentError("Invalid boolean: $n"); |
982 } | 963 } |
| 964 |
983 if (query.length > 0) { | 965 if (query.length > 0) { |
984 for (var part in query.split("&")) { | 966 for (var part in query.split("&")) { |
985 var keyvalue = part.split("="); | 967 var keyvalue = part.split("="); |
986 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 968 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 969 core.Uri.decodeQueryComponent(keyvalue[1])); |
987 } | 970 } |
988 } | 971 } |
| 972 unittest.expect( |
| 973 queryMap["pageToken"].first, unittest.equals(arg_pageToken)); |
| 974 unittest.expect(core.int.parse(queryMap["pageSize"].first), |
| 975 unittest.equals(arg_pageSize)); |
989 unittest.expect(queryMap["filter"].first, unittest.equals(arg_filter)); | 976 unittest.expect(queryMap["filter"].first, unittest.equals(arg_filter)); |
990 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); | |
991 unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equ
als(arg_pageSize)); | |
992 | |
993 | 977 |
994 var h = { | 978 var h = { |
995 "content-type" : "application/json; charset=utf-8", | 979 "content-type": "application/json; charset=utf-8", |
996 }; | 980 }; |
997 var resp = convert.JSON.encode(buildListOrganizationsResponse()); | 981 var resp = convert.JSON.encode(buildListOrganizationsResponse()); |
998 return new async.Future.value(stringResponse(200, h, resp)); | 982 return new async.Future.value(stringResponse(200, h, resp)); |
999 }), true); | 983 }), true); |
1000 res.list(filter: arg_filter, pageToken: arg_pageToken, pageSize: arg_pageS
ize).then(unittest.expectAsync1(((api.ListOrganizationsResponse response) { | 984 res |
| 985 .list( |
| 986 pageToken: arg_pageToken, |
| 987 pageSize: arg_pageSize, |
| 988 filter: arg_filter) |
| 989 .then( |
| 990 unittest.expectAsync1(((api.ListOrganizationsResponse response) { |
1001 checkListOrganizationsResponse(response); | 991 checkListOrganizationsResponse(response); |
1002 }))); | 992 }))); |
1003 }); | 993 }); |
1004 | 994 |
1005 unittest.test("method--setIamPolicy", () { | 995 unittest.test("method--setIamPolicy", () { |
1006 | |
1007 var mock = new HttpServerMock(); | 996 var mock = new HttpServerMock(); |
1008 api.OrganizationsResourceApi res = new api.CloudresourcemanagerApi(mock).o
rganizations; | 997 api.OrganizationsResourceApi res = |
| 998 new api.CloudresourcemanagerApi(mock).organizations; |
1009 var arg_request = buildSetIamPolicyRequest(); | 999 var arg_request = buildSetIamPolicyRequest(); |
1010 var arg_resource = "foo"; | 1000 var arg_resource = "foo"; |
1011 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1001 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
1012 var obj = new api.SetIamPolicyRequest.fromJson(json); | 1002 var obj = new api.SetIamPolicyRequest.fromJson(json); |
1013 checkSetIamPolicyRequest(obj); | 1003 checkSetIamPolicyRequest(obj); |
1014 | 1004 |
1015 var path = (req.url).path; | 1005 var path = (req.url).path; |
1016 var pathOffset = 0; | 1006 var pathOffset = 0; |
1017 var index; | 1007 var index; |
1018 var subPart; | 1008 var subPart; |
1019 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1009 unittest.expect( |
| 1010 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
1020 pathOffset += 1; | 1011 pathOffset += 1; |
1021 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("v1beta1/")); | 1012 unittest.expect(path.substring(pathOffset, pathOffset + 8), |
| 1013 unittest.equals("v1beta1/")); |
1022 pathOffset += 8; | 1014 pathOffset += 8; |
1023 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 1015 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
1024 | 1016 |
1025 var query = (req.url).query; | 1017 var query = (req.url).query; |
1026 var queryOffset = 0; | 1018 var queryOffset = 0; |
1027 var queryMap = {}; | 1019 var queryMap = {}; |
1028 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1020 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
1029 parseBool(n) { | 1021 parseBool(n) { |
1030 if (n == "true") return true; | 1022 if (n == "true") return true; |
1031 if (n == "false") return false; | 1023 if (n == "false") return false; |
1032 if (n == null) return null; | 1024 if (n == null) return null; |
1033 throw new core.ArgumentError("Invalid boolean: $n"); | 1025 throw new core.ArgumentError("Invalid boolean: $n"); |
1034 } | 1026 } |
| 1027 |
1035 if (query.length > 0) { | 1028 if (query.length > 0) { |
1036 for (var part in query.split("&")) { | 1029 for (var part in query.split("&")) { |
1037 var keyvalue = part.split("="); | 1030 var keyvalue = part.split("="); |
1038 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1031 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1032 core.Uri.decodeQueryComponent(keyvalue[1])); |
1039 } | 1033 } |
1040 } | 1034 } |
1041 | 1035 |
1042 | |
1043 var h = { | 1036 var h = { |
1044 "content-type" : "application/json; charset=utf-8", | 1037 "content-type": "application/json; charset=utf-8", |
1045 }; | 1038 }; |
1046 var resp = convert.JSON.encode(buildPolicy()); | 1039 var resp = convert.JSON.encode(buildPolicy()); |
1047 return new async.Future.value(stringResponse(200, h, resp)); | 1040 return new async.Future.value(stringResponse(200, h, resp)); |
1048 }), true); | 1041 }), true); |
1049 res.setIamPolicy(arg_request, arg_resource).then(unittest.expectAsync1(((a
pi.Policy response) { | 1042 res |
| 1043 .setIamPolicy(arg_request, arg_resource) |
| 1044 .then(unittest.expectAsync1(((api.Policy response) { |
1050 checkPolicy(response); | 1045 checkPolicy(response); |
1051 }))); | 1046 }))); |
1052 }); | 1047 }); |
1053 | 1048 |
1054 unittest.test("method--testIamPermissions", () { | 1049 unittest.test("method--testIamPermissions", () { |
1055 | |
1056 var mock = new HttpServerMock(); | 1050 var mock = new HttpServerMock(); |
1057 api.OrganizationsResourceApi res = new api.CloudresourcemanagerApi(mock).o
rganizations; | 1051 api.OrganizationsResourceApi res = |
| 1052 new api.CloudresourcemanagerApi(mock).organizations; |
1058 var arg_request = buildTestIamPermissionsRequest(); | 1053 var arg_request = buildTestIamPermissionsRequest(); |
1059 var arg_resource = "foo"; | 1054 var arg_resource = "foo"; |
1060 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1055 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
1061 var obj = new api.TestIamPermissionsRequest.fromJson(json); | 1056 var obj = new api.TestIamPermissionsRequest.fromJson(json); |
1062 checkTestIamPermissionsRequest(obj); | 1057 checkTestIamPermissionsRequest(obj); |
1063 | 1058 |
1064 var path = (req.url).path; | 1059 var path = (req.url).path; |
1065 var pathOffset = 0; | 1060 var pathOffset = 0; |
1066 var index; | 1061 var index; |
1067 var subPart; | 1062 var subPart; |
1068 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1063 unittest.expect( |
| 1064 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
1069 pathOffset += 1; | 1065 pathOffset += 1; |
1070 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("v1beta1/")); | 1066 unittest.expect(path.substring(pathOffset, pathOffset + 8), |
| 1067 unittest.equals("v1beta1/")); |
1071 pathOffset += 8; | 1068 pathOffset += 8; |
1072 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 1069 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
1073 | 1070 |
1074 var query = (req.url).query; | 1071 var query = (req.url).query; |
1075 var queryOffset = 0; | 1072 var queryOffset = 0; |
1076 var queryMap = {}; | 1073 var queryMap = {}; |
1077 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1074 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
1078 parseBool(n) { | 1075 parseBool(n) { |
1079 if (n == "true") return true; | 1076 if (n == "true") return true; |
1080 if (n == "false") return false; | 1077 if (n == "false") return false; |
1081 if (n == null) return null; | 1078 if (n == null) return null; |
1082 throw new core.ArgumentError("Invalid boolean: $n"); | 1079 throw new core.ArgumentError("Invalid boolean: $n"); |
1083 } | 1080 } |
| 1081 |
1084 if (query.length > 0) { | 1082 if (query.length > 0) { |
1085 for (var part in query.split("&")) { | 1083 for (var part in query.split("&")) { |
1086 var keyvalue = part.split("="); | 1084 var keyvalue = part.split("="); |
1087 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1085 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1086 core.Uri.decodeQueryComponent(keyvalue[1])); |
1088 } | 1087 } |
1089 } | 1088 } |
1090 | 1089 |
1091 | |
1092 var h = { | 1090 var h = { |
1093 "content-type" : "application/json; charset=utf-8", | 1091 "content-type": "application/json; charset=utf-8", |
1094 }; | 1092 }; |
1095 var resp = convert.JSON.encode(buildTestIamPermissionsResponse()); | 1093 var resp = convert.JSON.encode(buildTestIamPermissionsResponse()); |
1096 return new async.Future.value(stringResponse(200, h, resp)); | 1094 return new async.Future.value(stringResponse(200, h, resp)); |
1097 }), true); | 1095 }), true); |
1098 res.testIamPermissions(arg_request, arg_resource).then(unittest.expectAsyn
c1(((api.TestIamPermissionsResponse response) { | 1096 res.testIamPermissions(arg_request, arg_resource).then( |
| 1097 unittest.expectAsync1(((api.TestIamPermissionsResponse response) { |
1099 checkTestIamPermissionsResponse(response); | 1098 checkTestIamPermissionsResponse(response); |
1100 }))); | 1099 }))); |
1101 }); | 1100 }); |
1102 | 1101 |
1103 unittest.test("method--update", () { | 1102 unittest.test("method--update", () { |
1104 | |
1105 var mock = new HttpServerMock(); | 1103 var mock = new HttpServerMock(); |
1106 api.OrganizationsResourceApi res = new api.CloudresourcemanagerApi(mock).o
rganizations; | 1104 api.OrganizationsResourceApi res = |
| 1105 new api.CloudresourcemanagerApi(mock).organizations; |
1107 var arg_request = buildOrganization(); | 1106 var arg_request = buildOrganization(); |
1108 var arg_name = "foo"; | 1107 var arg_name = "foo"; |
1109 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1108 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
1110 var obj = new api.Organization.fromJson(json); | 1109 var obj = new api.Organization.fromJson(json); |
1111 checkOrganization(obj); | 1110 checkOrganization(obj); |
1112 | 1111 |
1113 var path = (req.url).path; | 1112 var path = (req.url).path; |
1114 var pathOffset = 0; | 1113 var pathOffset = 0; |
1115 var index; | 1114 var index; |
1116 var subPart; | 1115 var subPart; |
1117 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1116 unittest.expect( |
| 1117 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
1118 pathOffset += 1; | 1118 pathOffset += 1; |
1119 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("v1beta1/")); | 1119 unittest.expect(path.substring(pathOffset, pathOffset + 8), |
| 1120 unittest.equals("v1beta1/")); |
1120 pathOffset += 8; | 1121 pathOffset += 8; |
1121 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 1122 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
1122 | 1123 |
1123 var query = (req.url).query; | 1124 var query = (req.url).query; |
1124 var queryOffset = 0; | 1125 var queryOffset = 0; |
1125 var queryMap = {}; | 1126 var queryMap = {}; |
1126 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1127 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
1127 parseBool(n) { | 1128 parseBool(n) { |
1128 if (n == "true") return true; | 1129 if (n == "true") return true; |
1129 if (n == "false") return false; | 1130 if (n == "false") return false; |
1130 if (n == null) return null; | 1131 if (n == null) return null; |
1131 throw new core.ArgumentError("Invalid boolean: $n"); | 1132 throw new core.ArgumentError("Invalid boolean: $n"); |
1132 } | 1133 } |
| 1134 |
1133 if (query.length > 0) { | 1135 if (query.length > 0) { |
1134 for (var part in query.split("&")) { | 1136 for (var part in query.split("&")) { |
1135 var keyvalue = part.split("="); | 1137 var keyvalue = part.split("="); |
1136 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1138 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1139 core.Uri.decodeQueryComponent(keyvalue[1])); |
1137 } | 1140 } |
1138 } | 1141 } |
1139 | 1142 |
1140 | |
1141 var h = { | 1143 var h = { |
1142 "content-type" : "application/json; charset=utf-8", | 1144 "content-type": "application/json; charset=utf-8", |
1143 }; | 1145 }; |
1144 var resp = convert.JSON.encode(buildOrganization()); | 1146 var resp = convert.JSON.encode(buildOrganization()); |
1145 return new async.Future.value(stringResponse(200, h, resp)); | 1147 return new async.Future.value(stringResponse(200, h, resp)); |
1146 }), true); | 1148 }), true); |
1147 res.update(arg_request, arg_name).then(unittest.expectAsync1(((api.Organiz
ation response) { | 1149 res |
| 1150 .update(arg_request, arg_name) |
| 1151 .then(unittest.expectAsync1(((api.Organization response) { |
1148 checkOrganization(response); | 1152 checkOrganization(response); |
1149 }))); | 1153 }))); |
1150 }); | 1154 }); |
1151 | |
1152 }); | 1155 }); |
1153 | 1156 |
1154 | |
1155 unittest.group("resource-ProjectsResourceApi", () { | 1157 unittest.group("resource-ProjectsResourceApi", () { |
1156 unittest.test("method--create", () { | 1158 unittest.test("method--create", () { |
1157 | |
1158 var mock = new HttpServerMock(); | 1159 var mock = new HttpServerMock(); |
1159 api.ProjectsResourceApi res = new api.CloudresourcemanagerApi(mock).projec
ts; | 1160 api.ProjectsResourceApi res = |
| 1161 new api.CloudresourcemanagerApi(mock).projects; |
1160 var arg_request = buildProject(); | 1162 var arg_request = buildProject(); |
1161 var arg_useLegacyStack = true; | 1163 var arg_useLegacyStack = true; |
1162 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1164 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
1163 var obj = new api.Project.fromJson(json); | 1165 var obj = new api.Project.fromJson(json); |
1164 checkProject(obj); | 1166 checkProject(obj); |
1165 | 1167 |
1166 var path = (req.url).path; | 1168 var path = (req.url).path; |
1167 var pathOffset = 0; | 1169 var pathOffset = 0; |
1168 var index; | 1170 var index; |
1169 var subPart; | 1171 var subPart; |
1170 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1172 unittest.expect( |
| 1173 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
1171 pathOffset += 1; | 1174 pathOffset += 1; |
1172 unittest.expect(path.substring(pathOffset, pathOffset + 16), unittest.eq
uals("v1beta1/projects")); | 1175 unittest.expect(path.substring(pathOffset, pathOffset + 16), |
| 1176 unittest.equals("v1beta1/projects")); |
1173 pathOffset += 16; | 1177 pathOffset += 16; |
1174 | 1178 |
1175 var query = (req.url).query; | 1179 var query = (req.url).query; |
1176 var queryOffset = 0; | 1180 var queryOffset = 0; |
1177 var queryMap = {}; | 1181 var queryMap = {}; |
1178 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1182 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
1179 parseBool(n) { | 1183 parseBool(n) { |
1180 if (n == "true") return true; | 1184 if (n == "true") return true; |
1181 if (n == "false") return false; | 1185 if (n == "false") return false; |
1182 if (n == null) return null; | 1186 if (n == null) return null; |
1183 throw new core.ArgumentError("Invalid boolean: $n"); | 1187 throw new core.ArgumentError("Invalid boolean: $n"); |
1184 } | 1188 } |
| 1189 |
1185 if (query.length > 0) { | 1190 if (query.length > 0) { |
1186 for (var part in query.split("&")) { | 1191 for (var part in query.split("&")) { |
1187 var keyvalue = part.split("="); | 1192 var keyvalue = part.split("="); |
1188 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1193 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1194 core.Uri.decodeQueryComponent(keyvalue[1])); |
1189 } | 1195 } |
1190 } | 1196 } |
1191 unittest.expect(queryMap["useLegacyStack"].first, unittest.equals("$arg_
useLegacyStack")); | 1197 unittest.expect(queryMap["useLegacyStack"].first, |
1192 | 1198 unittest.equals("$arg_useLegacyStack")); |
1193 | 1199 |
1194 var h = { | 1200 var h = { |
1195 "content-type" : "application/json; charset=utf-8", | 1201 "content-type": "application/json; charset=utf-8", |
1196 }; | 1202 }; |
1197 var resp = convert.JSON.encode(buildProject()); | 1203 var resp = convert.JSON.encode(buildProject()); |
1198 return new async.Future.value(stringResponse(200, h, resp)); | 1204 return new async.Future.value(stringResponse(200, h, resp)); |
1199 }), true); | 1205 }), true); |
1200 res.create(arg_request, useLegacyStack: arg_useLegacyStack).then(unittest.
expectAsync1(((api.Project response) { | 1206 res |
| 1207 .create(arg_request, useLegacyStack: arg_useLegacyStack) |
| 1208 .then(unittest.expectAsync1(((api.Project response) { |
1201 checkProject(response); | 1209 checkProject(response); |
1202 }))); | 1210 }))); |
1203 }); | 1211 }); |
1204 | 1212 |
1205 unittest.test("method--delete", () { | 1213 unittest.test("method--delete", () { |
1206 | |
1207 var mock = new HttpServerMock(); | 1214 var mock = new HttpServerMock(); |
1208 api.ProjectsResourceApi res = new api.CloudresourcemanagerApi(mock).projec
ts; | 1215 api.ProjectsResourceApi res = |
| 1216 new api.CloudresourcemanagerApi(mock).projects; |
1209 var arg_projectId = "foo"; | 1217 var arg_projectId = "foo"; |
1210 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1218 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
1211 var path = (req.url).path; | 1219 var path = (req.url).path; |
1212 var pathOffset = 0; | 1220 var pathOffset = 0; |
1213 var index; | 1221 var index; |
1214 var subPart; | 1222 var subPart; |
1215 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1223 unittest.expect( |
| 1224 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
1216 pathOffset += 1; | 1225 pathOffset += 1; |
1217 unittest.expect(path.substring(pathOffset, pathOffset + 17), unittest.eq
uals("v1beta1/projects/")); | 1226 unittest.expect(path.substring(pathOffset, pathOffset + 17), |
| 1227 unittest.equals("v1beta1/projects/")); |
1218 pathOffset += 17; | 1228 pathOffset += 17; |
1219 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); | 1229 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
1220 pathOffset = path.length; | 1230 pathOffset = path.length; |
1221 unittest.expect(subPart, unittest.equals("$arg_projectId")); | 1231 unittest.expect(subPart, unittest.equals("$arg_projectId")); |
1222 | 1232 |
1223 var query = (req.url).query; | 1233 var query = (req.url).query; |
1224 var queryOffset = 0; | 1234 var queryOffset = 0; |
1225 var queryMap = {}; | 1235 var queryMap = {}; |
1226 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1236 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
1227 parseBool(n) { | 1237 parseBool(n) { |
1228 if (n == "true") return true; | 1238 if (n == "true") return true; |
1229 if (n == "false") return false; | 1239 if (n == "false") return false; |
1230 if (n == null) return null; | 1240 if (n == null) return null; |
1231 throw new core.ArgumentError("Invalid boolean: $n"); | 1241 throw new core.ArgumentError("Invalid boolean: $n"); |
1232 } | 1242 } |
| 1243 |
1233 if (query.length > 0) { | 1244 if (query.length > 0) { |
1234 for (var part in query.split("&")) { | 1245 for (var part in query.split("&")) { |
1235 var keyvalue = part.split("="); | 1246 var keyvalue = part.split("="); |
1236 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1247 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1248 core.Uri.decodeQueryComponent(keyvalue[1])); |
1237 } | 1249 } |
1238 } | 1250 } |
1239 | 1251 |
1240 | |
1241 var h = { | 1252 var h = { |
1242 "content-type" : "application/json; charset=utf-8", | 1253 "content-type": "application/json; charset=utf-8", |
1243 }; | 1254 }; |
1244 var resp = convert.JSON.encode(buildEmpty()); | 1255 var resp = convert.JSON.encode(buildEmpty()); |
1245 return new async.Future.value(stringResponse(200, h, resp)); | 1256 return new async.Future.value(stringResponse(200, h, resp)); |
1246 }), true); | 1257 }), true); |
1247 res.delete(arg_projectId).then(unittest.expectAsync1(((api.Empty response)
{ | 1258 res |
| 1259 .delete(arg_projectId) |
| 1260 .then(unittest.expectAsync1(((api.Empty response) { |
1248 checkEmpty(response); | 1261 checkEmpty(response); |
1249 }))); | 1262 }))); |
1250 }); | 1263 }); |
1251 | 1264 |
1252 unittest.test("method--get", () { | 1265 unittest.test("method--get", () { |
1253 | |
1254 var mock = new HttpServerMock(); | 1266 var mock = new HttpServerMock(); |
1255 api.ProjectsResourceApi res = new api.CloudresourcemanagerApi(mock).projec
ts; | 1267 api.ProjectsResourceApi res = |
| 1268 new api.CloudresourcemanagerApi(mock).projects; |
1256 var arg_projectId = "foo"; | 1269 var arg_projectId = "foo"; |
1257 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1270 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
1258 var path = (req.url).path; | 1271 var path = (req.url).path; |
1259 var pathOffset = 0; | 1272 var pathOffset = 0; |
1260 var index; | 1273 var index; |
1261 var subPart; | 1274 var subPart; |
1262 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1275 unittest.expect( |
| 1276 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
1263 pathOffset += 1; | 1277 pathOffset += 1; |
1264 unittest.expect(path.substring(pathOffset, pathOffset + 17), unittest.eq
uals("v1beta1/projects/")); | 1278 unittest.expect(path.substring(pathOffset, pathOffset + 17), |
| 1279 unittest.equals("v1beta1/projects/")); |
1265 pathOffset += 17; | 1280 pathOffset += 17; |
1266 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); | 1281 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
1267 pathOffset = path.length; | 1282 pathOffset = path.length; |
1268 unittest.expect(subPart, unittest.equals("$arg_projectId")); | 1283 unittest.expect(subPart, unittest.equals("$arg_projectId")); |
1269 | 1284 |
1270 var query = (req.url).query; | 1285 var query = (req.url).query; |
1271 var queryOffset = 0; | 1286 var queryOffset = 0; |
1272 var queryMap = {}; | 1287 var queryMap = {}; |
1273 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1288 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
1274 parseBool(n) { | 1289 parseBool(n) { |
1275 if (n == "true") return true; | 1290 if (n == "true") return true; |
1276 if (n == "false") return false; | 1291 if (n == "false") return false; |
1277 if (n == null) return null; | 1292 if (n == null) return null; |
1278 throw new core.ArgumentError("Invalid boolean: $n"); | 1293 throw new core.ArgumentError("Invalid boolean: $n"); |
1279 } | 1294 } |
| 1295 |
1280 if (query.length > 0) { | 1296 if (query.length > 0) { |
1281 for (var part in query.split("&")) { | 1297 for (var part in query.split("&")) { |
1282 var keyvalue = part.split("="); | 1298 var keyvalue = part.split("="); |
1283 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1299 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1300 core.Uri.decodeQueryComponent(keyvalue[1])); |
1284 } | 1301 } |
1285 } | 1302 } |
1286 | 1303 |
1287 | |
1288 var h = { | 1304 var h = { |
1289 "content-type" : "application/json; charset=utf-8", | 1305 "content-type": "application/json; charset=utf-8", |
1290 }; | 1306 }; |
1291 var resp = convert.JSON.encode(buildProject()); | 1307 var resp = convert.JSON.encode(buildProject()); |
1292 return new async.Future.value(stringResponse(200, h, resp)); | 1308 return new async.Future.value(stringResponse(200, h, resp)); |
1293 }), true); | 1309 }), true); |
1294 res.get(arg_projectId).then(unittest.expectAsync1(((api.Project response)
{ | 1310 res |
| 1311 .get(arg_projectId) |
| 1312 .then(unittest.expectAsync1(((api.Project response) { |
1295 checkProject(response); | 1313 checkProject(response); |
1296 }))); | 1314 }))); |
1297 }); | 1315 }); |
1298 | 1316 |
1299 unittest.test("method--getAncestry", () { | 1317 unittest.test("method--getAncestry", () { |
1300 | |
1301 var mock = new HttpServerMock(); | 1318 var mock = new HttpServerMock(); |
1302 api.ProjectsResourceApi res = new api.CloudresourcemanagerApi(mock).projec
ts; | 1319 api.ProjectsResourceApi res = |
| 1320 new api.CloudresourcemanagerApi(mock).projects; |
1303 var arg_request = buildGetAncestryRequest(); | 1321 var arg_request = buildGetAncestryRequest(); |
1304 var arg_projectId = "foo"; | 1322 var arg_projectId = "foo"; |
1305 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1323 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
1306 var obj = new api.GetAncestryRequest.fromJson(json); | 1324 var obj = new api.GetAncestryRequest.fromJson(json); |
1307 checkGetAncestryRequest(obj); | 1325 checkGetAncestryRequest(obj); |
1308 | 1326 |
1309 var path = (req.url).path; | 1327 var path = (req.url).path; |
1310 var pathOffset = 0; | 1328 var pathOffset = 0; |
1311 var index; | 1329 var index; |
1312 var subPart; | 1330 var subPart; |
1313 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1331 unittest.expect( |
| 1332 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
1314 pathOffset += 1; | 1333 pathOffset += 1; |
1315 unittest.expect(path.substring(pathOffset, pathOffset + 17), unittest.eq
uals("v1beta1/projects/")); | 1334 unittest.expect(path.substring(pathOffset, pathOffset + 17), |
| 1335 unittest.equals("v1beta1/projects/")); |
1316 pathOffset += 17; | 1336 pathOffset += 17; |
1317 index = path.indexOf(":getAncestry", pathOffset); | 1337 index = path.indexOf(":getAncestry", pathOffset); |
1318 unittest.expect(index >= 0, unittest.isTrue); | 1338 unittest.expect(index >= 0, unittest.isTrue); |
1319 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | 1339 subPart = |
| 1340 core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
1320 pathOffset = index; | 1341 pathOffset = index; |
1321 unittest.expect(subPart, unittest.equals("$arg_projectId")); | 1342 unittest.expect(subPart, unittest.equals("$arg_projectId")); |
1322 unittest.expect(path.substring(pathOffset, pathOffset + 12), unittest.eq
uals(":getAncestry")); | 1343 unittest.expect(path.substring(pathOffset, pathOffset + 12), |
| 1344 unittest.equals(":getAncestry")); |
1323 pathOffset += 12; | 1345 pathOffset += 12; |
1324 | 1346 |
1325 var query = (req.url).query; | 1347 var query = (req.url).query; |
1326 var queryOffset = 0; | 1348 var queryOffset = 0; |
1327 var queryMap = {}; | 1349 var queryMap = {}; |
1328 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1350 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
1329 parseBool(n) { | 1351 parseBool(n) { |
1330 if (n == "true") return true; | 1352 if (n == "true") return true; |
1331 if (n == "false") return false; | 1353 if (n == "false") return false; |
1332 if (n == null) return null; | 1354 if (n == null) return null; |
1333 throw new core.ArgumentError("Invalid boolean: $n"); | 1355 throw new core.ArgumentError("Invalid boolean: $n"); |
1334 } | 1356 } |
| 1357 |
1335 if (query.length > 0) { | 1358 if (query.length > 0) { |
1336 for (var part in query.split("&")) { | 1359 for (var part in query.split("&")) { |
1337 var keyvalue = part.split("="); | 1360 var keyvalue = part.split("="); |
1338 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1361 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1362 core.Uri.decodeQueryComponent(keyvalue[1])); |
1339 } | 1363 } |
1340 } | 1364 } |
1341 | 1365 |
1342 | |
1343 var h = { | 1366 var h = { |
1344 "content-type" : "application/json; charset=utf-8", | 1367 "content-type": "application/json; charset=utf-8", |
1345 }; | 1368 }; |
1346 var resp = convert.JSON.encode(buildGetAncestryResponse()); | 1369 var resp = convert.JSON.encode(buildGetAncestryResponse()); |
1347 return new async.Future.value(stringResponse(200, h, resp)); | 1370 return new async.Future.value(stringResponse(200, h, resp)); |
1348 }), true); | 1371 }), true); |
1349 res.getAncestry(arg_request, arg_projectId).then(unittest.expectAsync1(((a
pi.GetAncestryResponse response) { | 1372 res |
| 1373 .getAncestry(arg_request, arg_projectId) |
| 1374 .then(unittest.expectAsync1(((api.GetAncestryResponse response) { |
1350 checkGetAncestryResponse(response); | 1375 checkGetAncestryResponse(response); |
1351 }))); | 1376 }))); |
1352 }); | 1377 }); |
1353 | 1378 |
1354 unittest.test("method--getIamPolicy", () { | 1379 unittest.test("method--getIamPolicy", () { |
1355 | |
1356 var mock = new HttpServerMock(); | 1380 var mock = new HttpServerMock(); |
1357 api.ProjectsResourceApi res = new api.CloudresourcemanagerApi(mock).projec
ts; | 1381 api.ProjectsResourceApi res = |
| 1382 new api.CloudresourcemanagerApi(mock).projects; |
1358 var arg_request = buildGetIamPolicyRequest(); | 1383 var arg_request = buildGetIamPolicyRequest(); |
1359 var arg_resource = "foo"; | 1384 var arg_resource = "foo"; |
1360 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1385 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
1361 var obj = new api.GetIamPolicyRequest.fromJson(json); | 1386 var obj = new api.GetIamPolicyRequest.fromJson(json); |
1362 checkGetIamPolicyRequest(obj); | 1387 checkGetIamPolicyRequest(obj); |
1363 | 1388 |
1364 var path = (req.url).path; | 1389 var path = (req.url).path; |
1365 var pathOffset = 0; | 1390 var pathOffset = 0; |
1366 var index; | 1391 var index; |
1367 var subPart; | 1392 var subPart; |
1368 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1393 unittest.expect( |
| 1394 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
1369 pathOffset += 1; | 1395 pathOffset += 1; |
1370 unittest.expect(path.substring(pathOffset, pathOffset + 17), unittest.eq
uals("v1beta1/projects/")); | 1396 unittest.expect(path.substring(pathOffset, pathOffset + 17), |
| 1397 unittest.equals("v1beta1/projects/")); |
1371 pathOffset += 17; | 1398 pathOffset += 17; |
1372 index = path.indexOf(":getIamPolicy", pathOffset); | 1399 index = path.indexOf(":getIamPolicy", pathOffset); |
1373 unittest.expect(index >= 0, unittest.isTrue); | 1400 unittest.expect(index >= 0, unittest.isTrue); |
1374 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | 1401 subPart = |
| 1402 core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
1375 pathOffset = index; | 1403 pathOffset = index; |
1376 unittest.expect(subPart, unittest.equals("$arg_resource")); | 1404 unittest.expect(subPart, unittest.equals("$arg_resource")); |
1377 unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.eq
uals(":getIamPolicy")); | 1405 unittest.expect(path.substring(pathOffset, pathOffset + 13), |
| 1406 unittest.equals(":getIamPolicy")); |
1378 pathOffset += 13; | 1407 pathOffset += 13; |
1379 | 1408 |
1380 var query = (req.url).query; | 1409 var query = (req.url).query; |
1381 var queryOffset = 0; | 1410 var queryOffset = 0; |
1382 var queryMap = {}; | 1411 var queryMap = {}; |
1383 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1412 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
1384 parseBool(n) { | 1413 parseBool(n) { |
1385 if (n == "true") return true; | 1414 if (n == "true") return true; |
1386 if (n == "false") return false; | 1415 if (n == "false") return false; |
1387 if (n == null) return null; | 1416 if (n == null) return null; |
1388 throw new core.ArgumentError("Invalid boolean: $n"); | 1417 throw new core.ArgumentError("Invalid boolean: $n"); |
1389 } | 1418 } |
| 1419 |
1390 if (query.length > 0) { | 1420 if (query.length > 0) { |
1391 for (var part in query.split("&")) { | 1421 for (var part in query.split("&")) { |
1392 var keyvalue = part.split("="); | 1422 var keyvalue = part.split("="); |
1393 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1423 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1424 core.Uri.decodeQueryComponent(keyvalue[1])); |
1394 } | 1425 } |
1395 } | 1426 } |
1396 | 1427 |
1397 | |
1398 var h = { | 1428 var h = { |
1399 "content-type" : "application/json; charset=utf-8", | 1429 "content-type": "application/json; charset=utf-8", |
1400 }; | 1430 }; |
1401 var resp = convert.JSON.encode(buildPolicy()); | 1431 var resp = convert.JSON.encode(buildPolicy()); |
1402 return new async.Future.value(stringResponse(200, h, resp)); | 1432 return new async.Future.value(stringResponse(200, h, resp)); |
1403 }), true); | 1433 }), true); |
1404 res.getIamPolicy(arg_request, arg_resource).then(unittest.expectAsync1(((a
pi.Policy response) { | 1434 res |
| 1435 .getIamPolicy(arg_request, arg_resource) |
| 1436 .then(unittest.expectAsync1(((api.Policy response) { |
1405 checkPolicy(response); | 1437 checkPolicy(response); |
1406 }))); | 1438 }))); |
1407 }); | 1439 }); |
1408 | 1440 |
1409 unittest.test("method--list", () { | 1441 unittest.test("method--list", () { |
1410 | |
1411 var mock = new HttpServerMock(); | 1442 var mock = new HttpServerMock(); |
1412 api.ProjectsResourceApi res = new api.CloudresourcemanagerApi(mock).projec
ts; | 1443 api.ProjectsResourceApi res = |
| 1444 new api.CloudresourcemanagerApi(mock).projects; |
| 1445 var arg_filter = "foo"; |
1413 var arg_pageToken = "foo"; | 1446 var arg_pageToken = "foo"; |
1414 var arg_pageSize = 42; | 1447 var arg_pageSize = 42; |
1415 var arg_filter = "foo"; | |
1416 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1448 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
1417 var path = (req.url).path; | 1449 var path = (req.url).path; |
1418 var pathOffset = 0; | 1450 var pathOffset = 0; |
1419 var index; | 1451 var index; |
1420 var subPart; | 1452 var subPart; |
1421 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1453 unittest.expect( |
| 1454 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
1422 pathOffset += 1; | 1455 pathOffset += 1; |
1423 unittest.expect(path.substring(pathOffset, pathOffset + 16), unittest.eq
uals("v1beta1/projects")); | 1456 unittest.expect(path.substring(pathOffset, pathOffset + 16), |
| 1457 unittest.equals("v1beta1/projects")); |
1424 pathOffset += 16; | 1458 pathOffset += 16; |
1425 | 1459 |
1426 var query = (req.url).query; | 1460 var query = (req.url).query; |
1427 var queryOffset = 0; | 1461 var queryOffset = 0; |
1428 var queryMap = {}; | 1462 var queryMap = {}; |
1429 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1463 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
1430 parseBool(n) { | 1464 parseBool(n) { |
1431 if (n == "true") return true; | 1465 if (n == "true") return true; |
1432 if (n == "false") return false; | 1466 if (n == "false") return false; |
1433 if (n == null) return null; | 1467 if (n == null) return null; |
1434 throw new core.ArgumentError("Invalid boolean: $n"); | 1468 throw new core.ArgumentError("Invalid boolean: $n"); |
1435 } | 1469 } |
| 1470 |
1436 if (query.length > 0) { | 1471 if (query.length > 0) { |
1437 for (var part in query.split("&")) { | 1472 for (var part in query.split("&")) { |
1438 var keyvalue = part.split("="); | 1473 var keyvalue = part.split("="); |
1439 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1474 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1475 core.Uri.decodeQueryComponent(keyvalue[1])); |
1440 } | 1476 } |
1441 } | 1477 } |
1442 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); | |
1443 unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equ
als(arg_pageSize)); | |
1444 unittest.expect(queryMap["filter"].first, unittest.equals(arg_filter)); | 1478 unittest.expect(queryMap["filter"].first, unittest.equals(arg_filter)); |
1445 | 1479 unittest.expect( |
| 1480 queryMap["pageToken"].first, unittest.equals(arg_pageToken)); |
| 1481 unittest.expect(core.int.parse(queryMap["pageSize"].first), |
| 1482 unittest.equals(arg_pageSize)); |
1446 | 1483 |
1447 var h = { | 1484 var h = { |
1448 "content-type" : "application/json; charset=utf-8", | 1485 "content-type": "application/json; charset=utf-8", |
1449 }; | 1486 }; |
1450 var resp = convert.JSON.encode(buildListProjectsResponse()); | 1487 var resp = convert.JSON.encode(buildListProjectsResponse()); |
1451 return new async.Future.value(stringResponse(200, h, resp)); | 1488 return new async.Future.value(stringResponse(200, h, resp)); |
1452 }), true); | 1489 }), true); |
1453 res.list(pageToken: arg_pageToken, pageSize: arg_pageSize, filter: arg_fil
ter).then(unittest.expectAsync1(((api.ListProjectsResponse response) { | 1490 res |
| 1491 .list( |
| 1492 filter: arg_filter, |
| 1493 pageToken: arg_pageToken, |
| 1494 pageSize: arg_pageSize) |
| 1495 .then(unittest.expectAsync1(((api.ListProjectsResponse response) { |
1454 checkListProjectsResponse(response); | 1496 checkListProjectsResponse(response); |
1455 }))); | 1497 }))); |
1456 }); | 1498 }); |
1457 | 1499 |
1458 unittest.test("method--setIamPolicy", () { | 1500 unittest.test("method--setIamPolicy", () { |
1459 | |
1460 var mock = new HttpServerMock(); | 1501 var mock = new HttpServerMock(); |
1461 api.ProjectsResourceApi res = new api.CloudresourcemanagerApi(mock).projec
ts; | 1502 api.ProjectsResourceApi res = |
| 1503 new api.CloudresourcemanagerApi(mock).projects; |
1462 var arg_request = buildSetIamPolicyRequest(); | 1504 var arg_request = buildSetIamPolicyRequest(); |
1463 var arg_resource = "foo"; | 1505 var arg_resource = "foo"; |
1464 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1506 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
1465 var obj = new api.SetIamPolicyRequest.fromJson(json); | 1507 var obj = new api.SetIamPolicyRequest.fromJson(json); |
1466 checkSetIamPolicyRequest(obj); | 1508 checkSetIamPolicyRequest(obj); |
1467 | 1509 |
1468 var path = (req.url).path; | 1510 var path = (req.url).path; |
1469 var pathOffset = 0; | 1511 var pathOffset = 0; |
1470 var index; | 1512 var index; |
1471 var subPart; | 1513 var subPart; |
1472 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1514 unittest.expect( |
| 1515 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
1473 pathOffset += 1; | 1516 pathOffset += 1; |
1474 unittest.expect(path.substring(pathOffset, pathOffset + 17), unittest.eq
uals("v1beta1/projects/")); | 1517 unittest.expect(path.substring(pathOffset, pathOffset + 17), |
| 1518 unittest.equals("v1beta1/projects/")); |
1475 pathOffset += 17; | 1519 pathOffset += 17; |
1476 index = path.indexOf(":setIamPolicy", pathOffset); | 1520 index = path.indexOf(":setIamPolicy", pathOffset); |
1477 unittest.expect(index >= 0, unittest.isTrue); | 1521 unittest.expect(index >= 0, unittest.isTrue); |
1478 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | 1522 subPart = |
| 1523 core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
1479 pathOffset = index; | 1524 pathOffset = index; |
1480 unittest.expect(subPart, unittest.equals("$arg_resource")); | 1525 unittest.expect(subPart, unittest.equals("$arg_resource")); |
1481 unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.eq
uals(":setIamPolicy")); | 1526 unittest.expect(path.substring(pathOffset, pathOffset + 13), |
| 1527 unittest.equals(":setIamPolicy")); |
1482 pathOffset += 13; | 1528 pathOffset += 13; |
1483 | 1529 |
1484 var query = (req.url).query; | 1530 var query = (req.url).query; |
1485 var queryOffset = 0; | 1531 var queryOffset = 0; |
1486 var queryMap = {}; | 1532 var queryMap = {}; |
1487 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1533 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
1488 parseBool(n) { | 1534 parseBool(n) { |
1489 if (n == "true") return true; | 1535 if (n == "true") return true; |
1490 if (n == "false") return false; | 1536 if (n == "false") return false; |
1491 if (n == null) return null; | 1537 if (n == null) return null; |
1492 throw new core.ArgumentError("Invalid boolean: $n"); | 1538 throw new core.ArgumentError("Invalid boolean: $n"); |
1493 } | 1539 } |
| 1540 |
1494 if (query.length > 0) { | 1541 if (query.length > 0) { |
1495 for (var part in query.split("&")) { | 1542 for (var part in query.split("&")) { |
1496 var keyvalue = part.split("="); | 1543 var keyvalue = part.split("="); |
1497 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1544 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1545 core.Uri.decodeQueryComponent(keyvalue[1])); |
1498 } | 1546 } |
1499 } | 1547 } |
1500 | 1548 |
1501 | |
1502 var h = { | 1549 var h = { |
1503 "content-type" : "application/json; charset=utf-8", | 1550 "content-type": "application/json; charset=utf-8", |
1504 }; | 1551 }; |
1505 var resp = convert.JSON.encode(buildPolicy()); | 1552 var resp = convert.JSON.encode(buildPolicy()); |
1506 return new async.Future.value(stringResponse(200, h, resp)); | 1553 return new async.Future.value(stringResponse(200, h, resp)); |
1507 }), true); | 1554 }), true); |
1508 res.setIamPolicy(arg_request, arg_resource).then(unittest.expectAsync1(((a
pi.Policy response) { | 1555 res |
| 1556 .setIamPolicy(arg_request, arg_resource) |
| 1557 .then(unittest.expectAsync1(((api.Policy response) { |
1509 checkPolicy(response); | 1558 checkPolicy(response); |
1510 }))); | 1559 }))); |
1511 }); | 1560 }); |
1512 | 1561 |
1513 unittest.test("method--testIamPermissions", () { | 1562 unittest.test("method--testIamPermissions", () { |
1514 | |
1515 var mock = new HttpServerMock(); | 1563 var mock = new HttpServerMock(); |
1516 api.ProjectsResourceApi res = new api.CloudresourcemanagerApi(mock).projec
ts; | 1564 api.ProjectsResourceApi res = |
| 1565 new api.CloudresourcemanagerApi(mock).projects; |
1517 var arg_request = buildTestIamPermissionsRequest(); | 1566 var arg_request = buildTestIamPermissionsRequest(); |
1518 var arg_resource = "foo"; | 1567 var arg_resource = "foo"; |
1519 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1568 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
1520 var obj = new api.TestIamPermissionsRequest.fromJson(json); | 1569 var obj = new api.TestIamPermissionsRequest.fromJson(json); |
1521 checkTestIamPermissionsRequest(obj); | 1570 checkTestIamPermissionsRequest(obj); |
1522 | 1571 |
1523 var path = (req.url).path; | 1572 var path = (req.url).path; |
1524 var pathOffset = 0; | 1573 var pathOffset = 0; |
1525 var index; | 1574 var index; |
1526 var subPart; | 1575 var subPart; |
1527 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1576 unittest.expect( |
| 1577 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
1528 pathOffset += 1; | 1578 pathOffset += 1; |
1529 unittest.expect(path.substring(pathOffset, pathOffset + 17), unittest.eq
uals("v1beta1/projects/")); | 1579 unittest.expect(path.substring(pathOffset, pathOffset + 17), |
| 1580 unittest.equals("v1beta1/projects/")); |
1530 pathOffset += 17; | 1581 pathOffset += 17; |
1531 index = path.indexOf(":testIamPermissions", pathOffset); | 1582 index = path.indexOf(":testIamPermissions", pathOffset); |
1532 unittest.expect(index >= 0, unittest.isTrue); | 1583 unittest.expect(index >= 0, unittest.isTrue); |
1533 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | 1584 subPart = |
| 1585 core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
1534 pathOffset = index; | 1586 pathOffset = index; |
1535 unittest.expect(subPart, unittest.equals("$arg_resource")); | 1587 unittest.expect(subPart, unittest.equals("$arg_resource")); |
1536 unittest.expect(path.substring(pathOffset, pathOffset + 19), unittest.eq
uals(":testIamPermissions")); | 1588 unittest.expect(path.substring(pathOffset, pathOffset + 19), |
| 1589 unittest.equals(":testIamPermissions")); |
1537 pathOffset += 19; | 1590 pathOffset += 19; |
1538 | 1591 |
1539 var query = (req.url).query; | 1592 var query = (req.url).query; |
1540 var queryOffset = 0; | 1593 var queryOffset = 0; |
1541 var queryMap = {}; | 1594 var queryMap = {}; |
1542 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1595 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
1543 parseBool(n) { | 1596 parseBool(n) { |
1544 if (n == "true") return true; | 1597 if (n == "true") return true; |
1545 if (n == "false") return false; | 1598 if (n == "false") return false; |
1546 if (n == null) return null; | 1599 if (n == null) return null; |
1547 throw new core.ArgumentError("Invalid boolean: $n"); | 1600 throw new core.ArgumentError("Invalid boolean: $n"); |
1548 } | 1601 } |
| 1602 |
1549 if (query.length > 0) { | 1603 if (query.length > 0) { |
1550 for (var part in query.split("&")) { | 1604 for (var part in query.split("&")) { |
1551 var keyvalue = part.split("="); | 1605 var keyvalue = part.split("="); |
1552 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1606 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1607 core.Uri.decodeQueryComponent(keyvalue[1])); |
1553 } | 1608 } |
1554 } | 1609 } |
1555 | 1610 |
1556 | |
1557 var h = { | 1611 var h = { |
1558 "content-type" : "application/json; charset=utf-8", | 1612 "content-type": "application/json; charset=utf-8", |
1559 }; | 1613 }; |
1560 var resp = convert.JSON.encode(buildTestIamPermissionsResponse()); | 1614 var resp = convert.JSON.encode(buildTestIamPermissionsResponse()); |
1561 return new async.Future.value(stringResponse(200, h, resp)); | 1615 return new async.Future.value(stringResponse(200, h, resp)); |
1562 }), true); | 1616 }), true); |
1563 res.testIamPermissions(arg_request, arg_resource).then(unittest.expectAsyn
c1(((api.TestIamPermissionsResponse response) { | 1617 res.testIamPermissions(arg_request, arg_resource).then( |
| 1618 unittest.expectAsync1(((api.TestIamPermissionsResponse response) { |
1564 checkTestIamPermissionsResponse(response); | 1619 checkTestIamPermissionsResponse(response); |
1565 }))); | 1620 }))); |
1566 }); | 1621 }); |
1567 | 1622 |
1568 unittest.test("method--undelete", () { | 1623 unittest.test("method--undelete", () { |
1569 | |
1570 var mock = new HttpServerMock(); | 1624 var mock = new HttpServerMock(); |
1571 api.ProjectsResourceApi res = new api.CloudresourcemanagerApi(mock).projec
ts; | 1625 api.ProjectsResourceApi res = |
| 1626 new api.CloudresourcemanagerApi(mock).projects; |
1572 var arg_request = buildUndeleteProjectRequest(); | 1627 var arg_request = buildUndeleteProjectRequest(); |
1573 var arg_projectId = "foo"; | 1628 var arg_projectId = "foo"; |
1574 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1629 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
1575 var obj = new api.UndeleteProjectRequest.fromJson(json); | 1630 var obj = new api.UndeleteProjectRequest.fromJson(json); |
1576 checkUndeleteProjectRequest(obj); | 1631 checkUndeleteProjectRequest(obj); |
1577 | 1632 |
1578 var path = (req.url).path; | 1633 var path = (req.url).path; |
1579 var pathOffset = 0; | 1634 var pathOffset = 0; |
1580 var index; | 1635 var index; |
1581 var subPart; | 1636 var subPart; |
1582 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1637 unittest.expect( |
| 1638 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
1583 pathOffset += 1; | 1639 pathOffset += 1; |
1584 unittest.expect(path.substring(pathOffset, pathOffset + 17), unittest.eq
uals("v1beta1/projects/")); | 1640 unittest.expect(path.substring(pathOffset, pathOffset + 17), |
| 1641 unittest.equals("v1beta1/projects/")); |
1585 pathOffset += 17; | 1642 pathOffset += 17; |
1586 index = path.indexOf(":undelete", pathOffset); | 1643 index = path.indexOf(":undelete", pathOffset); |
1587 unittest.expect(index >= 0, unittest.isTrue); | 1644 unittest.expect(index >= 0, unittest.isTrue); |
1588 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | 1645 subPart = |
| 1646 core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
1589 pathOffset = index; | 1647 pathOffset = index; |
1590 unittest.expect(subPart, unittest.equals("$arg_projectId")); | 1648 unittest.expect(subPart, unittest.equals("$arg_projectId")); |
1591 unittest.expect(path.substring(pathOffset, pathOffset + 9), unittest.equ
als(":undelete")); | 1649 unittest.expect(path.substring(pathOffset, pathOffset + 9), |
| 1650 unittest.equals(":undelete")); |
1592 pathOffset += 9; | 1651 pathOffset += 9; |
1593 | 1652 |
1594 var query = (req.url).query; | 1653 var query = (req.url).query; |
1595 var queryOffset = 0; | 1654 var queryOffset = 0; |
1596 var queryMap = {}; | 1655 var queryMap = {}; |
1597 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1656 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
1598 parseBool(n) { | 1657 parseBool(n) { |
1599 if (n == "true") return true; | 1658 if (n == "true") return true; |
1600 if (n == "false") return false; | 1659 if (n == "false") return false; |
1601 if (n == null) return null; | 1660 if (n == null) return null; |
1602 throw new core.ArgumentError("Invalid boolean: $n"); | 1661 throw new core.ArgumentError("Invalid boolean: $n"); |
1603 } | 1662 } |
| 1663 |
1604 if (query.length > 0) { | 1664 if (query.length > 0) { |
1605 for (var part in query.split("&")) { | 1665 for (var part in query.split("&")) { |
1606 var keyvalue = part.split("="); | 1666 var keyvalue = part.split("="); |
1607 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1667 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1668 core.Uri.decodeQueryComponent(keyvalue[1])); |
1608 } | 1669 } |
1609 } | 1670 } |
1610 | 1671 |
1611 | |
1612 var h = { | 1672 var h = { |
1613 "content-type" : "application/json; charset=utf-8", | 1673 "content-type": "application/json; charset=utf-8", |
1614 }; | 1674 }; |
1615 var resp = convert.JSON.encode(buildEmpty()); | 1675 var resp = convert.JSON.encode(buildEmpty()); |
1616 return new async.Future.value(stringResponse(200, h, resp)); | 1676 return new async.Future.value(stringResponse(200, h, resp)); |
1617 }), true); | 1677 }), true); |
1618 res.undelete(arg_request, arg_projectId).then(unittest.expectAsync1(((api.
Empty response) { | 1678 res |
| 1679 .undelete(arg_request, arg_projectId) |
| 1680 .then(unittest.expectAsync1(((api.Empty response) { |
1619 checkEmpty(response); | 1681 checkEmpty(response); |
1620 }))); | 1682 }))); |
1621 }); | 1683 }); |
1622 | 1684 |
1623 unittest.test("method--update", () { | 1685 unittest.test("method--update", () { |
1624 | |
1625 var mock = new HttpServerMock(); | 1686 var mock = new HttpServerMock(); |
1626 api.ProjectsResourceApi res = new api.CloudresourcemanagerApi(mock).projec
ts; | 1687 api.ProjectsResourceApi res = |
| 1688 new api.CloudresourcemanagerApi(mock).projects; |
1627 var arg_request = buildProject(); | 1689 var arg_request = buildProject(); |
1628 var arg_projectId = "foo"; | 1690 var arg_projectId = "foo"; |
1629 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1691 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
1630 var obj = new api.Project.fromJson(json); | 1692 var obj = new api.Project.fromJson(json); |
1631 checkProject(obj); | 1693 checkProject(obj); |
1632 | 1694 |
1633 var path = (req.url).path; | 1695 var path = (req.url).path; |
1634 var pathOffset = 0; | 1696 var pathOffset = 0; |
1635 var index; | 1697 var index; |
1636 var subPart; | 1698 var subPart; |
1637 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1699 unittest.expect( |
| 1700 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
1638 pathOffset += 1; | 1701 pathOffset += 1; |
1639 unittest.expect(path.substring(pathOffset, pathOffset + 17), unittest.eq
uals("v1beta1/projects/")); | 1702 unittest.expect(path.substring(pathOffset, pathOffset + 17), |
| 1703 unittest.equals("v1beta1/projects/")); |
1640 pathOffset += 17; | 1704 pathOffset += 17; |
1641 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); | 1705 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
1642 pathOffset = path.length; | 1706 pathOffset = path.length; |
1643 unittest.expect(subPart, unittest.equals("$arg_projectId")); | 1707 unittest.expect(subPart, unittest.equals("$arg_projectId")); |
1644 | 1708 |
1645 var query = (req.url).query; | 1709 var query = (req.url).query; |
1646 var queryOffset = 0; | 1710 var queryOffset = 0; |
1647 var queryMap = {}; | 1711 var queryMap = {}; |
1648 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1712 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
1649 parseBool(n) { | 1713 parseBool(n) { |
1650 if (n == "true") return true; | 1714 if (n == "true") return true; |
1651 if (n == "false") return false; | 1715 if (n == "false") return false; |
1652 if (n == null) return null; | 1716 if (n == null) return null; |
1653 throw new core.ArgumentError("Invalid boolean: $n"); | 1717 throw new core.ArgumentError("Invalid boolean: $n"); |
1654 } | 1718 } |
| 1719 |
1655 if (query.length > 0) { | 1720 if (query.length > 0) { |
1656 for (var part in query.split("&")) { | 1721 for (var part in query.split("&")) { |
1657 var keyvalue = part.split("="); | 1722 var keyvalue = part.split("="); |
1658 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1723 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1724 core.Uri.decodeQueryComponent(keyvalue[1])); |
1659 } | 1725 } |
1660 } | 1726 } |
1661 | 1727 |
1662 | |
1663 var h = { | 1728 var h = { |
1664 "content-type" : "application/json; charset=utf-8", | 1729 "content-type": "application/json; charset=utf-8", |
1665 }; | 1730 }; |
1666 var resp = convert.JSON.encode(buildProject()); | 1731 var resp = convert.JSON.encode(buildProject()); |
1667 return new async.Future.value(stringResponse(200, h, resp)); | 1732 return new async.Future.value(stringResponse(200, h, resp)); |
1668 }), true); | 1733 }), true); |
1669 res.update(arg_request, arg_projectId).then(unittest.expectAsync1(((api.Pr
oject response) { | 1734 res |
| 1735 .update(arg_request, arg_projectId) |
| 1736 .then(unittest.expectAsync1(((api.Project response) { |
1670 checkProject(response); | 1737 checkProject(response); |
1671 }))); | 1738 }))); |
1672 }); | 1739 }); |
1673 | |
1674 }); | 1740 }); |
1675 | |
1676 | |
1677 } | 1741 } |
1678 | |
OLD | NEW |