OLD | NEW |
1 library googleapis.firebaserules.v1.test; | 1 library googleapis.firebaserules.v1.test; |
2 | 2 |
3 import "dart:core" as core; | 3 import "dart:core" as core; |
4 import "dart:collection" as collection; | 4 import "dart:collection" as collection; |
5 import "dart:async" as async; | 5 import "dart:async" as async; |
6 import "dart:convert" as convert; | 6 import "dart:convert" as convert; |
7 | 7 |
8 import 'package:http/http.dart' as http; | 8 import 'package:http/http.dart' as http; |
9 import 'package:http/testing.dart' as http_testing; | 9 import 'package:http/testing.dart' as http_testing; |
10 import 'package:unittest/unittest.dart' as unittest; | 10 import 'package:unittest/unittest.dart' as unittest; |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 checkFile(api.File o) { | 84 checkFile(api.File o) { |
85 buildCounterFile++; | 85 buildCounterFile++; |
86 if (buildCounterFile < 3) { | 86 if (buildCounterFile < 3) { |
87 unittest.expect(o.content, unittest.equals('foo')); | 87 unittest.expect(o.content, unittest.equals('foo')); |
88 unittest.expect(o.fingerprint, unittest.equals('foo')); | 88 unittest.expect(o.fingerprint, unittest.equals('foo')); |
89 unittest.expect(o.name, unittest.equals('foo')); | 89 unittest.expect(o.name, unittest.equals('foo')); |
90 } | 90 } |
91 buildCounterFile--; | 91 buildCounterFile--; |
92 } | 92 } |
93 | 93 |
| 94 buildUnnamed3075() { |
| 95 var o = new core.List<core.Object>(); |
| 96 o.add({'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}); |
| 97 o.add({'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}); |
| 98 return o; |
| 99 } |
| 100 |
| 101 checkUnnamed3075(core.List<core.Object> o) { |
| 102 unittest.expect(o, unittest.hasLength(2)); |
| 103 var casted1 = (o[0]) as core.Map; unittest.expect(casted1, unittest.hasLength(
3)); unittest.expect(casted1["list"], unittest.equals([1, 2, 3])); unittest.expe
ct(casted1["bool"], unittest.equals(true)); unittest.expect(casted1["string"], u
nittest.equals('foo')); |
| 104 var casted2 = (o[1]) as core.Map; unittest.expect(casted2, unittest.hasLength(
3)); unittest.expect(casted2["list"], unittest.equals([1, 2, 3])); unittest.expe
ct(casted2["bool"], unittest.equals(true)); unittest.expect(casted2["string"], u
nittest.equals('foo')); |
| 105 } |
| 106 |
| 107 core.int buildCounterFunctionCall = 0; |
| 108 buildFunctionCall() { |
| 109 var o = new api.FunctionCall(); |
| 110 buildCounterFunctionCall++; |
| 111 if (buildCounterFunctionCall < 3) { |
| 112 o.args = buildUnnamed3075(); |
| 113 o.function = "foo"; |
| 114 } |
| 115 buildCounterFunctionCall--; |
| 116 return o; |
| 117 } |
| 118 |
| 119 checkFunctionCall(api.FunctionCall o) { |
| 120 buildCounterFunctionCall++; |
| 121 if (buildCounterFunctionCall < 3) { |
| 122 checkUnnamed3075(o.args); |
| 123 unittest.expect(o.function, unittest.equals('foo')); |
| 124 } |
| 125 buildCounterFunctionCall--; |
| 126 } |
| 127 |
94 core.int buildCounterIssue = 0; | 128 core.int buildCounterIssue = 0; |
95 buildIssue() { | 129 buildIssue() { |
96 var o = new api.Issue(); | 130 var o = new api.Issue(); |
97 buildCounterIssue++; | 131 buildCounterIssue++; |
98 if (buildCounterIssue < 3) { | 132 if (buildCounterIssue < 3) { |
99 o.description = "foo"; | 133 o.description = "foo"; |
100 o.severity = "foo"; | 134 o.severity = "foo"; |
101 o.sourcePosition = buildSourcePosition(); | 135 o.sourcePosition = buildSourcePosition(); |
102 } | 136 } |
103 buildCounterIssue--; | 137 buildCounterIssue--; |
104 return o; | 138 return o; |
105 } | 139 } |
106 | 140 |
107 checkIssue(api.Issue o) { | 141 checkIssue(api.Issue o) { |
108 buildCounterIssue++; | 142 buildCounterIssue++; |
109 if (buildCounterIssue < 3) { | 143 if (buildCounterIssue < 3) { |
110 unittest.expect(o.description, unittest.equals('foo')); | 144 unittest.expect(o.description, unittest.equals('foo')); |
111 unittest.expect(o.severity, unittest.equals('foo')); | 145 unittest.expect(o.severity, unittest.equals('foo')); |
112 checkSourcePosition(o.sourcePosition); | 146 checkSourcePosition(o.sourcePosition); |
113 } | 147 } |
114 buildCounterIssue--; | 148 buildCounterIssue--; |
115 } | 149 } |
116 | 150 |
117 buildUnnamed2969() { | 151 buildUnnamed3076() { |
118 var o = new core.List<api.Release>(); | 152 var o = new core.List<api.Release>(); |
119 o.add(buildRelease()); | 153 o.add(buildRelease()); |
120 o.add(buildRelease()); | 154 o.add(buildRelease()); |
121 return o; | 155 return o; |
122 } | 156 } |
123 | 157 |
124 checkUnnamed2969(core.List<api.Release> o) { | 158 checkUnnamed3076(core.List<api.Release> o) { |
125 unittest.expect(o, unittest.hasLength(2)); | 159 unittest.expect(o, unittest.hasLength(2)); |
126 checkRelease(o[0]); | 160 checkRelease(o[0]); |
127 checkRelease(o[1]); | 161 checkRelease(o[1]); |
128 } | 162 } |
129 | 163 |
130 core.int buildCounterListReleasesResponse = 0; | 164 core.int buildCounterListReleasesResponse = 0; |
131 buildListReleasesResponse() { | 165 buildListReleasesResponse() { |
132 var o = new api.ListReleasesResponse(); | 166 var o = new api.ListReleasesResponse(); |
133 buildCounterListReleasesResponse++; | 167 buildCounterListReleasesResponse++; |
134 if (buildCounterListReleasesResponse < 3) { | 168 if (buildCounterListReleasesResponse < 3) { |
135 o.nextPageToken = "foo"; | 169 o.nextPageToken = "foo"; |
136 o.releases = buildUnnamed2969(); | 170 o.releases = buildUnnamed3076(); |
137 } | 171 } |
138 buildCounterListReleasesResponse--; | 172 buildCounterListReleasesResponse--; |
139 return o; | 173 return o; |
140 } | 174 } |
141 | 175 |
142 checkListReleasesResponse(api.ListReleasesResponse o) { | 176 checkListReleasesResponse(api.ListReleasesResponse o) { |
143 buildCounterListReleasesResponse++; | 177 buildCounterListReleasesResponse++; |
144 if (buildCounterListReleasesResponse < 3) { | 178 if (buildCounterListReleasesResponse < 3) { |
145 unittest.expect(o.nextPageToken, unittest.equals('foo')); | 179 unittest.expect(o.nextPageToken, unittest.equals('foo')); |
146 checkUnnamed2969(o.releases); | 180 checkUnnamed3076(o.releases); |
147 } | 181 } |
148 buildCounterListReleasesResponse--; | 182 buildCounterListReleasesResponse--; |
149 } | 183 } |
150 | 184 |
151 buildUnnamed2970() { | 185 buildUnnamed3077() { |
152 var o = new core.List<api.Ruleset>(); | 186 var o = new core.List<api.Ruleset>(); |
153 o.add(buildRuleset()); | 187 o.add(buildRuleset()); |
154 o.add(buildRuleset()); | 188 o.add(buildRuleset()); |
155 return o; | 189 return o; |
156 } | 190 } |
157 | 191 |
158 checkUnnamed2970(core.List<api.Ruleset> o) { | 192 checkUnnamed3077(core.List<api.Ruleset> o) { |
159 unittest.expect(o, unittest.hasLength(2)); | 193 unittest.expect(o, unittest.hasLength(2)); |
160 checkRuleset(o[0]); | 194 checkRuleset(o[0]); |
161 checkRuleset(o[1]); | 195 checkRuleset(o[1]); |
162 } | 196 } |
163 | 197 |
164 core.int buildCounterListRulesetsResponse = 0; | 198 core.int buildCounterListRulesetsResponse = 0; |
165 buildListRulesetsResponse() { | 199 buildListRulesetsResponse() { |
166 var o = new api.ListRulesetsResponse(); | 200 var o = new api.ListRulesetsResponse(); |
167 buildCounterListRulesetsResponse++; | 201 buildCounterListRulesetsResponse++; |
168 if (buildCounterListRulesetsResponse < 3) { | 202 if (buildCounterListRulesetsResponse < 3) { |
169 o.nextPageToken = "foo"; | 203 o.nextPageToken = "foo"; |
170 o.rulesets = buildUnnamed2970(); | 204 o.rulesets = buildUnnamed3077(); |
171 } | 205 } |
172 buildCounterListRulesetsResponse--; | 206 buildCounterListRulesetsResponse--; |
173 return o; | 207 return o; |
174 } | 208 } |
175 | 209 |
176 checkListRulesetsResponse(api.ListRulesetsResponse o) { | 210 checkListRulesetsResponse(api.ListRulesetsResponse o) { |
177 buildCounterListRulesetsResponse++; | 211 buildCounterListRulesetsResponse++; |
178 if (buildCounterListRulesetsResponse < 3) { | 212 if (buildCounterListRulesetsResponse < 3) { |
179 unittest.expect(o.nextPageToken, unittest.equals('foo')); | 213 unittest.expect(o.nextPageToken, unittest.equals('foo')); |
180 checkUnnamed2970(o.rulesets); | 214 checkUnnamed3077(o.rulesets); |
181 } | 215 } |
182 buildCounterListRulesetsResponse--; | 216 buildCounterListRulesetsResponse--; |
183 } | 217 } |
184 | 218 |
185 core.int buildCounterRelease = 0; | 219 core.int buildCounterRelease = 0; |
186 buildRelease() { | 220 buildRelease() { |
187 var o = new api.Release(); | 221 var o = new api.Release(); |
188 buildCounterRelease++; | 222 buildCounterRelease++; |
189 if (buildCounterRelease < 3) { | 223 if (buildCounterRelease < 3) { |
190 o.createTime = "foo"; | 224 o.createTime = "foo"; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 checkRuleset(api.Ruleset o) { | 257 checkRuleset(api.Ruleset o) { |
224 buildCounterRuleset++; | 258 buildCounterRuleset++; |
225 if (buildCounterRuleset < 3) { | 259 if (buildCounterRuleset < 3) { |
226 unittest.expect(o.createTime, unittest.equals('foo')); | 260 unittest.expect(o.createTime, unittest.equals('foo')); |
227 unittest.expect(o.name, unittest.equals('foo')); | 261 unittest.expect(o.name, unittest.equals('foo')); |
228 checkSource(o.source); | 262 checkSource(o.source); |
229 } | 263 } |
230 buildCounterRuleset--; | 264 buildCounterRuleset--; |
231 } | 265 } |
232 | 266 |
233 buildUnnamed2971() { | 267 buildUnnamed3078() { |
234 var o = new core.List<api.File>(); | 268 var o = new core.List<api.File>(); |
235 o.add(buildFile()); | 269 o.add(buildFile()); |
236 o.add(buildFile()); | 270 o.add(buildFile()); |
237 return o; | 271 return o; |
238 } | 272 } |
239 | 273 |
240 checkUnnamed2971(core.List<api.File> o) { | 274 checkUnnamed3078(core.List<api.File> o) { |
241 unittest.expect(o, unittest.hasLength(2)); | 275 unittest.expect(o, unittest.hasLength(2)); |
242 checkFile(o[0]); | 276 checkFile(o[0]); |
243 checkFile(o[1]); | 277 checkFile(o[1]); |
244 } | 278 } |
245 | 279 |
246 core.int buildCounterSource = 0; | 280 core.int buildCounterSource = 0; |
247 buildSource() { | 281 buildSource() { |
248 var o = new api.Source(); | 282 var o = new api.Source(); |
249 buildCounterSource++; | 283 buildCounterSource++; |
250 if (buildCounterSource < 3) { | 284 if (buildCounterSource < 3) { |
251 o.files = buildUnnamed2971(); | 285 o.files = buildUnnamed3078(); |
252 } | 286 } |
253 buildCounterSource--; | 287 buildCounterSource--; |
254 return o; | 288 return o; |
255 } | 289 } |
256 | 290 |
257 checkSource(api.Source o) { | 291 checkSource(api.Source o) { |
258 buildCounterSource++; | 292 buildCounterSource++; |
259 if (buildCounterSource < 3) { | 293 if (buildCounterSource < 3) { |
260 checkUnnamed2971(o.files); | 294 checkUnnamed3078(o.files); |
261 } | 295 } |
262 buildCounterSource--; | 296 buildCounterSource--; |
263 } | 297 } |
264 | 298 |
265 core.int buildCounterSourcePosition = 0; | 299 core.int buildCounterSourcePosition = 0; |
266 buildSourcePosition() { | 300 buildSourcePosition() { |
267 var o = new api.SourcePosition(); | 301 var o = new api.SourcePosition(); |
268 buildCounterSourcePosition++; | 302 buildCounterSourcePosition++; |
269 if (buildCounterSourcePosition < 3) { | 303 if (buildCounterSourcePosition < 3) { |
270 o.column = 42; | 304 o.column = 42; |
271 o.fileName = "foo"; | 305 o.fileName = "foo"; |
272 o.line = 42; | 306 o.line = 42; |
273 } | 307 } |
274 buildCounterSourcePosition--; | 308 buildCounterSourcePosition--; |
275 return o; | 309 return o; |
276 } | 310 } |
277 | 311 |
278 checkSourcePosition(api.SourcePosition o) { | 312 checkSourcePosition(api.SourcePosition o) { |
279 buildCounterSourcePosition++; | 313 buildCounterSourcePosition++; |
280 if (buildCounterSourcePosition < 3) { | 314 if (buildCounterSourcePosition < 3) { |
281 unittest.expect(o.column, unittest.equals(42)); | 315 unittest.expect(o.column, unittest.equals(42)); |
282 unittest.expect(o.fileName, unittest.equals('foo')); | 316 unittest.expect(o.fileName, unittest.equals('foo')); |
283 unittest.expect(o.line, unittest.equals(42)); | 317 unittest.expect(o.line, unittest.equals(42)); |
284 } | 318 } |
285 buildCounterSourcePosition--; | 319 buildCounterSourcePosition--; |
286 } | 320 } |
287 | 321 |
| 322 buildUnnamed3079() { |
| 323 var o = new core.List<core.String>(); |
| 324 o.add("foo"); |
| 325 o.add("foo"); |
| 326 return o; |
| 327 } |
| 328 |
| 329 checkUnnamed3079(core.List<core.String> o) { |
| 330 unittest.expect(o, unittest.hasLength(2)); |
| 331 unittest.expect(o[0], unittest.equals('foo')); |
| 332 unittest.expect(o[1], unittest.equals('foo')); |
| 333 } |
| 334 |
| 335 buildUnnamed3080() { |
| 336 var o = new core.List<api.FunctionCall>(); |
| 337 o.add(buildFunctionCall()); |
| 338 o.add(buildFunctionCall()); |
| 339 return o; |
| 340 } |
| 341 |
| 342 checkUnnamed3080(core.List<api.FunctionCall> o) { |
| 343 unittest.expect(o, unittest.hasLength(2)); |
| 344 checkFunctionCall(o[0]); |
| 345 checkFunctionCall(o[1]); |
| 346 } |
| 347 |
| 348 core.int buildCounterTestResult = 0; |
| 349 buildTestResult() { |
| 350 var o = new api.TestResult(); |
| 351 buildCounterTestResult++; |
| 352 if (buildCounterTestResult < 3) { |
| 353 o.debugMessages = buildUnnamed3079(); |
| 354 o.errorPosition = buildSourcePosition(); |
| 355 o.functionCalls = buildUnnamed3080(); |
| 356 o.state = "foo"; |
| 357 } |
| 358 buildCounterTestResult--; |
| 359 return o; |
| 360 } |
| 361 |
| 362 checkTestResult(api.TestResult o) { |
| 363 buildCounterTestResult++; |
| 364 if (buildCounterTestResult < 3) { |
| 365 checkUnnamed3079(o.debugMessages); |
| 366 checkSourcePosition(o.errorPosition); |
| 367 checkUnnamed3080(o.functionCalls); |
| 368 unittest.expect(o.state, unittest.equals('foo')); |
| 369 } |
| 370 buildCounterTestResult--; |
| 371 } |
| 372 |
288 core.int buildCounterTestRulesetRequest = 0; | 373 core.int buildCounterTestRulesetRequest = 0; |
289 buildTestRulesetRequest() { | 374 buildTestRulesetRequest() { |
290 var o = new api.TestRulesetRequest(); | 375 var o = new api.TestRulesetRequest(); |
291 buildCounterTestRulesetRequest++; | 376 buildCounterTestRulesetRequest++; |
292 if (buildCounterTestRulesetRequest < 3) { | 377 if (buildCounterTestRulesetRequest < 3) { |
293 o.source = buildSource(); | 378 o.source = buildSource(); |
294 } | 379 } |
295 buildCounterTestRulesetRequest--; | 380 buildCounterTestRulesetRequest--; |
296 return o; | 381 return o; |
297 } | 382 } |
298 | 383 |
299 checkTestRulesetRequest(api.TestRulesetRequest o) { | 384 checkTestRulesetRequest(api.TestRulesetRequest o) { |
300 buildCounterTestRulesetRequest++; | 385 buildCounterTestRulesetRequest++; |
301 if (buildCounterTestRulesetRequest < 3) { | 386 if (buildCounterTestRulesetRequest < 3) { |
302 checkSource(o.source); | 387 checkSource(o.source); |
303 } | 388 } |
304 buildCounterTestRulesetRequest--; | 389 buildCounterTestRulesetRequest--; |
305 } | 390 } |
306 | 391 |
307 buildUnnamed2972() { | 392 buildUnnamed3081() { |
308 var o = new core.List<api.Issue>(); | 393 var o = new core.List<api.Issue>(); |
309 o.add(buildIssue()); | 394 o.add(buildIssue()); |
310 o.add(buildIssue()); | 395 o.add(buildIssue()); |
311 return o; | 396 return o; |
312 } | 397 } |
313 | 398 |
314 checkUnnamed2972(core.List<api.Issue> o) { | 399 checkUnnamed3081(core.List<api.Issue> o) { |
315 unittest.expect(o, unittest.hasLength(2)); | 400 unittest.expect(o, unittest.hasLength(2)); |
316 checkIssue(o[0]); | 401 checkIssue(o[0]); |
317 checkIssue(o[1]); | 402 checkIssue(o[1]); |
318 } | 403 } |
319 | 404 |
| 405 buildUnnamed3082() { |
| 406 var o = new core.List<api.TestResult>(); |
| 407 o.add(buildTestResult()); |
| 408 o.add(buildTestResult()); |
| 409 return o; |
| 410 } |
| 411 |
| 412 checkUnnamed3082(core.List<api.TestResult> o) { |
| 413 unittest.expect(o, unittest.hasLength(2)); |
| 414 checkTestResult(o[0]); |
| 415 checkTestResult(o[1]); |
| 416 } |
| 417 |
320 core.int buildCounterTestRulesetResponse = 0; | 418 core.int buildCounterTestRulesetResponse = 0; |
321 buildTestRulesetResponse() { | 419 buildTestRulesetResponse() { |
322 var o = new api.TestRulesetResponse(); | 420 var o = new api.TestRulesetResponse(); |
323 buildCounterTestRulesetResponse++; | 421 buildCounterTestRulesetResponse++; |
324 if (buildCounterTestRulesetResponse < 3) { | 422 if (buildCounterTestRulesetResponse < 3) { |
325 o.issues = buildUnnamed2972(); | 423 o.issues = buildUnnamed3081(); |
| 424 o.testResults = buildUnnamed3082(); |
326 } | 425 } |
327 buildCounterTestRulesetResponse--; | 426 buildCounterTestRulesetResponse--; |
328 return o; | 427 return o; |
329 } | 428 } |
330 | 429 |
331 checkTestRulesetResponse(api.TestRulesetResponse o) { | 430 checkTestRulesetResponse(api.TestRulesetResponse o) { |
332 buildCounterTestRulesetResponse++; | 431 buildCounterTestRulesetResponse++; |
333 if (buildCounterTestRulesetResponse < 3) { | 432 if (buildCounterTestRulesetResponse < 3) { |
334 checkUnnamed2972(o.issues); | 433 checkUnnamed3081(o.issues); |
| 434 checkUnnamed3082(o.testResults); |
335 } | 435 } |
336 buildCounterTestRulesetResponse--; | 436 buildCounterTestRulesetResponse--; |
337 } | 437 } |
338 | 438 |
339 | 439 |
340 main() { | 440 main() { |
341 unittest.group("obj-schema-Empty", () { | 441 unittest.group("obj-schema-Empty", () { |
342 unittest.test("to-json--from-json", () { | 442 unittest.test("to-json--from-json", () { |
343 var o = buildEmpty(); | 443 var o = buildEmpty(); |
344 var od = new api.Empty.fromJson(o.toJson()); | 444 var od = new api.Empty.fromJson(o.toJson()); |
345 checkEmpty(od); | 445 checkEmpty(od); |
346 }); | 446 }); |
347 }); | 447 }); |
348 | 448 |
349 | 449 |
350 unittest.group("obj-schema-File", () { | 450 unittest.group("obj-schema-File", () { |
351 unittest.test("to-json--from-json", () { | 451 unittest.test("to-json--from-json", () { |
352 var o = buildFile(); | 452 var o = buildFile(); |
353 var od = new api.File.fromJson(o.toJson()); | 453 var od = new api.File.fromJson(o.toJson()); |
354 checkFile(od); | 454 checkFile(od); |
355 }); | 455 }); |
356 }); | 456 }); |
357 | 457 |
358 | 458 |
| 459 unittest.group("obj-schema-FunctionCall", () { |
| 460 unittest.test("to-json--from-json", () { |
| 461 var o = buildFunctionCall(); |
| 462 var od = new api.FunctionCall.fromJson(o.toJson()); |
| 463 checkFunctionCall(od); |
| 464 }); |
| 465 }); |
| 466 |
| 467 |
359 unittest.group("obj-schema-Issue", () { | 468 unittest.group("obj-schema-Issue", () { |
360 unittest.test("to-json--from-json", () { | 469 unittest.test("to-json--from-json", () { |
361 var o = buildIssue(); | 470 var o = buildIssue(); |
362 var od = new api.Issue.fromJson(o.toJson()); | 471 var od = new api.Issue.fromJson(o.toJson()); |
363 checkIssue(od); | 472 checkIssue(od); |
364 }); | 473 }); |
365 }); | 474 }); |
366 | 475 |
367 | 476 |
368 unittest.group("obj-schema-ListReleasesResponse", () { | 477 unittest.group("obj-schema-ListReleasesResponse", () { |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 | 521 |
413 unittest.group("obj-schema-SourcePosition", () { | 522 unittest.group("obj-schema-SourcePosition", () { |
414 unittest.test("to-json--from-json", () { | 523 unittest.test("to-json--from-json", () { |
415 var o = buildSourcePosition(); | 524 var o = buildSourcePosition(); |
416 var od = new api.SourcePosition.fromJson(o.toJson()); | 525 var od = new api.SourcePosition.fromJson(o.toJson()); |
417 checkSourcePosition(od); | 526 checkSourcePosition(od); |
418 }); | 527 }); |
419 }); | 528 }); |
420 | 529 |
421 | 530 |
| 531 unittest.group("obj-schema-TestResult", () { |
| 532 unittest.test("to-json--from-json", () { |
| 533 var o = buildTestResult(); |
| 534 var od = new api.TestResult.fromJson(o.toJson()); |
| 535 checkTestResult(od); |
| 536 }); |
| 537 }); |
| 538 |
| 539 |
422 unittest.group("obj-schema-TestRulesetRequest", () { | 540 unittest.group("obj-schema-TestRulesetRequest", () { |
423 unittest.test("to-json--from-json", () { | 541 unittest.test("to-json--from-json", () { |
424 var o = buildTestRulesetRequest(); | 542 var o = buildTestRulesetRequest(); |
425 var od = new api.TestRulesetRequest.fromJson(o.toJson()); | 543 var od = new api.TestRulesetRequest.fromJson(o.toJson()); |
426 checkTestRulesetRequest(od); | 544 checkTestRulesetRequest(od); |
427 }); | 545 }); |
428 }); | 546 }); |
429 | 547 |
430 | 548 |
431 unittest.group("obj-schema-TestRulesetResponse", () { | 549 unittest.group("obj-schema-TestRulesetResponse", () { |
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
871 res.get(arg_name).then(unittest.expectAsync(((api.Ruleset response) { | 989 res.get(arg_name).then(unittest.expectAsync(((api.Ruleset response) { |
872 checkRuleset(response); | 990 checkRuleset(response); |
873 }))); | 991 }))); |
874 }); | 992 }); |
875 | 993 |
876 unittest.test("method--list", () { | 994 unittest.test("method--list", () { |
877 | 995 |
878 var mock = new HttpServerMock(); | 996 var mock = new HttpServerMock(); |
879 api.ProjectsRulesetsResourceApi res = new api.FirebaserulesApi(mock).proje
cts.rulesets; | 997 api.ProjectsRulesetsResourceApi res = new api.FirebaserulesApi(mock).proje
cts.rulesets; |
880 var arg_name = "foo"; | 998 var arg_name = "foo"; |
| 999 var arg_filter = "foo"; |
881 var arg_pageToken = "foo"; | 1000 var arg_pageToken = "foo"; |
882 var arg_pageSize = 42; | 1001 var arg_pageSize = 42; |
883 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 1002 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
884 var path = (req.url).path; | 1003 var path = (req.url).path; |
885 var pathOffset = 0; | 1004 var pathOffset = 0; |
886 var index; | 1005 var index; |
887 var subPart; | 1006 var subPart; |
888 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1007 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
889 pathOffset += 1; | 1008 pathOffset += 1; |
890 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); | 1009 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); |
891 pathOffset += 3; | 1010 pathOffset += 3; |
892 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 1011 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
893 | 1012 |
894 var query = (req.url).query; | 1013 var query = (req.url).query; |
895 var queryOffset = 0; | 1014 var queryOffset = 0; |
896 var queryMap = {}; | 1015 var queryMap = {}; |
897 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1016 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
898 parseBool(n) { | 1017 parseBool(n) { |
899 if (n == "true") return true; | 1018 if (n == "true") return true; |
900 if (n == "false") return false; | 1019 if (n == "false") return false; |
901 if (n == null) return null; | 1020 if (n == null) return null; |
902 throw new core.ArgumentError("Invalid boolean: $n"); | 1021 throw new core.ArgumentError("Invalid boolean: $n"); |
903 } | 1022 } |
904 if (query.length > 0) { | 1023 if (query.length > 0) { |
905 for (var part in query.split("&")) { | 1024 for (var part in query.split("&")) { |
906 var keyvalue = part.split("="); | 1025 var keyvalue = part.split("="); |
907 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1026 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
908 } | 1027 } |
909 } | 1028 } |
| 1029 unittest.expect(queryMap["filter"].first, unittest.equals(arg_filter)); |
910 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); | 1030 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); |
911 unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equ
als(arg_pageSize)); | 1031 unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equ
als(arg_pageSize)); |
912 | 1032 |
913 | 1033 |
914 var h = { | 1034 var h = { |
915 "content-type" : "application/json; charset=utf-8", | 1035 "content-type" : "application/json; charset=utf-8", |
916 }; | 1036 }; |
917 var resp = convert.JSON.encode(buildListRulesetsResponse()); | 1037 var resp = convert.JSON.encode(buildListRulesetsResponse()); |
918 return new async.Future.value(stringResponse(200, h, resp)); | 1038 return new async.Future.value(stringResponse(200, h, resp)); |
919 }), true); | 1039 }), true); |
920 res.list(arg_name, pageToken: arg_pageToken, pageSize: arg_pageSize).then(
unittest.expectAsync(((api.ListRulesetsResponse response) { | 1040 res.list(arg_name, filter: arg_filter, pageToken: arg_pageToken, pageSize:
arg_pageSize).then(unittest.expectAsync(((api.ListRulesetsResponse response) { |
921 checkListRulesetsResponse(response); | 1041 checkListRulesetsResponse(response); |
922 }))); | 1042 }))); |
923 }); | 1043 }); |
924 | 1044 |
925 }); | 1045 }); |
926 | 1046 |
927 | 1047 |
928 } | 1048 } |
929 | 1049 |
OLD | NEW |