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; | |
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/firebaserules/v1.dart' as api; | 10 import 'package:googleapis/firebaserules/v1.dart' as api; |
13 | 11 |
14 class HttpServerMock extends http.BaseClient { | 12 class HttpServerMock extends http.BaseClient { |
15 core.Function _callback; | 13 core.Function _callback; |
16 core.bool _expectJson; | 14 core.bool _expectJson; |
17 | 15 |
18 void register(core.Function callback, core.bool expectJson) { | 16 void register(core.Function callback, core.bool expectJson) { |
19 _callback = callback; | 17 _callback = callback; |
20 _expectJson = expectJson; | 18 _expectJson = expectJson; |
21 } | 19 } |
22 | 20 |
23 async.Future<http.StreamedResponse> send(http.BaseRequest request) { | 21 async.Future<http.StreamedResponse> send(http.BaseRequest request) { |
24 if (_expectJson) { | 22 if (_expectJson) { |
25 return request.finalize() | 23 return request |
| 24 .finalize() |
26 .transform(convert.UTF8.decoder) | 25 .transform(convert.UTF8.decoder) |
27 .join('') | 26 .join('') |
28 .then((core.String jsonString) { | 27 .then((core.String jsonString) { |
29 if (jsonString.isEmpty) { | 28 if (jsonString.isEmpty) { |
30 return _callback(request, null); | 29 return _callback(request, null); |
31 } else { | 30 } else { |
32 return _callback(request, convert.JSON.decode(jsonString)); | 31 return _callback(request, convert.JSON.decode(jsonString)); |
33 } | 32 } |
34 }); | 33 }); |
35 } else { | 34 } else { |
36 var stream = request.finalize(); | 35 var stream = request.finalize(); |
37 if (stream == null) { | 36 if (stream == null) { |
38 return _callback(request, []); | 37 return _callback(request, []); |
39 } else { | 38 } else { |
40 return stream.toBytes().then((data) { | 39 return stream.toBytes().then((data) { |
41 return _callback(request, data); | 40 return _callback(request, data); |
42 }); | 41 }); |
43 } | 42 } |
44 } | 43 } |
45 } | 44 } |
46 } | 45 } |
47 | 46 |
48 http.StreamedResponse stringResponse( | 47 http.StreamedResponse stringResponse(core.int status, |
49 core.int status, core.Map<core.String, core.String> headers, core.String bod
y) { | 48 core.Map<core.String, core.String> headers, core.String body) { |
50 var stream = new async.Stream.fromIterable([convert.UTF8.encode(body)]); | 49 var stream = new async.Stream.fromIterable([convert.UTF8.encode(body)]); |
51 return new http.StreamedResponse(stream, status, headers: headers); | 50 return new http.StreamedResponse(stream, status, headers: headers); |
52 } | 51 } |
53 | 52 |
54 core.int buildCounterArg = 0; | 53 core.int buildCounterArg = 0; |
55 buildArg() { | 54 buildArg() { |
56 var o = new api.Arg(); | 55 var o = new api.Arg(); |
57 buildCounterArg++; | 56 buildCounterArg++; |
58 if (buildCounterArg < 3) { | 57 if (buildCounterArg < 3) { |
59 o.anyValue = buildEmpty(); | 58 o.anyValue = buildEmpty(); |
60 o.exactValue = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; | 59 o.exactValue = { |
| 60 'list': [1, 2, 3], |
| 61 'bool': true, |
| 62 'string': 'foo' |
| 63 }; |
61 } | 64 } |
62 buildCounterArg--; | 65 buildCounterArg--; |
63 return o; | 66 return o; |
64 } | 67 } |
65 | 68 |
66 checkArg(api.Arg o) { | 69 checkArg(api.Arg o) { |
67 buildCounterArg++; | 70 buildCounterArg++; |
68 if (buildCounterArg < 3) { | 71 if (buildCounterArg < 3) { |
69 checkEmpty(o.anyValue); | 72 checkEmpty(o.anyValue); |
70 var casted1 = (o.exactValue) as core.Map; unittest.expect(casted1, unittest.
hasLength(3)); unittest.expect(casted1["list"], unittest.equals([1, 2, 3])); uni
ttest.expect(casted1["bool"], unittest.equals(true)); unittest.expect(casted1["s
tring"], unittest.equals('foo')); | 73 var casted1 = (o.exactValue) as core.Map; |
| 74 unittest.expect(casted1, unittest.hasLength(3)); |
| 75 unittest.expect(casted1["list"], unittest.equals([1, 2, 3])); |
| 76 unittest.expect(casted1["bool"], unittest.equals(true)); |
| 77 unittest.expect(casted1["string"], unittest.equals('foo')); |
71 } | 78 } |
72 buildCounterArg--; | 79 buildCounterArg--; |
73 } | 80 } |
74 | 81 |
75 core.int buildCounterEmpty = 0; | 82 core.int buildCounterEmpty = 0; |
76 buildEmpty() { | 83 buildEmpty() { |
77 var o = new api.Empty(); | 84 var o = new api.Empty(); |
78 buildCounterEmpty++; | 85 buildCounterEmpty++; |
79 if (buildCounterEmpty < 3) { | 86 if (buildCounterEmpty < 3) {} |
80 } | |
81 buildCounterEmpty--; | 87 buildCounterEmpty--; |
82 return o; | 88 return o; |
83 } | 89 } |
84 | 90 |
85 checkEmpty(api.Empty o) { | 91 checkEmpty(api.Empty o) { |
86 buildCounterEmpty++; | 92 buildCounterEmpty++; |
87 if (buildCounterEmpty < 3) { | 93 if (buildCounterEmpty < 3) {} |
88 } | |
89 buildCounterEmpty--; | 94 buildCounterEmpty--; |
90 } | 95 } |
91 | 96 |
92 core.int buildCounterFile = 0; | 97 core.int buildCounterFile = 0; |
93 buildFile() { | 98 buildFile() { |
94 var o = new api.File(); | 99 var o = new api.File(); |
95 buildCounterFile++; | 100 buildCounterFile++; |
96 if (buildCounterFile < 3) { | 101 if (buildCounterFile < 3) { |
97 o.content = "foo"; | 102 o.content = "foo"; |
98 o.fingerprint = "foo"; | 103 o.fingerprint = "foo"; |
99 o.name = "foo"; | 104 o.name = "foo"; |
100 } | 105 } |
101 buildCounterFile--; | 106 buildCounterFile--; |
102 return o; | 107 return o; |
103 } | 108 } |
104 | 109 |
105 checkFile(api.File o) { | 110 checkFile(api.File o) { |
106 buildCounterFile++; | 111 buildCounterFile++; |
107 if (buildCounterFile < 3) { | 112 if (buildCounterFile < 3) { |
108 unittest.expect(o.content, unittest.equals('foo')); | 113 unittest.expect(o.content, unittest.equals('foo')); |
109 unittest.expect(o.fingerprint, unittest.equals('foo')); | 114 unittest.expect(o.fingerprint, unittest.equals('foo')); |
110 unittest.expect(o.name, unittest.equals('foo')); | 115 unittest.expect(o.name, unittest.equals('foo')); |
111 } | 116 } |
112 buildCounterFile--; | 117 buildCounterFile--; |
113 } | 118 } |
114 | 119 |
115 buildUnnamed3079() { | 120 buildUnnamed3072() { |
116 var o = new core.List<core.Object>(); | 121 var o = new core.List<core.Object>(); |
117 o.add({'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}); | 122 o.add({ |
118 o.add({'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}); | 123 'list': [1, 2, 3], |
| 124 'bool': true, |
| 125 'string': 'foo' |
| 126 }); |
| 127 o.add({ |
| 128 'list': [1, 2, 3], |
| 129 'bool': true, |
| 130 'string': 'foo' |
| 131 }); |
119 return o; | 132 return o; |
120 } | 133 } |
121 | 134 |
122 checkUnnamed3079(core.List<core.Object> o) { | 135 checkUnnamed3072(core.List<core.Object> o) { |
123 unittest.expect(o, unittest.hasLength(2)); | 136 unittest.expect(o, unittest.hasLength(2)); |
124 var casted2 = (o[0]) 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')); | 137 var casted2 = (o[0]) as core.Map; |
125 var casted3 = (o[1]) as core.Map; unittest.expect(casted3, unittest.hasLength(
3)); unittest.expect(casted3["list"], unittest.equals([1, 2, 3])); unittest.expe
ct(casted3["bool"], unittest.equals(true)); unittest.expect(casted3["string"], u
nittest.equals('foo')); | 138 unittest.expect(casted2, unittest.hasLength(3)); |
| 139 unittest.expect(casted2["list"], unittest.equals([1, 2, 3])); |
| 140 unittest.expect(casted2["bool"], unittest.equals(true)); |
| 141 unittest.expect(casted2["string"], unittest.equals('foo')); |
| 142 var casted3 = (o[1]) as core.Map; |
| 143 unittest.expect(casted3, unittest.hasLength(3)); |
| 144 unittest.expect(casted3["list"], unittest.equals([1, 2, 3])); |
| 145 unittest.expect(casted3["bool"], unittest.equals(true)); |
| 146 unittest.expect(casted3["string"], unittest.equals('foo')); |
126 } | 147 } |
127 | 148 |
128 core.int buildCounterFunctionCall = 0; | 149 core.int buildCounterFunctionCall = 0; |
129 buildFunctionCall() { | 150 buildFunctionCall() { |
130 var o = new api.FunctionCall(); | 151 var o = new api.FunctionCall(); |
131 buildCounterFunctionCall++; | 152 buildCounterFunctionCall++; |
132 if (buildCounterFunctionCall < 3) { | 153 if (buildCounterFunctionCall < 3) { |
133 o.args = buildUnnamed3079(); | 154 o.args = buildUnnamed3072(); |
134 o.function = "foo"; | 155 o.function = "foo"; |
135 } | 156 } |
136 buildCounterFunctionCall--; | 157 buildCounterFunctionCall--; |
137 return o; | 158 return o; |
138 } | 159 } |
139 | 160 |
140 checkFunctionCall(api.FunctionCall o) { | 161 checkFunctionCall(api.FunctionCall o) { |
141 buildCounterFunctionCall++; | 162 buildCounterFunctionCall++; |
142 if (buildCounterFunctionCall < 3) { | 163 if (buildCounterFunctionCall < 3) { |
143 checkUnnamed3079(o.args); | 164 checkUnnamed3072(o.args); |
144 unittest.expect(o.function, unittest.equals('foo')); | 165 unittest.expect(o.function, unittest.equals('foo')); |
145 } | 166 } |
146 buildCounterFunctionCall--; | 167 buildCounterFunctionCall--; |
147 } | 168 } |
148 | 169 |
149 buildUnnamed3080() { | 170 buildUnnamed3073() { |
150 var o = new core.List<api.Arg>(); | 171 var o = new core.List<api.Arg>(); |
151 o.add(buildArg()); | 172 o.add(buildArg()); |
152 o.add(buildArg()); | 173 o.add(buildArg()); |
153 return o; | 174 return o; |
154 } | 175 } |
155 | 176 |
156 checkUnnamed3080(core.List<api.Arg> o) { | 177 checkUnnamed3073(core.List<api.Arg> o) { |
157 unittest.expect(o, unittest.hasLength(2)); | 178 unittest.expect(o, unittest.hasLength(2)); |
158 checkArg(o[0]); | 179 checkArg(o[0]); |
159 checkArg(o[1]); | 180 checkArg(o[1]); |
160 } | 181 } |
161 | 182 |
162 core.int buildCounterFunctionMock = 0; | 183 core.int buildCounterFunctionMock = 0; |
163 buildFunctionMock() { | 184 buildFunctionMock() { |
164 var o = new api.FunctionMock(); | 185 var o = new api.FunctionMock(); |
165 buildCounterFunctionMock++; | 186 buildCounterFunctionMock++; |
166 if (buildCounterFunctionMock < 3) { | 187 if (buildCounterFunctionMock < 3) { |
167 o.args = buildUnnamed3080(); | 188 o.args = buildUnnamed3073(); |
168 o.function = "foo"; | 189 o.function = "foo"; |
169 o.result = buildResult(); | 190 o.result = buildResult(); |
170 } | 191 } |
171 buildCounterFunctionMock--; | 192 buildCounterFunctionMock--; |
172 return o; | 193 return o; |
173 } | 194 } |
174 | 195 |
175 checkFunctionMock(api.FunctionMock o) { | 196 checkFunctionMock(api.FunctionMock o) { |
176 buildCounterFunctionMock++; | 197 buildCounterFunctionMock++; |
177 if (buildCounterFunctionMock < 3) { | 198 if (buildCounterFunctionMock < 3) { |
178 checkUnnamed3080(o.args); | 199 checkUnnamed3073(o.args); |
179 unittest.expect(o.function, unittest.equals('foo')); | 200 unittest.expect(o.function, unittest.equals('foo')); |
180 checkResult(o.result); | 201 checkResult(o.result); |
181 } | 202 } |
182 buildCounterFunctionMock--; | 203 buildCounterFunctionMock--; |
183 } | 204 } |
184 | 205 |
185 core.int buildCounterIssue = 0; | 206 core.int buildCounterIssue = 0; |
186 buildIssue() { | 207 buildIssue() { |
187 var o = new api.Issue(); | 208 var o = new api.Issue(); |
188 buildCounterIssue++; | 209 buildCounterIssue++; |
189 if (buildCounterIssue < 3) { | 210 if (buildCounterIssue < 3) { |
190 o.description = "foo"; | 211 o.description = "foo"; |
191 o.severity = "foo"; | 212 o.severity = "foo"; |
192 o.sourcePosition = buildSourcePosition(); | 213 o.sourcePosition = buildSourcePosition(); |
193 } | 214 } |
194 buildCounterIssue--; | 215 buildCounterIssue--; |
195 return o; | 216 return o; |
196 } | 217 } |
197 | 218 |
198 checkIssue(api.Issue o) { | 219 checkIssue(api.Issue o) { |
199 buildCounterIssue++; | 220 buildCounterIssue++; |
200 if (buildCounterIssue < 3) { | 221 if (buildCounterIssue < 3) { |
201 unittest.expect(o.description, unittest.equals('foo')); | 222 unittest.expect(o.description, unittest.equals('foo')); |
202 unittest.expect(o.severity, unittest.equals('foo')); | 223 unittest.expect(o.severity, unittest.equals('foo')); |
203 checkSourcePosition(o.sourcePosition); | 224 checkSourcePosition(o.sourcePosition); |
204 } | 225 } |
205 buildCounterIssue--; | 226 buildCounterIssue--; |
206 } | 227 } |
207 | 228 |
208 buildUnnamed3081() { | 229 buildUnnamed3074() { |
209 var o = new core.List<api.Release>(); | 230 var o = new core.List<api.Release>(); |
210 o.add(buildRelease()); | 231 o.add(buildRelease()); |
211 o.add(buildRelease()); | 232 o.add(buildRelease()); |
212 return o; | 233 return o; |
213 } | 234 } |
214 | 235 |
215 checkUnnamed3081(core.List<api.Release> o) { | 236 checkUnnamed3074(core.List<api.Release> o) { |
216 unittest.expect(o, unittest.hasLength(2)); | 237 unittest.expect(o, unittest.hasLength(2)); |
217 checkRelease(o[0]); | 238 checkRelease(o[0]); |
218 checkRelease(o[1]); | 239 checkRelease(o[1]); |
219 } | 240 } |
220 | 241 |
221 core.int buildCounterListReleasesResponse = 0; | 242 core.int buildCounterListReleasesResponse = 0; |
222 buildListReleasesResponse() { | 243 buildListReleasesResponse() { |
223 var o = new api.ListReleasesResponse(); | 244 var o = new api.ListReleasesResponse(); |
224 buildCounterListReleasesResponse++; | 245 buildCounterListReleasesResponse++; |
225 if (buildCounterListReleasesResponse < 3) { | 246 if (buildCounterListReleasesResponse < 3) { |
226 o.nextPageToken = "foo"; | 247 o.nextPageToken = "foo"; |
227 o.releases = buildUnnamed3081(); | 248 o.releases = buildUnnamed3074(); |
228 } | 249 } |
229 buildCounterListReleasesResponse--; | 250 buildCounterListReleasesResponse--; |
230 return o; | 251 return o; |
231 } | 252 } |
232 | 253 |
233 checkListReleasesResponse(api.ListReleasesResponse o) { | 254 checkListReleasesResponse(api.ListReleasesResponse o) { |
234 buildCounterListReleasesResponse++; | 255 buildCounterListReleasesResponse++; |
235 if (buildCounterListReleasesResponse < 3) { | 256 if (buildCounterListReleasesResponse < 3) { |
236 unittest.expect(o.nextPageToken, unittest.equals('foo')); | 257 unittest.expect(o.nextPageToken, unittest.equals('foo')); |
237 checkUnnamed3081(o.releases); | 258 checkUnnamed3074(o.releases); |
238 } | 259 } |
239 buildCounterListReleasesResponse--; | 260 buildCounterListReleasesResponse--; |
240 } | 261 } |
241 | 262 |
242 buildUnnamed3082() { | 263 buildUnnamed3075() { |
243 var o = new core.List<api.Ruleset>(); | 264 var o = new core.List<api.Ruleset>(); |
244 o.add(buildRuleset()); | 265 o.add(buildRuleset()); |
245 o.add(buildRuleset()); | 266 o.add(buildRuleset()); |
246 return o; | 267 return o; |
247 } | 268 } |
248 | 269 |
249 checkUnnamed3082(core.List<api.Ruleset> o) { | 270 checkUnnamed3075(core.List<api.Ruleset> o) { |
250 unittest.expect(o, unittest.hasLength(2)); | 271 unittest.expect(o, unittest.hasLength(2)); |
251 checkRuleset(o[0]); | 272 checkRuleset(o[0]); |
252 checkRuleset(o[1]); | 273 checkRuleset(o[1]); |
253 } | 274 } |
254 | 275 |
255 core.int buildCounterListRulesetsResponse = 0; | 276 core.int buildCounterListRulesetsResponse = 0; |
256 buildListRulesetsResponse() { | 277 buildListRulesetsResponse() { |
257 var o = new api.ListRulesetsResponse(); | 278 var o = new api.ListRulesetsResponse(); |
258 buildCounterListRulesetsResponse++; | 279 buildCounterListRulesetsResponse++; |
259 if (buildCounterListRulesetsResponse < 3) { | 280 if (buildCounterListRulesetsResponse < 3) { |
260 o.nextPageToken = "foo"; | 281 o.nextPageToken = "foo"; |
261 o.rulesets = buildUnnamed3082(); | 282 o.rulesets = buildUnnamed3075(); |
262 } | 283 } |
263 buildCounterListRulesetsResponse--; | 284 buildCounterListRulesetsResponse--; |
264 return o; | 285 return o; |
265 } | 286 } |
266 | 287 |
267 checkListRulesetsResponse(api.ListRulesetsResponse o) { | 288 checkListRulesetsResponse(api.ListRulesetsResponse o) { |
268 buildCounterListRulesetsResponse++; | 289 buildCounterListRulesetsResponse++; |
269 if (buildCounterListRulesetsResponse < 3) { | 290 if (buildCounterListRulesetsResponse < 3) { |
270 unittest.expect(o.nextPageToken, unittest.equals('foo')); | 291 unittest.expect(o.nextPageToken, unittest.equals('foo')); |
271 checkUnnamed3082(o.rulesets); | 292 checkUnnamed3075(o.rulesets); |
272 } | 293 } |
273 buildCounterListRulesetsResponse--; | 294 buildCounterListRulesetsResponse--; |
274 } | 295 } |
275 | 296 |
276 core.int buildCounterRelease = 0; | 297 core.int buildCounterRelease = 0; |
277 buildRelease() { | 298 buildRelease() { |
278 var o = new api.Release(); | 299 var o = new api.Release(); |
279 buildCounterRelease++; | 300 buildCounterRelease++; |
280 if (buildCounterRelease < 3) { | 301 if (buildCounterRelease < 3) { |
281 o.createTime = "foo"; | 302 o.createTime = "foo"; |
(...skipping 15 matching lines...) Expand all Loading... |
297 } | 318 } |
298 buildCounterRelease--; | 319 buildCounterRelease--; |
299 } | 320 } |
300 | 321 |
301 core.int buildCounterResult = 0; | 322 core.int buildCounterResult = 0; |
302 buildResult() { | 323 buildResult() { |
303 var o = new api.Result(); | 324 var o = new api.Result(); |
304 buildCounterResult++; | 325 buildCounterResult++; |
305 if (buildCounterResult < 3) { | 326 if (buildCounterResult < 3) { |
306 o.undefined = buildEmpty(); | 327 o.undefined = buildEmpty(); |
307 o.value = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; | 328 o.value = { |
| 329 'list': [1, 2, 3], |
| 330 'bool': true, |
| 331 'string': 'foo' |
| 332 }; |
308 } | 333 } |
309 buildCounterResult--; | 334 buildCounterResult--; |
310 return o; | 335 return o; |
311 } | 336 } |
312 | 337 |
313 checkResult(api.Result o) { | 338 checkResult(api.Result o) { |
314 buildCounterResult++; | 339 buildCounterResult++; |
315 if (buildCounterResult < 3) { | 340 if (buildCounterResult < 3) { |
316 checkEmpty(o.undefined); | 341 checkEmpty(o.undefined); |
317 var casted4 = (o.value) as core.Map; unittest.expect(casted4, unittest.hasLe
ngth(3)); unittest.expect(casted4["list"], unittest.equals([1, 2, 3])); unittest
.expect(casted4["bool"], unittest.equals(true)); unittest.expect(casted4["string
"], unittest.equals('foo')); | 342 var casted4 = (o.value) as core.Map; |
| 343 unittest.expect(casted4, unittest.hasLength(3)); |
| 344 unittest.expect(casted4["list"], unittest.equals([1, 2, 3])); |
| 345 unittest.expect(casted4["bool"], unittest.equals(true)); |
| 346 unittest.expect(casted4["string"], unittest.equals('foo')); |
318 } | 347 } |
319 buildCounterResult--; | 348 buildCounterResult--; |
320 } | 349 } |
321 | 350 |
322 core.int buildCounterRuleset = 0; | 351 core.int buildCounterRuleset = 0; |
323 buildRuleset() { | 352 buildRuleset() { |
324 var o = new api.Ruleset(); | 353 var o = new api.Ruleset(); |
325 buildCounterRuleset++; | 354 buildCounterRuleset++; |
326 if (buildCounterRuleset < 3) { | 355 if (buildCounterRuleset < 3) { |
327 o.createTime = "foo"; | 356 o.createTime = "foo"; |
328 o.name = "foo"; | 357 o.name = "foo"; |
329 o.source = buildSource(); | 358 o.source = buildSource(); |
330 } | 359 } |
331 buildCounterRuleset--; | 360 buildCounterRuleset--; |
332 return o; | 361 return o; |
333 } | 362 } |
334 | 363 |
335 checkRuleset(api.Ruleset o) { | 364 checkRuleset(api.Ruleset o) { |
336 buildCounterRuleset++; | 365 buildCounterRuleset++; |
337 if (buildCounterRuleset < 3) { | 366 if (buildCounterRuleset < 3) { |
338 unittest.expect(o.createTime, unittest.equals('foo')); | 367 unittest.expect(o.createTime, unittest.equals('foo')); |
339 unittest.expect(o.name, unittest.equals('foo')); | 368 unittest.expect(o.name, unittest.equals('foo')); |
340 checkSource(o.source); | 369 checkSource(o.source); |
341 } | 370 } |
342 buildCounterRuleset--; | 371 buildCounterRuleset--; |
343 } | 372 } |
344 | 373 |
345 buildUnnamed3083() { | 374 buildUnnamed3076() { |
346 var o = new core.List<api.File>(); | 375 var o = new core.List<api.File>(); |
347 o.add(buildFile()); | 376 o.add(buildFile()); |
348 o.add(buildFile()); | 377 o.add(buildFile()); |
349 return o; | 378 return o; |
350 } | 379 } |
351 | 380 |
352 checkUnnamed3083(core.List<api.File> o) { | 381 checkUnnamed3076(core.List<api.File> o) { |
353 unittest.expect(o, unittest.hasLength(2)); | 382 unittest.expect(o, unittest.hasLength(2)); |
354 checkFile(o[0]); | 383 checkFile(o[0]); |
355 checkFile(o[1]); | 384 checkFile(o[1]); |
356 } | 385 } |
357 | 386 |
358 core.int buildCounterSource = 0; | 387 core.int buildCounterSource = 0; |
359 buildSource() { | 388 buildSource() { |
360 var o = new api.Source(); | 389 var o = new api.Source(); |
361 buildCounterSource++; | 390 buildCounterSource++; |
362 if (buildCounterSource < 3) { | 391 if (buildCounterSource < 3) { |
363 o.files = buildUnnamed3083(); | 392 o.files = buildUnnamed3076(); |
364 } | 393 } |
365 buildCounterSource--; | 394 buildCounterSource--; |
366 return o; | 395 return o; |
367 } | 396 } |
368 | 397 |
369 checkSource(api.Source o) { | 398 checkSource(api.Source o) { |
370 buildCounterSource++; | 399 buildCounterSource++; |
371 if (buildCounterSource < 3) { | 400 if (buildCounterSource < 3) { |
372 checkUnnamed3083(o.files); | 401 checkUnnamed3076(o.files); |
373 } | 402 } |
374 buildCounterSource--; | 403 buildCounterSource--; |
375 } | 404 } |
376 | 405 |
377 core.int buildCounterSourcePosition = 0; | 406 core.int buildCounterSourcePosition = 0; |
378 buildSourcePosition() { | 407 buildSourcePosition() { |
379 var o = new api.SourcePosition(); | 408 var o = new api.SourcePosition(); |
380 buildCounterSourcePosition++; | 409 buildCounterSourcePosition++; |
381 if (buildCounterSourcePosition < 3) { | 410 if (buildCounterSourcePosition < 3) { |
382 o.column = 42; | 411 o.column = 42; |
383 o.fileName = "foo"; | 412 o.fileName = "foo"; |
384 o.line = 42; | 413 o.line = 42; |
385 } | 414 } |
386 buildCounterSourcePosition--; | 415 buildCounterSourcePosition--; |
387 return o; | 416 return o; |
388 } | 417 } |
389 | 418 |
390 checkSourcePosition(api.SourcePosition o) { | 419 checkSourcePosition(api.SourcePosition o) { |
391 buildCounterSourcePosition++; | 420 buildCounterSourcePosition++; |
392 if (buildCounterSourcePosition < 3) { | 421 if (buildCounterSourcePosition < 3) { |
393 unittest.expect(o.column, unittest.equals(42)); | 422 unittest.expect(o.column, unittest.equals(42)); |
394 unittest.expect(o.fileName, unittest.equals('foo')); | 423 unittest.expect(o.fileName, unittest.equals('foo')); |
395 unittest.expect(o.line, unittest.equals(42)); | 424 unittest.expect(o.line, unittest.equals(42)); |
396 } | 425 } |
397 buildCounterSourcePosition--; | 426 buildCounterSourcePosition--; |
398 } | 427 } |
399 | 428 |
400 buildUnnamed3084() { | 429 buildUnnamed3077() { |
401 var o = new core.List<api.FunctionMock>(); | 430 var o = new core.List<api.FunctionMock>(); |
402 o.add(buildFunctionMock()); | 431 o.add(buildFunctionMock()); |
403 o.add(buildFunctionMock()); | 432 o.add(buildFunctionMock()); |
404 return o; | 433 return o; |
405 } | 434 } |
406 | 435 |
407 checkUnnamed3084(core.List<api.FunctionMock> o) { | 436 checkUnnamed3077(core.List<api.FunctionMock> o) { |
408 unittest.expect(o, unittest.hasLength(2)); | 437 unittest.expect(o, unittest.hasLength(2)); |
409 checkFunctionMock(o[0]); | 438 checkFunctionMock(o[0]); |
410 checkFunctionMock(o[1]); | 439 checkFunctionMock(o[1]); |
411 } | 440 } |
412 | 441 |
413 core.int buildCounterTestCase = 0; | 442 core.int buildCounterTestCase = 0; |
414 buildTestCase() { | 443 buildTestCase() { |
415 var o = new api.TestCase(); | 444 var o = new api.TestCase(); |
416 buildCounterTestCase++; | 445 buildCounterTestCase++; |
417 if (buildCounterTestCase < 3) { | 446 if (buildCounterTestCase < 3) { |
418 o.expectation = "foo"; | 447 o.expectation = "foo"; |
419 o.functionMocks = buildUnnamed3084(); | 448 o.functionMocks = buildUnnamed3077(); |
420 o.request = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; | 449 o.request = { |
421 o.resource = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; | 450 'list': [1, 2, 3], |
| 451 'bool': true, |
| 452 'string': 'foo' |
| 453 }; |
| 454 o.resource = { |
| 455 'list': [1, 2, 3], |
| 456 'bool': true, |
| 457 'string': 'foo' |
| 458 }; |
422 } | 459 } |
423 buildCounterTestCase--; | 460 buildCounterTestCase--; |
424 return o; | 461 return o; |
425 } | 462 } |
426 | 463 |
427 checkTestCase(api.TestCase o) { | 464 checkTestCase(api.TestCase o) { |
428 buildCounterTestCase++; | 465 buildCounterTestCase++; |
429 if (buildCounterTestCase < 3) { | 466 if (buildCounterTestCase < 3) { |
430 unittest.expect(o.expectation, unittest.equals('foo')); | 467 unittest.expect(o.expectation, unittest.equals('foo')); |
431 checkUnnamed3084(o.functionMocks); | 468 checkUnnamed3077(o.functionMocks); |
432 var casted5 = (o.request) as core.Map; unittest.expect(casted5, unittest.has
Length(3)); unittest.expect(casted5["list"], unittest.equals([1, 2, 3])); unitte
st.expect(casted5["bool"], unittest.equals(true)); unittest.expect(casted5["stri
ng"], unittest.equals('foo')); | 469 var casted5 = (o.request) as core.Map; |
433 var casted6 = (o.resource) as core.Map; unittest.expect(casted6, unittest.ha
sLength(3)); unittest.expect(casted6["list"], unittest.equals([1, 2, 3])); unitt
est.expect(casted6["bool"], unittest.equals(true)); unittest.expect(casted6["str
ing"], unittest.equals('foo')); | 470 unittest.expect(casted5, unittest.hasLength(3)); |
| 471 unittest.expect(casted5["list"], unittest.equals([1, 2, 3])); |
| 472 unittest.expect(casted5["bool"], unittest.equals(true)); |
| 473 unittest.expect(casted5["string"], unittest.equals('foo')); |
| 474 var casted6 = (o.resource) as core.Map; |
| 475 unittest.expect(casted6, unittest.hasLength(3)); |
| 476 unittest.expect(casted6["list"], unittest.equals([1, 2, 3])); |
| 477 unittest.expect(casted6["bool"], unittest.equals(true)); |
| 478 unittest.expect(casted6["string"], unittest.equals('foo')); |
434 } | 479 } |
435 buildCounterTestCase--; | 480 buildCounterTestCase--; |
436 } | 481 } |
437 | 482 |
438 buildUnnamed3085() { | 483 buildUnnamed3078() { |
439 var o = new core.List<core.String>(); | 484 var o = new core.List<core.String>(); |
440 o.add("foo"); | 485 o.add("foo"); |
441 o.add("foo"); | 486 o.add("foo"); |
442 return o; | 487 return o; |
443 } | 488 } |
444 | 489 |
445 checkUnnamed3085(core.List<core.String> o) { | 490 checkUnnamed3078(core.List<core.String> o) { |
446 unittest.expect(o, unittest.hasLength(2)); | 491 unittest.expect(o, unittest.hasLength(2)); |
447 unittest.expect(o[0], unittest.equals('foo')); | 492 unittest.expect(o[0], unittest.equals('foo')); |
448 unittest.expect(o[1], unittest.equals('foo')); | 493 unittest.expect(o[1], unittest.equals('foo')); |
449 } | 494 } |
450 | 495 |
451 buildUnnamed3086() { | 496 buildUnnamed3079() { |
452 var o = new core.List<api.FunctionCall>(); | 497 var o = new core.List<api.FunctionCall>(); |
453 o.add(buildFunctionCall()); | 498 o.add(buildFunctionCall()); |
454 o.add(buildFunctionCall()); | 499 o.add(buildFunctionCall()); |
455 return o; | 500 return o; |
456 } | 501 } |
457 | 502 |
458 checkUnnamed3086(core.List<api.FunctionCall> o) { | 503 checkUnnamed3079(core.List<api.FunctionCall> o) { |
459 unittest.expect(o, unittest.hasLength(2)); | 504 unittest.expect(o, unittest.hasLength(2)); |
460 checkFunctionCall(o[0]); | 505 checkFunctionCall(o[0]); |
461 checkFunctionCall(o[1]); | 506 checkFunctionCall(o[1]); |
462 } | 507 } |
463 | 508 |
464 core.int buildCounterTestResult = 0; | 509 core.int buildCounterTestResult = 0; |
465 buildTestResult() { | 510 buildTestResult() { |
466 var o = new api.TestResult(); | 511 var o = new api.TestResult(); |
467 buildCounterTestResult++; | 512 buildCounterTestResult++; |
468 if (buildCounterTestResult < 3) { | 513 if (buildCounterTestResult < 3) { |
469 o.debugMessages = buildUnnamed3085(); | 514 o.debugMessages = buildUnnamed3078(); |
470 o.errorPosition = buildSourcePosition(); | 515 o.errorPosition = buildSourcePosition(); |
471 o.functionCalls = buildUnnamed3086(); | 516 o.functionCalls = buildUnnamed3079(); |
472 o.state = "foo"; | 517 o.state = "foo"; |
473 } | 518 } |
474 buildCounterTestResult--; | 519 buildCounterTestResult--; |
475 return o; | 520 return o; |
476 } | 521 } |
477 | 522 |
478 checkTestResult(api.TestResult o) { | 523 checkTestResult(api.TestResult o) { |
479 buildCounterTestResult++; | 524 buildCounterTestResult++; |
480 if (buildCounterTestResult < 3) { | 525 if (buildCounterTestResult < 3) { |
481 checkUnnamed3085(o.debugMessages); | 526 checkUnnamed3078(o.debugMessages); |
482 checkSourcePosition(o.errorPosition); | 527 checkSourcePosition(o.errorPosition); |
483 checkUnnamed3086(o.functionCalls); | 528 checkUnnamed3079(o.functionCalls); |
484 unittest.expect(o.state, unittest.equals('foo')); | 529 unittest.expect(o.state, unittest.equals('foo')); |
485 } | 530 } |
486 buildCounterTestResult--; | 531 buildCounterTestResult--; |
487 } | 532 } |
488 | 533 |
489 core.int buildCounterTestRulesetRequest = 0; | 534 core.int buildCounterTestRulesetRequest = 0; |
490 buildTestRulesetRequest() { | 535 buildTestRulesetRequest() { |
491 var o = new api.TestRulesetRequest(); | 536 var o = new api.TestRulesetRequest(); |
492 buildCounterTestRulesetRequest++; | 537 buildCounterTestRulesetRequest++; |
493 if (buildCounterTestRulesetRequest < 3) { | 538 if (buildCounterTestRulesetRequest < 3) { |
494 o.source = buildSource(); | 539 o.source = buildSource(); |
495 o.testSuite = buildTestSuite(); | 540 o.testSuite = buildTestSuite(); |
496 } | 541 } |
497 buildCounterTestRulesetRequest--; | 542 buildCounterTestRulesetRequest--; |
498 return o; | 543 return o; |
499 } | 544 } |
500 | 545 |
501 checkTestRulesetRequest(api.TestRulesetRequest o) { | 546 checkTestRulesetRequest(api.TestRulesetRequest o) { |
502 buildCounterTestRulesetRequest++; | 547 buildCounterTestRulesetRequest++; |
503 if (buildCounterTestRulesetRequest < 3) { | 548 if (buildCounterTestRulesetRequest < 3) { |
504 checkSource(o.source); | 549 checkSource(o.source); |
505 checkTestSuite(o.testSuite); | 550 checkTestSuite(o.testSuite); |
506 } | 551 } |
507 buildCounterTestRulesetRequest--; | 552 buildCounterTestRulesetRequest--; |
508 } | 553 } |
509 | 554 |
510 buildUnnamed3087() { | 555 buildUnnamed3080() { |
511 var o = new core.List<api.Issue>(); | 556 var o = new core.List<api.Issue>(); |
512 o.add(buildIssue()); | 557 o.add(buildIssue()); |
513 o.add(buildIssue()); | 558 o.add(buildIssue()); |
514 return o; | 559 return o; |
515 } | 560 } |
516 | 561 |
517 checkUnnamed3087(core.List<api.Issue> o) { | 562 checkUnnamed3080(core.List<api.Issue> o) { |
518 unittest.expect(o, unittest.hasLength(2)); | 563 unittest.expect(o, unittest.hasLength(2)); |
519 checkIssue(o[0]); | 564 checkIssue(o[0]); |
520 checkIssue(o[1]); | 565 checkIssue(o[1]); |
521 } | 566 } |
522 | 567 |
523 buildUnnamed3088() { | 568 buildUnnamed3081() { |
524 var o = new core.List<api.TestResult>(); | 569 var o = new core.List<api.TestResult>(); |
525 o.add(buildTestResult()); | 570 o.add(buildTestResult()); |
526 o.add(buildTestResult()); | 571 o.add(buildTestResult()); |
527 return o; | 572 return o; |
528 } | 573 } |
529 | 574 |
530 checkUnnamed3088(core.List<api.TestResult> o) { | 575 checkUnnamed3081(core.List<api.TestResult> o) { |
531 unittest.expect(o, unittest.hasLength(2)); | 576 unittest.expect(o, unittest.hasLength(2)); |
532 checkTestResult(o[0]); | 577 checkTestResult(o[0]); |
533 checkTestResult(o[1]); | 578 checkTestResult(o[1]); |
534 } | 579 } |
535 | 580 |
536 core.int buildCounterTestRulesetResponse = 0; | 581 core.int buildCounterTestRulesetResponse = 0; |
537 buildTestRulesetResponse() { | 582 buildTestRulesetResponse() { |
538 var o = new api.TestRulesetResponse(); | 583 var o = new api.TestRulesetResponse(); |
539 buildCounterTestRulesetResponse++; | 584 buildCounterTestRulesetResponse++; |
540 if (buildCounterTestRulesetResponse < 3) { | 585 if (buildCounterTestRulesetResponse < 3) { |
541 o.issues = buildUnnamed3087(); | 586 o.issues = buildUnnamed3080(); |
542 o.testResults = buildUnnamed3088(); | 587 o.testResults = buildUnnamed3081(); |
543 } | 588 } |
544 buildCounterTestRulesetResponse--; | 589 buildCounterTestRulesetResponse--; |
545 return o; | 590 return o; |
546 } | 591 } |
547 | 592 |
548 checkTestRulesetResponse(api.TestRulesetResponse o) { | 593 checkTestRulesetResponse(api.TestRulesetResponse o) { |
549 buildCounterTestRulesetResponse++; | 594 buildCounterTestRulesetResponse++; |
550 if (buildCounterTestRulesetResponse < 3) { | 595 if (buildCounterTestRulesetResponse < 3) { |
551 checkUnnamed3087(o.issues); | 596 checkUnnamed3080(o.issues); |
552 checkUnnamed3088(o.testResults); | 597 checkUnnamed3081(o.testResults); |
553 } | 598 } |
554 buildCounterTestRulesetResponse--; | 599 buildCounterTestRulesetResponse--; |
555 } | 600 } |
556 | 601 |
557 buildUnnamed3089() { | 602 buildUnnamed3082() { |
558 var o = new core.List<api.TestCase>(); | 603 var o = new core.List<api.TestCase>(); |
559 o.add(buildTestCase()); | 604 o.add(buildTestCase()); |
560 o.add(buildTestCase()); | 605 o.add(buildTestCase()); |
561 return o; | 606 return o; |
562 } | 607 } |
563 | 608 |
564 checkUnnamed3089(core.List<api.TestCase> o) { | 609 checkUnnamed3082(core.List<api.TestCase> o) { |
565 unittest.expect(o, unittest.hasLength(2)); | 610 unittest.expect(o, unittest.hasLength(2)); |
566 checkTestCase(o[0]); | 611 checkTestCase(o[0]); |
567 checkTestCase(o[1]); | 612 checkTestCase(o[1]); |
568 } | 613 } |
569 | 614 |
570 core.int buildCounterTestSuite = 0; | 615 core.int buildCounterTestSuite = 0; |
571 buildTestSuite() { | 616 buildTestSuite() { |
572 var o = new api.TestSuite(); | 617 var o = new api.TestSuite(); |
573 buildCounterTestSuite++; | 618 buildCounterTestSuite++; |
574 if (buildCounterTestSuite < 3) { | 619 if (buildCounterTestSuite < 3) { |
575 o.testCases = buildUnnamed3089(); | 620 o.testCases = buildUnnamed3082(); |
576 } | 621 } |
577 buildCounterTestSuite--; | 622 buildCounterTestSuite--; |
578 return o; | 623 return o; |
579 } | 624 } |
580 | 625 |
581 checkTestSuite(api.TestSuite o) { | 626 checkTestSuite(api.TestSuite o) { |
582 buildCounterTestSuite++; | 627 buildCounterTestSuite++; |
583 if (buildCounterTestSuite < 3) { | 628 if (buildCounterTestSuite < 3) { |
584 checkUnnamed3089(o.testCases); | 629 checkUnnamed3082(o.testCases); |
585 } | 630 } |
586 buildCounterTestSuite--; | 631 buildCounterTestSuite--; |
587 } | 632 } |
588 | 633 |
589 | |
590 main() { | 634 main() { |
591 unittest.group("obj-schema-Arg", () { | 635 unittest.group("obj-schema-Arg", () { |
592 unittest.test("to-json--from-json", () { | 636 unittest.test("to-json--from-json", () { |
593 var o = buildArg(); | 637 var o = buildArg(); |
594 var od = new api.Arg.fromJson(o.toJson()); | 638 var od = new api.Arg.fromJson(o.toJson()); |
595 checkArg(od); | 639 checkArg(od); |
596 }); | 640 }); |
597 }); | 641 }); |
598 | 642 |
599 | |
600 unittest.group("obj-schema-Empty", () { | 643 unittest.group("obj-schema-Empty", () { |
601 unittest.test("to-json--from-json", () { | 644 unittest.test("to-json--from-json", () { |
602 var o = buildEmpty(); | 645 var o = buildEmpty(); |
603 var od = new api.Empty.fromJson(o.toJson()); | 646 var od = new api.Empty.fromJson(o.toJson()); |
604 checkEmpty(od); | 647 checkEmpty(od); |
605 }); | 648 }); |
606 }); | 649 }); |
607 | 650 |
608 | |
609 unittest.group("obj-schema-File", () { | 651 unittest.group("obj-schema-File", () { |
610 unittest.test("to-json--from-json", () { | 652 unittest.test("to-json--from-json", () { |
611 var o = buildFile(); | 653 var o = buildFile(); |
612 var od = new api.File.fromJson(o.toJson()); | 654 var od = new api.File.fromJson(o.toJson()); |
613 checkFile(od); | 655 checkFile(od); |
614 }); | 656 }); |
615 }); | 657 }); |
616 | 658 |
617 | |
618 unittest.group("obj-schema-FunctionCall", () { | 659 unittest.group("obj-schema-FunctionCall", () { |
619 unittest.test("to-json--from-json", () { | 660 unittest.test("to-json--from-json", () { |
620 var o = buildFunctionCall(); | 661 var o = buildFunctionCall(); |
621 var od = new api.FunctionCall.fromJson(o.toJson()); | 662 var od = new api.FunctionCall.fromJson(o.toJson()); |
622 checkFunctionCall(od); | 663 checkFunctionCall(od); |
623 }); | 664 }); |
624 }); | 665 }); |
625 | 666 |
626 | |
627 unittest.group("obj-schema-FunctionMock", () { | 667 unittest.group("obj-schema-FunctionMock", () { |
628 unittest.test("to-json--from-json", () { | 668 unittest.test("to-json--from-json", () { |
629 var o = buildFunctionMock(); | 669 var o = buildFunctionMock(); |
630 var od = new api.FunctionMock.fromJson(o.toJson()); | 670 var od = new api.FunctionMock.fromJson(o.toJson()); |
631 checkFunctionMock(od); | 671 checkFunctionMock(od); |
632 }); | 672 }); |
633 }); | 673 }); |
634 | 674 |
635 | |
636 unittest.group("obj-schema-Issue", () { | 675 unittest.group("obj-schema-Issue", () { |
637 unittest.test("to-json--from-json", () { | 676 unittest.test("to-json--from-json", () { |
638 var o = buildIssue(); | 677 var o = buildIssue(); |
639 var od = new api.Issue.fromJson(o.toJson()); | 678 var od = new api.Issue.fromJson(o.toJson()); |
640 checkIssue(od); | 679 checkIssue(od); |
641 }); | 680 }); |
642 }); | 681 }); |
643 | 682 |
644 | |
645 unittest.group("obj-schema-ListReleasesResponse", () { | 683 unittest.group("obj-schema-ListReleasesResponse", () { |
646 unittest.test("to-json--from-json", () { | 684 unittest.test("to-json--from-json", () { |
647 var o = buildListReleasesResponse(); | 685 var o = buildListReleasesResponse(); |
648 var od = new api.ListReleasesResponse.fromJson(o.toJson()); | 686 var od = new api.ListReleasesResponse.fromJson(o.toJson()); |
649 checkListReleasesResponse(od); | 687 checkListReleasesResponse(od); |
650 }); | 688 }); |
651 }); | 689 }); |
652 | 690 |
653 | |
654 unittest.group("obj-schema-ListRulesetsResponse", () { | 691 unittest.group("obj-schema-ListRulesetsResponse", () { |
655 unittest.test("to-json--from-json", () { | 692 unittest.test("to-json--from-json", () { |
656 var o = buildListRulesetsResponse(); | 693 var o = buildListRulesetsResponse(); |
657 var od = new api.ListRulesetsResponse.fromJson(o.toJson()); | 694 var od = new api.ListRulesetsResponse.fromJson(o.toJson()); |
658 checkListRulesetsResponse(od); | 695 checkListRulesetsResponse(od); |
659 }); | 696 }); |
660 }); | 697 }); |
661 | 698 |
662 | |
663 unittest.group("obj-schema-Release", () { | 699 unittest.group("obj-schema-Release", () { |
664 unittest.test("to-json--from-json", () { | 700 unittest.test("to-json--from-json", () { |
665 var o = buildRelease(); | 701 var o = buildRelease(); |
666 var od = new api.Release.fromJson(o.toJson()); | 702 var od = new api.Release.fromJson(o.toJson()); |
667 checkRelease(od); | 703 checkRelease(od); |
668 }); | 704 }); |
669 }); | 705 }); |
670 | 706 |
671 | |
672 unittest.group("obj-schema-Result", () { | 707 unittest.group("obj-schema-Result", () { |
673 unittest.test("to-json--from-json", () { | 708 unittest.test("to-json--from-json", () { |
674 var o = buildResult(); | 709 var o = buildResult(); |
675 var od = new api.Result.fromJson(o.toJson()); | 710 var od = new api.Result.fromJson(o.toJson()); |
676 checkResult(od); | 711 checkResult(od); |
677 }); | 712 }); |
678 }); | 713 }); |
679 | 714 |
680 | |
681 unittest.group("obj-schema-Ruleset", () { | 715 unittest.group("obj-schema-Ruleset", () { |
682 unittest.test("to-json--from-json", () { | 716 unittest.test("to-json--from-json", () { |
683 var o = buildRuleset(); | 717 var o = buildRuleset(); |
684 var od = new api.Ruleset.fromJson(o.toJson()); | 718 var od = new api.Ruleset.fromJson(o.toJson()); |
685 checkRuleset(od); | 719 checkRuleset(od); |
686 }); | 720 }); |
687 }); | 721 }); |
688 | 722 |
689 | |
690 unittest.group("obj-schema-Source", () { | 723 unittest.group("obj-schema-Source", () { |
691 unittest.test("to-json--from-json", () { | 724 unittest.test("to-json--from-json", () { |
692 var o = buildSource(); | 725 var o = buildSource(); |
693 var od = new api.Source.fromJson(o.toJson()); | 726 var od = new api.Source.fromJson(o.toJson()); |
694 checkSource(od); | 727 checkSource(od); |
695 }); | 728 }); |
696 }); | 729 }); |
697 | 730 |
698 | |
699 unittest.group("obj-schema-SourcePosition", () { | 731 unittest.group("obj-schema-SourcePosition", () { |
700 unittest.test("to-json--from-json", () { | 732 unittest.test("to-json--from-json", () { |
701 var o = buildSourcePosition(); | 733 var o = buildSourcePosition(); |
702 var od = new api.SourcePosition.fromJson(o.toJson()); | 734 var od = new api.SourcePosition.fromJson(o.toJson()); |
703 checkSourcePosition(od); | 735 checkSourcePosition(od); |
704 }); | 736 }); |
705 }); | 737 }); |
706 | 738 |
707 | |
708 unittest.group("obj-schema-TestCase", () { | 739 unittest.group("obj-schema-TestCase", () { |
709 unittest.test("to-json--from-json", () { | 740 unittest.test("to-json--from-json", () { |
710 var o = buildTestCase(); | 741 var o = buildTestCase(); |
711 var od = new api.TestCase.fromJson(o.toJson()); | 742 var od = new api.TestCase.fromJson(o.toJson()); |
712 checkTestCase(od); | 743 checkTestCase(od); |
713 }); | 744 }); |
714 }); | 745 }); |
715 | 746 |
716 | |
717 unittest.group("obj-schema-TestResult", () { | 747 unittest.group("obj-schema-TestResult", () { |
718 unittest.test("to-json--from-json", () { | 748 unittest.test("to-json--from-json", () { |
719 var o = buildTestResult(); | 749 var o = buildTestResult(); |
720 var od = new api.TestResult.fromJson(o.toJson()); | 750 var od = new api.TestResult.fromJson(o.toJson()); |
721 checkTestResult(od); | 751 checkTestResult(od); |
722 }); | 752 }); |
723 }); | 753 }); |
724 | 754 |
725 | |
726 unittest.group("obj-schema-TestRulesetRequest", () { | 755 unittest.group("obj-schema-TestRulesetRequest", () { |
727 unittest.test("to-json--from-json", () { | 756 unittest.test("to-json--from-json", () { |
728 var o = buildTestRulesetRequest(); | 757 var o = buildTestRulesetRequest(); |
729 var od = new api.TestRulesetRequest.fromJson(o.toJson()); | 758 var od = new api.TestRulesetRequest.fromJson(o.toJson()); |
730 checkTestRulesetRequest(od); | 759 checkTestRulesetRequest(od); |
731 }); | 760 }); |
732 }); | 761 }); |
733 | 762 |
734 | |
735 unittest.group("obj-schema-TestRulesetResponse", () { | 763 unittest.group("obj-schema-TestRulesetResponse", () { |
736 unittest.test("to-json--from-json", () { | 764 unittest.test("to-json--from-json", () { |
737 var o = buildTestRulesetResponse(); | 765 var o = buildTestRulesetResponse(); |
738 var od = new api.TestRulesetResponse.fromJson(o.toJson()); | 766 var od = new api.TestRulesetResponse.fromJson(o.toJson()); |
739 checkTestRulesetResponse(od); | 767 checkTestRulesetResponse(od); |
740 }); | 768 }); |
741 }); | 769 }); |
742 | 770 |
743 | |
744 unittest.group("obj-schema-TestSuite", () { | 771 unittest.group("obj-schema-TestSuite", () { |
745 unittest.test("to-json--from-json", () { | 772 unittest.test("to-json--from-json", () { |
746 var o = buildTestSuite(); | 773 var o = buildTestSuite(); |
747 var od = new api.TestSuite.fromJson(o.toJson()); | 774 var od = new api.TestSuite.fromJson(o.toJson()); |
748 checkTestSuite(od); | 775 checkTestSuite(od); |
749 }); | 776 }); |
750 }); | 777 }); |
751 | 778 |
752 | |
753 unittest.group("resource-ProjectsResourceApi", () { | 779 unittest.group("resource-ProjectsResourceApi", () { |
754 unittest.test("method--test", () { | 780 unittest.test("method--test", () { |
755 | |
756 var mock = new HttpServerMock(); | 781 var mock = new HttpServerMock(); |
757 api.ProjectsResourceApi res = new api.FirebaserulesApi(mock).projects; | 782 api.ProjectsResourceApi res = new api.FirebaserulesApi(mock).projects; |
758 var arg_request = buildTestRulesetRequest(); | 783 var arg_request = buildTestRulesetRequest(); |
759 var arg_name = "foo"; | 784 var arg_name = "foo"; |
760 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 785 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
761 var obj = new api.TestRulesetRequest.fromJson(json); | 786 var obj = new api.TestRulesetRequest.fromJson(json); |
762 checkTestRulesetRequest(obj); | 787 checkTestRulesetRequest(obj); |
763 | 788 |
764 var path = (req.url).path; | 789 var path = (req.url).path; |
765 var pathOffset = 0; | 790 var pathOffset = 0; |
766 var index; | 791 var index; |
767 var subPart; | 792 var subPart; |
768 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 793 unittest.expect( |
| 794 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
769 pathOffset += 1; | 795 pathOffset += 1; |
770 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); | 796 unittest.expect( |
| 797 path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/")); |
771 pathOffset += 3; | 798 pathOffset += 3; |
772 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 799 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
773 | 800 |
774 var query = (req.url).query; | 801 var query = (req.url).query; |
775 var queryOffset = 0; | 802 var queryOffset = 0; |
776 var queryMap = {}; | 803 var queryMap = {}; |
777 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 804 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
778 parseBool(n) { | 805 parseBool(n) { |
779 if (n == "true") return true; | 806 if (n == "true") return true; |
780 if (n == "false") return false; | 807 if (n == "false") return false; |
781 if (n == null) return null; | 808 if (n == null) return null; |
782 throw new core.ArgumentError("Invalid boolean: $n"); | 809 throw new core.ArgumentError("Invalid boolean: $n"); |
783 } | 810 } |
| 811 |
784 if (query.length > 0) { | 812 if (query.length > 0) { |
785 for (var part in query.split("&")) { | 813 for (var part in query.split("&")) { |
786 var keyvalue = part.split("="); | 814 var keyvalue = part.split("="); |
787 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 815 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 816 core.Uri.decodeQueryComponent(keyvalue[1])); |
788 } | 817 } |
789 } | 818 } |
790 | 819 |
791 | |
792 var h = { | 820 var h = { |
793 "content-type" : "application/json; charset=utf-8", | 821 "content-type": "application/json; charset=utf-8", |
794 }; | 822 }; |
795 var resp = convert.JSON.encode(buildTestRulesetResponse()); | 823 var resp = convert.JSON.encode(buildTestRulesetResponse()); |
796 return new async.Future.value(stringResponse(200, h, resp)); | 824 return new async.Future.value(stringResponse(200, h, resp)); |
797 }), true); | 825 }), true); |
798 res.test(arg_request, arg_name).then(unittest.expectAsync1(((api.TestRules
etResponse response) { | 826 res |
| 827 .test(arg_request, arg_name) |
| 828 .then(unittest.expectAsync1(((api.TestRulesetResponse response) { |
799 checkTestRulesetResponse(response); | 829 checkTestRulesetResponse(response); |
800 }))); | 830 }))); |
801 }); | 831 }); |
802 | |
803 }); | 832 }); |
804 | 833 |
805 | |
806 unittest.group("resource-ProjectsReleasesResourceApi", () { | 834 unittest.group("resource-ProjectsReleasesResourceApi", () { |
807 unittest.test("method--create", () { | 835 unittest.test("method--create", () { |
808 | |
809 var mock = new HttpServerMock(); | 836 var mock = new HttpServerMock(); |
810 api.ProjectsReleasesResourceApi res = new api.FirebaserulesApi(mock).proje
cts.releases; | 837 api.ProjectsReleasesResourceApi res = |
| 838 new api.FirebaserulesApi(mock).projects.releases; |
811 var arg_request = buildRelease(); | 839 var arg_request = buildRelease(); |
812 var arg_name = "foo"; | 840 var arg_name = "foo"; |
813 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 841 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
814 var obj = new api.Release.fromJson(json); | 842 var obj = new api.Release.fromJson(json); |
815 checkRelease(obj); | 843 checkRelease(obj); |
816 | 844 |
817 var path = (req.url).path; | 845 var path = (req.url).path; |
818 var pathOffset = 0; | 846 var pathOffset = 0; |
819 var index; | 847 var index; |
820 var subPart; | 848 var subPart; |
821 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 849 unittest.expect( |
| 850 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
822 pathOffset += 1; | 851 pathOffset += 1; |
823 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); | 852 unittest.expect( |
| 853 path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/")); |
824 pathOffset += 3; | 854 pathOffset += 3; |
825 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 855 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
826 | 856 |
827 var query = (req.url).query; | 857 var query = (req.url).query; |
828 var queryOffset = 0; | 858 var queryOffset = 0; |
829 var queryMap = {}; | 859 var queryMap = {}; |
830 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 860 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
831 parseBool(n) { | 861 parseBool(n) { |
832 if (n == "true") return true; | 862 if (n == "true") return true; |
833 if (n == "false") return false; | 863 if (n == "false") return false; |
834 if (n == null) return null; | 864 if (n == null) return null; |
835 throw new core.ArgumentError("Invalid boolean: $n"); | 865 throw new core.ArgumentError("Invalid boolean: $n"); |
836 } | 866 } |
| 867 |
837 if (query.length > 0) { | 868 if (query.length > 0) { |
838 for (var part in query.split("&")) { | 869 for (var part in query.split("&")) { |
839 var keyvalue = part.split("="); | 870 var keyvalue = part.split("="); |
840 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 871 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 872 core.Uri.decodeQueryComponent(keyvalue[1])); |
841 } | 873 } |
842 } | 874 } |
843 | 875 |
844 | |
845 var h = { | 876 var h = { |
846 "content-type" : "application/json; charset=utf-8", | 877 "content-type": "application/json; charset=utf-8", |
847 }; | 878 }; |
848 var resp = convert.JSON.encode(buildRelease()); | 879 var resp = convert.JSON.encode(buildRelease()); |
849 return new async.Future.value(stringResponse(200, h, resp)); | 880 return new async.Future.value(stringResponse(200, h, resp)); |
850 }), true); | 881 }), true); |
851 res.create(arg_request, arg_name).then(unittest.expectAsync1(((api.Release
response) { | 882 res |
| 883 .create(arg_request, arg_name) |
| 884 .then(unittest.expectAsync1(((api.Release response) { |
852 checkRelease(response); | 885 checkRelease(response); |
853 }))); | 886 }))); |
854 }); | 887 }); |
855 | 888 |
856 unittest.test("method--delete", () { | 889 unittest.test("method--delete", () { |
857 | |
858 var mock = new HttpServerMock(); | 890 var mock = new HttpServerMock(); |
859 api.ProjectsReleasesResourceApi res = new api.FirebaserulesApi(mock).proje
cts.releases; | 891 api.ProjectsReleasesResourceApi res = |
| 892 new api.FirebaserulesApi(mock).projects.releases; |
860 var arg_name = "foo"; | 893 var arg_name = "foo"; |
861 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 894 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
862 var path = (req.url).path; | 895 var path = (req.url).path; |
863 var pathOffset = 0; | 896 var pathOffset = 0; |
864 var index; | 897 var index; |
865 var subPart; | 898 var subPart; |
866 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 899 unittest.expect( |
| 900 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
867 pathOffset += 1; | 901 pathOffset += 1; |
868 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); | 902 unittest.expect( |
| 903 path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/")); |
869 pathOffset += 3; | 904 pathOffset += 3; |
870 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 905 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
871 | 906 |
872 var query = (req.url).query; | 907 var query = (req.url).query; |
873 var queryOffset = 0; | 908 var queryOffset = 0; |
874 var queryMap = {}; | 909 var queryMap = {}; |
875 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 910 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
876 parseBool(n) { | 911 parseBool(n) { |
877 if (n == "true") return true; | 912 if (n == "true") return true; |
878 if (n == "false") return false; | 913 if (n == "false") return false; |
879 if (n == null) return null; | 914 if (n == null) return null; |
880 throw new core.ArgumentError("Invalid boolean: $n"); | 915 throw new core.ArgumentError("Invalid boolean: $n"); |
881 } | 916 } |
| 917 |
882 if (query.length > 0) { | 918 if (query.length > 0) { |
883 for (var part in query.split("&")) { | 919 for (var part in query.split("&")) { |
884 var keyvalue = part.split("="); | 920 var keyvalue = part.split("="); |
885 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 921 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 922 core.Uri.decodeQueryComponent(keyvalue[1])); |
886 } | 923 } |
887 } | 924 } |
888 | 925 |
889 | |
890 var h = { | 926 var h = { |
891 "content-type" : "application/json; charset=utf-8", | 927 "content-type": "application/json; charset=utf-8", |
892 }; | 928 }; |
893 var resp = convert.JSON.encode(buildEmpty()); | 929 var resp = convert.JSON.encode(buildEmpty()); |
894 return new async.Future.value(stringResponse(200, h, resp)); | 930 return new async.Future.value(stringResponse(200, h, resp)); |
895 }), true); | 931 }), true); |
896 res.delete(arg_name).then(unittest.expectAsync1(((api.Empty response) { | 932 res.delete(arg_name).then(unittest.expectAsync1(((api.Empty response) { |
897 checkEmpty(response); | 933 checkEmpty(response); |
898 }))); | 934 }))); |
899 }); | 935 }); |
900 | 936 |
901 unittest.test("method--get", () { | 937 unittest.test("method--get", () { |
902 | |
903 var mock = new HttpServerMock(); | 938 var mock = new HttpServerMock(); |
904 api.ProjectsReleasesResourceApi res = new api.FirebaserulesApi(mock).proje
cts.releases; | 939 api.ProjectsReleasesResourceApi res = |
| 940 new api.FirebaserulesApi(mock).projects.releases; |
905 var arg_name = "foo"; | 941 var arg_name = "foo"; |
906 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 942 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
907 var path = (req.url).path; | 943 var path = (req.url).path; |
908 var pathOffset = 0; | 944 var pathOffset = 0; |
909 var index; | 945 var index; |
910 var subPart; | 946 var subPart; |
911 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 947 unittest.expect( |
| 948 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
912 pathOffset += 1; | 949 pathOffset += 1; |
913 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); | 950 unittest.expect( |
| 951 path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/")); |
914 pathOffset += 3; | 952 pathOffset += 3; |
915 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 953 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
916 | 954 |
917 var query = (req.url).query; | 955 var query = (req.url).query; |
918 var queryOffset = 0; | 956 var queryOffset = 0; |
919 var queryMap = {}; | 957 var queryMap = {}; |
920 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 958 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
921 parseBool(n) { | 959 parseBool(n) { |
922 if (n == "true") return true; | 960 if (n == "true") return true; |
923 if (n == "false") return false; | 961 if (n == "false") return false; |
924 if (n == null) return null; | 962 if (n == null) return null; |
925 throw new core.ArgumentError("Invalid boolean: $n"); | 963 throw new core.ArgumentError("Invalid boolean: $n"); |
926 } | 964 } |
| 965 |
927 if (query.length > 0) { | 966 if (query.length > 0) { |
928 for (var part in query.split("&")) { | 967 for (var part in query.split("&")) { |
929 var keyvalue = part.split("="); | 968 var keyvalue = part.split("="); |
930 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 969 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 970 core.Uri.decodeQueryComponent(keyvalue[1])); |
931 } | 971 } |
932 } | 972 } |
933 | 973 |
934 | |
935 var h = { | 974 var h = { |
936 "content-type" : "application/json; charset=utf-8", | 975 "content-type": "application/json; charset=utf-8", |
937 }; | 976 }; |
938 var resp = convert.JSON.encode(buildRelease()); | 977 var resp = convert.JSON.encode(buildRelease()); |
939 return new async.Future.value(stringResponse(200, h, resp)); | 978 return new async.Future.value(stringResponse(200, h, resp)); |
940 }), true); | 979 }), true); |
941 res.get(arg_name).then(unittest.expectAsync1(((api.Release response) { | 980 res.get(arg_name).then(unittest.expectAsync1(((api.Release response) { |
942 checkRelease(response); | 981 checkRelease(response); |
943 }))); | 982 }))); |
944 }); | 983 }); |
945 | 984 |
946 unittest.test("method--list", () { | 985 unittest.test("method--list", () { |
947 | |
948 var mock = new HttpServerMock(); | 986 var mock = new HttpServerMock(); |
949 api.ProjectsReleasesResourceApi res = new api.FirebaserulesApi(mock).proje
cts.releases; | 987 api.ProjectsReleasesResourceApi res = |
| 988 new api.FirebaserulesApi(mock).projects.releases; |
950 var arg_name = "foo"; | 989 var arg_name = "foo"; |
951 var arg_filter = "foo"; | 990 var arg_filter = "foo"; |
952 var arg_pageToken = "foo"; | 991 var arg_pageToken = "foo"; |
953 var arg_pageSize = 42; | 992 var arg_pageSize = 42; |
954 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 993 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
955 var path = (req.url).path; | 994 var path = (req.url).path; |
956 var pathOffset = 0; | 995 var pathOffset = 0; |
957 var index; | 996 var index; |
958 var subPart; | 997 var subPart; |
959 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 998 unittest.expect( |
| 999 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
960 pathOffset += 1; | 1000 pathOffset += 1; |
961 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); | 1001 unittest.expect( |
| 1002 path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/")); |
962 pathOffset += 3; | 1003 pathOffset += 3; |
963 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 1004 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
964 | 1005 |
965 var query = (req.url).query; | 1006 var query = (req.url).query; |
966 var queryOffset = 0; | 1007 var queryOffset = 0; |
967 var queryMap = {}; | 1008 var queryMap = {}; |
968 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1009 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
969 parseBool(n) { | 1010 parseBool(n) { |
970 if (n == "true") return true; | 1011 if (n == "true") return true; |
971 if (n == "false") return false; | 1012 if (n == "false") return false; |
972 if (n == null) return null; | 1013 if (n == null) return null; |
973 throw new core.ArgumentError("Invalid boolean: $n"); | 1014 throw new core.ArgumentError("Invalid boolean: $n"); |
974 } | 1015 } |
| 1016 |
975 if (query.length > 0) { | 1017 if (query.length > 0) { |
976 for (var part in query.split("&")) { | 1018 for (var part in query.split("&")) { |
977 var keyvalue = part.split("="); | 1019 var keyvalue = part.split("="); |
978 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1020 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1021 core.Uri.decodeQueryComponent(keyvalue[1])); |
979 } | 1022 } |
980 } | 1023 } |
981 unittest.expect(queryMap["filter"].first, unittest.equals(arg_filter)); | 1024 unittest.expect(queryMap["filter"].first, unittest.equals(arg_filter)); |
982 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); | 1025 unittest.expect( |
983 unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equ
als(arg_pageSize)); | 1026 queryMap["pageToken"].first, unittest.equals(arg_pageToken)); |
984 | 1027 unittest.expect(core.int.parse(queryMap["pageSize"].first), |
| 1028 unittest.equals(arg_pageSize)); |
985 | 1029 |
986 var h = { | 1030 var h = { |
987 "content-type" : "application/json; charset=utf-8", | 1031 "content-type": "application/json; charset=utf-8", |
988 }; | 1032 }; |
989 var resp = convert.JSON.encode(buildListReleasesResponse()); | 1033 var resp = convert.JSON.encode(buildListReleasesResponse()); |
990 return new async.Future.value(stringResponse(200, h, resp)); | 1034 return new async.Future.value(stringResponse(200, h, resp)); |
991 }), true); | 1035 }), true); |
992 res.list(arg_name, filter: arg_filter, pageToken: arg_pageToken, pageSize:
arg_pageSize).then(unittest.expectAsync1(((api.ListReleasesResponse response) { | 1036 res |
| 1037 .list(arg_name, |
| 1038 filter: arg_filter, |
| 1039 pageToken: arg_pageToken, |
| 1040 pageSize: arg_pageSize) |
| 1041 .then(unittest.expectAsync1(((api.ListReleasesResponse response) { |
993 checkListReleasesResponse(response); | 1042 checkListReleasesResponse(response); |
994 }))); | 1043 }))); |
995 }); | 1044 }); |
996 | 1045 |
997 unittest.test("method--update", () { | 1046 unittest.test("method--update", () { |
998 | |
999 var mock = new HttpServerMock(); | 1047 var mock = new HttpServerMock(); |
1000 api.ProjectsReleasesResourceApi res = new api.FirebaserulesApi(mock).proje
cts.releases; | 1048 api.ProjectsReleasesResourceApi res = |
| 1049 new api.FirebaserulesApi(mock).projects.releases; |
1001 var arg_request = buildRelease(); | 1050 var arg_request = buildRelease(); |
1002 var arg_name = "foo"; | 1051 var arg_name = "foo"; |
1003 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1052 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
1004 var obj = new api.Release.fromJson(json); | 1053 var obj = new api.Release.fromJson(json); |
1005 checkRelease(obj); | 1054 checkRelease(obj); |
1006 | 1055 |
1007 var path = (req.url).path; | 1056 var path = (req.url).path; |
1008 var pathOffset = 0; | 1057 var pathOffset = 0; |
1009 var index; | 1058 var index; |
1010 var subPart; | 1059 var subPart; |
1011 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1060 unittest.expect( |
| 1061 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
1012 pathOffset += 1; | 1062 pathOffset += 1; |
1013 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); | 1063 unittest.expect( |
| 1064 path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/")); |
1014 pathOffset += 3; | 1065 pathOffset += 3; |
1015 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 1066 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
1016 | 1067 |
1017 var query = (req.url).query; | 1068 var query = (req.url).query; |
1018 var queryOffset = 0; | 1069 var queryOffset = 0; |
1019 var queryMap = {}; | 1070 var queryMap = {}; |
1020 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1071 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
1021 parseBool(n) { | 1072 parseBool(n) { |
1022 if (n == "true") return true; | 1073 if (n == "true") return true; |
1023 if (n == "false") return false; | 1074 if (n == "false") return false; |
1024 if (n == null) return null; | 1075 if (n == null) return null; |
1025 throw new core.ArgumentError("Invalid boolean: $n"); | 1076 throw new core.ArgumentError("Invalid boolean: $n"); |
1026 } | 1077 } |
| 1078 |
1027 if (query.length > 0) { | 1079 if (query.length > 0) { |
1028 for (var part in query.split("&")) { | 1080 for (var part in query.split("&")) { |
1029 var keyvalue = part.split("="); | 1081 var keyvalue = part.split("="); |
1030 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1082 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1083 core.Uri.decodeQueryComponent(keyvalue[1])); |
1031 } | 1084 } |
1032 } | 1085 } |
1033 | 1086 |
1034 | |
1035 var h = { | 1087 var h = { |
1036 "content-type" : "application/json; charset=utf-8", | 1088 "content-type": "application/json; charset=utf-8", |
1037 }; | 1089 }; |
1038 var resp = convert.JSON.encode(buildRelease()); | 1090 var resp = convert.JSON.encode(buildRelease()); |
1039 return new async.Future.value(stringResponse(200, h, resp)); | 1091 return new async.Future.value(stringResponse(200, h, resp)); |
1040 }), true); | 1092 }), true); |
1041 res.update(arg_request, arg_name).then(unittest.expectAsync1(((api.Release
response) { | 1093 res |
| 1094 .update(arg_request, arg_name) |
| 1095 .then(unittest.expectAsync1(((api.Release response) { |
1042 checkRelease(response); | 1096 checkRelease(response); |
1043 }))); | 1097 }))); |
1044 }); | 1098 }); |
1045 | |
1046 }); | 1099 }); |
1047 | 1100 |
1048 | |
1049 unittest.group("resource-ProjectsRulesetsResourceApi", () { | 1101 unittest.group("resource-ProjectsRulesetsResourceApi", () { |
1050 unittest.test("method--create", () { | 1102 unittest.test("method--create", () { |
1051 | |
1052 var mock = new HttpServerMock(); | 1103 var mock = new HttpServerMock(); |
1053 api.ProjectsRulesetsResourceApi res = new api.FirebaserulesApi(mock).proje
cts.rulesets; | 1104 api.ProjectsRulesetsResourceApi res = |
| 1105 new api.FirebaserulesApi(mock).projects.rulesets; |
1054 var arg_request = buildRuleset(); | 1106 var arg_request = buildRuleset(); |
1055 var arg_name = "foo"; | 1107 var arg_name = "foo"; |
1056 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1108 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
1057 var obj = new api.Ruleset.fromJson(json); | 1109 var obj = new api.Ruleset.fromJson(json); |
1058 checkRuleset(obj); | 1110 checkRuleset(obj); |
1059 | 1111 |
1060 var path = (req.url).path; | 1112 var path = (req.url).path; |
1061 var pathOffset = 0; | 1113 var pathOffset = 0; |
1062 var index; | 1114 var index; |
1063 var subPart; | 1115 var subPart; |
1064 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1116 unittest.expect( |
| 1117 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
1065 pathOffset += 1; | 1118 pathOffset += 1; |
1066 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); | 1119 unittest.expect( |
| 1120 path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/")); |
1067 pathOffset += 3; | 1121 pathOffset += 3; |
1068 // 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; |
1069 | 1123 |
1070 var query = (req.url).query; | 1124 var query = (req.url).query; |
1071 var queryOffset = 0; | 1125 var queryOffset = 0; |
1072 var queryMap = {}; | 1126 var queryMap = {}; |
1073 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1127 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
1074 parseBool(n) { | 1128 parseBool(n) { |
1075 if (n == "true") return true; | 1129 if (n == "true") return true; |
1076 if (n == "false") return false; | 1130 if (n == "false") return false; |
1077 if (n == null) return null; | 1131 if (n == null) return null; |
1078 throw new core.ArgumentError("Invalid boolean: $n"); | 1132 throw new core.ArgumentError("Invalid boolean: $n"); |
1079 } | 1133 } |
| 1134 |
1080 if (query.length > 0) { | 1135 if (query.length > 0) { |
1081 for (var part in query.split("&")) { | 1136 for (var part in query.split("&")) { |
1082 var keyvalue = part.split("="); | 1137 var keyvalue = part.split("="); |
1083 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])); |
1084 } | 1140 } |
1085 } | 1141 } |
1086 | 1142 |
1087 | |
1088 var h = { | 1143 var h = { |
1089 "content-type" : "application/json; charset=utf-8", | 1144 "content-type": "application/json; charset=utf-8", |
1090 }; | 1145 }; |
1091 var resp = convert.JSON.encode(buildRuleset()); | 1146 var resp = convert.JSON.encode(buildRuleset()); |
1092 return new async.Future.value(stringResponse(200, h, resp)); | 1147 return new async.Future.value(stringResponse(200, h, resp)); |
1093 }), true); | 1148 }), true); |
1094 res.create(arg_request, arg_name).then(unittest.expectAsync1(((api.Ruleset
response) { | 1149 res |
| 1150 .create(arg_request, arg_name) |
| 1151 .then(unittest.expectAsync1(((api.Ruleset response) { |
1095 checkRuleset(response); | 1152 checkRuleset(response); |
1096 }))); | 1153 }))); |
1097 }); | 1154 }); |
1098 | 1155 |
1099 unittest.test("method--delete", () { | 1156 unittest.test("method--delete", () { |
1100 | |
1101 var mock = new HttpServerMock(); | 1157 var mock = new HttpServerMock(); |
1102 api.ProjectsRulesetsResourceApi res = new api.FirebaserulesApi(mock).proje
cts.rulesets; | 1158 api.ProjectsRulesetsResourceApi res = |
| 1159 new api.FirebaserulesApi(mock).projects.rulesets; |
1103 var arg_name = "foo"; | 1160 var arg_name = "foo"; |
1104 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1161 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
1105 var path = (req.url).path; | 1162 var path = (req.url).path; |
1106 var pathOffset = 0; | 1163 var pathOffset = 0; |
1107 var index; | 1164 var index; |
1108 var subPart; | 1165 var subPart; |
1109 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1166 unittest.expect( |
| 1167 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
1110 pathOffset += 1; | 1168 pathOffset += 1; |
1111 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); | 1169 unittest.expect( |
| 1170 path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/")); |
1112 pathOffset += 3; | 1171 pathOffset += 3; |
1113 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 1172 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
1114 | 1173 |
1115 var query = (req.url).query; | 1174 var query = (req.url).query; |
1116 var queryOffset = 0; | 1175 var queryOffset = 0; |
1117 var queryMap = {}; | 1176 var queryMap = {}; |
1118 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1177 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
1119 parseBool(n) { | 1178 parseBool(n) { |
1120 if (n == "true") return true; | 1179 if (n == "true") return true; |
1121 if (n == "false") return false; | 1180 if (n == "false") return false; |
1122 if (n == null) return null; | 1181 if (n == null) return null; |
1123 throw new core.ArgumentError("Invalid boolean: $n"); | 1182 throw new core.ArgumentError("Invalid boolean: $n"); |
1124 } | 1183 } |
| 1184 |
1125 if (query.length > 0) { | 1185 if (query.length > 0) { |
1126 for (var part in query.split("&")) { | 1186 for (var part in query.split("&")) { |
1127 var keyvalue = part.split("="); | 1187 var keyvalue = part.split("="); |
1128 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1188 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1189 core.Uri.decodeQueryComponent(keyvalue[1])); |
1129 } | 1190 } |
1130 } | 1191 } |
1131 | 1192 |
1132 | |
1133 var h = { | 1193 var h = { |
1134 "content-type" : "application/json; charset=utf-8", | 1194 "content-type": "application/json; charset=utf-8", |
1135 }; | 1195 }; |
1136 var resp = convert.JSON.encode(buildEmpty()); | 1196 var resp = convert.JSON.encode(buildEmpty()); |
1137 return new async.Future.value(stringResponse(200, h, resp)); | 1197 return new async.Future.value(stringResponse(200, h, resp)); |
1138 }), true); | 1198 }), true); |
1139 res.delete(arg_name).then(unittest.expectAsync1(((api.Empty response) { | 1199 res.delete(arg_name).then(unittest.expectAsync1(((api.Empty response) { |
1140 checkEmpty(response); | 1200 checkEmpty(response); |
1141 }))); | 1201 }))); |
1142 }); | 1202 }); |
1143 | 1203 |
1144 unittest.test("method--get", () { | 1204 unittest.test("method--get", () { |
1145 | |
1146 var mock = new HttpServerMock(); | 1205 var mock = new HttpServerMock(); |
1147 api.ProjectsRulesetsResourceApi res = new api.FirebaserulesApi(mock).proje
cts.rulesets; | 1206 api.ProjectsRulesetsResourceApi res = |
| 1207 new api.FirebaserulesApi(mock).projects.rulesets; |
1148 var arg_name = "foo"; | 1208 var arg_name = "foo"; |
1149 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1209 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
1150 var path = (req.url).path; | 1210 var path = (req.url).path; |
1151 var pathOffset = 0; | 1211 var pathOffset = 0; |
1152 var index; | 1212 var index; |
1153 var subPart; | 1213 var subPart; |
1154 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1214 unittest.expect( |
| 1215 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
1155 pathOffset += 1; | 1216 pathOffset += 1; |
1156 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); | 1217 unittest.expect( |
| 1218 path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/")); |
1157 pathOffset += 3; | 1219 pathOffset += 3; |
1158 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 1220 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
1159 | 1221 |
1160 var query = (req.url).query; | 1222 var query = (req.url).query; |
1161 var queryOffset = 0; | 1223 var queryOffset = 0; |
1162 var queryMap = {}; | 1224 var queryMap = {}; |
1163 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1225 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
1164 parseBool(n) { | 1226 parseBool(n) { |
1165 if (n == "true") return true; | 1227 if (n == "true") return true; |
1166 if (n == "false") return false; | 1228 if (n == "false") return false; |
1167 if (n == null) return null; | 1229 if (n == null) return null; |
1168 throw new core.ArgumentError("Invalid boolean: $n"); | 1230 throw new core.ArgumentError("Invalid boolean: $n"); |
1169 } | 1231 } |
| 1232 |
1170 if (query.length > 0) { | 1233 if (query.length > 0) { |
1171 for (var part in query.split("&")) { | 1234 for (var part in query.split("&")) { |
1172 var keyvalue = part.split("="); | 1235 var keyvalue = part.split("="); |
1173 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1236 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1237 core.Uri.decodeQueryComponent(keyvalue[1])); |
1174 } | 1238 } |
1175 } | 1239 } |
1176 | 1240 |
1177 | |
1178 var h = { | 1241 var h = { |
1179 "content-type" : "application/json; charset=utf-8", | 1242 "content-type": "application/json; charset=utf-8", |
1180 }; | 1243 }; |
1181 var resp = convert.JSON.encode(buildRuleset()); | 1244 var resp = convert.JSON.encode(buildRuleset()); |
1182 return new async.Future.value(stringResponse(200, h, resp)); | 1245 return new async.Future.value(stringResponse(200, h, resp)); |
1183 }), true); | 1246 }), true); |
1184 res.get(arg_name).then(unittest.expectAsync1(((api.Ruleset response) { | 1247 res.get(arg_name).then(unittest.expectAsync1(((api.Ruleset response) { |
1185 checkRuleset(response); | 1248 checkRuleset(response); |
1186 }))); | 1249 }))); |
1187 }); | 1250 }); |
1188 | 1251 |
1189 unittest.test("method--list", () { | 1252 unittest.test("method--list", () { |
1190 | |
1191 var mock = new HttpServerMock(); | 1253 var mock = new HttpServerMock(); |
1192 api.ProjectsRulesetsResourceApi res = new api.FirebaserulesApi(mock).proje
cts.rulesets; | 1254 api.ProjectsRulesetsResourceApi res = |
| 1255 new api.FirebaserulesApi(mock).projects.rulesets; |
1193 var arg_name = "foo"; | 1256 var arg_name = "foo"; |
| 1257 var arg_filter = "foo"; |
1194 var arg_pageToken = "foo"; | 1258 var arg_pageToken = "foo"; |
1195 var arg_pageSize = 42; | 1259 var arg_pageSize = 42; |
1196 var arg_filter = "foo"; | |
1197 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1260 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
1198 var path = (req.url).path; | 1261 var path = (req.url).path; |
1199 var pathOffset = 0; | 1262 var pathOffset = 0; |
1200 var index; | 1263 var index; |
1201 var subPart; | 1264 var subPart; |
1202 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1265 unittest.expect( |
| 1266 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
1203 pathOffset += 1; | 1267 pathOffset += 1; |
1204 unittest.expect(path.substring(pathOffset, pathOffset + 3), unittest.equ
als("v1/")); | 1268 unittest.expect( |
| 1269 path.substring(pathOffset, pathOffset + 3), unittest.equals("v1/")); |
1205 pathOffset += 3; | 1270 pathOffset += 3; |
1206 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 1271 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
1207 | 1272 |
1208 var query = (req.url).query; | 1273 var query = (req.url).query; |
1209 var queryOffset = 0; | 1274 var queryOffset = 0; |
1210 var queryMap = {}; | 1275 var queryMap = {}; |
1211 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1276 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
1212 parseBool(n) { | 1277 parseBool(n) { |
1213 if (n == "true") return true; | 1278 if (n == "true") return true; |
1214 if (n == "false") return false; | 1279 if (n == "false") return false; |
1215 if (n == null) return null; | 1280 if (n == null) return null; |
1216 throw new core.ArgumentError("Invalid boolean: $n"); | 1281 throw new core.ArgumentError("Invalid boolean: $n"); |
1217 } | 1282 } |
| 1283 |
1218 if (query.length > 0) { | 1284 if (query.length > 0) { |
1219 for (var part in query.split("&")) { | 1285 for (var part in query.split("&")) { |
1220 var keyvalue = part.split("="); | 1286 var keyvalue = part.split("="); |
1221 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1287 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1288 core.Uri.decodeQueryComponent(keyvalue[1])); |
1222 } | 1289 } |
1223 } | 1290 } |
1224 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); | |
1225 unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equ
als(arg_pageSize)); | |
1226 unittest.expect(queryMap["filter"].first, unittest.equals(arg_filter)); | 1291 unittest.expect(queryMap["filter"].first, unittest.equals(arg_filter)); |
1227 | 1292 unittest.expect( |
| 1293 queryMap["pageToken"].first, unittest.equals(arg_pageToken)); |
| 1294 unittest.expect(core.int.parse(queryMap["pageSize"].first), |
| 1295 unittest.equals(arg_pageSize)); |
1228 | 1296 |
1229 var h = { | 1297 var h = { |
1230 "content-type" : "application/json; charset=utf-8", | 1298 "content-type": "application/json; charset=utf-8", |
1231 }; | 1299 }; |
1232 var resp = convert.JSON.encode(buildListRulesetsResponse()); | 1300 var resp = convert.JSON.encode(buildListRulesetsResponse()); |
1233 return new async.Future.value(stringResponse(200, h, resp)); | 1301 return new async.Future.value(stringResponse(200, h, resp)); |
1234 }), true); | 1302 }), true); |
1235 res.list(arg_name, pageToken: arg_pageToken, pageSize: arg_pageSize, filte
r: arg_filter).then(unittest.expectAsync1(((api.ListRulesetsResponse response) { | 1303 res |
| 1304 .list(arg_name, |
| 1305 filter: arg_filter, |
| 1306 pageToken: arg_pageToken, |
| 1307 pageSize: arg_pageSize) |
| 1308 .then(unittest.expectAsync1(((api.ListRulesetsResponse response) { |
1236 checkListRulesetsResponse(response); | 1309 checkListRulesetsResponse(response); |
1237 }))); | 1310 }))); |
1238 }); | 1311 }); |
1239 | |
1240 }); | 1312 }); |
1241 | |
1242 | |
1243 } | 1313 } |
1244 | |
OLD | NEW |