OLD | NEW |
1 library googleapis.admin.reports_v1.test; | 1 library googleapis.admin.reports_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/admin/reports_v1.dart' as api; | 10 import 'package:googleapis/admin/reports_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 buildUnnamed691() { | 53 buildUnnamed690() { |
55 var o = new core.List<api.Activity>(); | 54 var o = new core.List<api.Activity>(); |
56 o.add(buildActivity()); | 55 o.add(buildActivity()); |
57 o.add(buildActivity()); | 56 o.add(buildActivity()); |
58 return o; | 57 return o; |
59 } | 58 } |
60 | 59 |
61 checkUnnamed691(core.List<api.Activity> o) { | 60 checkUnnamed690(core.List<api.Activity> o) { |
62 unittest.expect(o, unittest.hasLength(2)); | 61 unittest.expect(o, unittest.hasLength(2)); |
63 checkActivity(o[0]); | 62 checkActivity(o[0]); |
64 checkActivity(o[1]); | 63 checkActivity(o[1]); |
65 } | 64 } |
66 | 65 |
67 core.int buildCounterActivities = 0; | 66 core.int buildCounterActivities = 0; |
68 buildActivities() { | 67 buildActivities() { |
69 var o = new api.Activities(); | 68 var o = new api.Activities(); |
70 buildCounterActivities++; | 69 buildCounterActivities++; |
71 if (buildCounterActivities < 3) { | 70 if (buildCounterActivities < 3) { |
72 o.etag = "foo"; | 71 o.etag = "foo"; |
73 o.items = buildUnnamed691(); | 72 o.items = buildUnnamed690(); |
74 o.kind = "foo"; | 73 o.kind = "foo"; |
75 o.nextPageToken = "foo"; | 74 o.nextPageToken = "foo"; |
76 } | 75 } |
77 buildCounterActivities--; | 76 buildCounterActivities--; |
78 return o; | 77 return o; |
79 } | 78 } |
80 | 79 |
81 checkActivities(api.Activities o) { | 80 checkActivities(api.Activities o) { |
82 buildCounterActivities++; | 81 buildCounterActivities++; |
83 if (buildCounterActivities < 3) { | 82 if (buildCounterActivities < 3) { |
84 unittest.expect(o.etag, unittest.equals('foo')); | 83 unittest.expect(o.etag, unittest.equals('foo')); |
85 checkUnnamed691(o.items); | 84 checkUnnamed690(o.items); |
86 unittest.expect(o.kind, unittest.equals('foo')); | 85 unittest.expect(o.kind, unittest.equals('foo')); |
87 unittest.expect(o.nextPageToken, unittest.equals('foo')); | 86 unittest.expect(o.nextPageToken, unittest.equals('foo')); |
88 } | 87 } |
89 buildCounterActivities--; | 88 buildCounterActivities--; |
90 } | 89 } |
91 | 90 |
92 core.int buildCounterActivityActor = 0; | 91 core.int buildCounterActivityActor = 0; |
93 buildActivityActor() { | 92 buildActivityActor() { |
94 var o = new api.ActivityActor(); | 93 var o = new api.ActivityActor(); |
95 buildCounterActivityActor++; | 94 buildCounterActivityActor++; |
(...skipping 11 matching lines...) Expand all Loading... |
107 buildCounterActivityActor++; | 106 buildCounterActivityActor++; |
108 if (buildCounterActivityActor < 3) { | 107 if (buildCounterActivityActor < 3) { |
109 unittest.expect(o.callerType, unittest.equals('foo')); | 108 unittest.expect(o.callerType, unittest.equals('foo')); |
110 unittest.expect(o.email, unittest.equals('foo')); | 109 unittest.expect(o.email, unittest.equals('foo')); |
111 unittest.expect(o.key, unittest.equals('foo')); | 110 unittest.expect(o.key, unittest.equals('foo')); |
112 unittest.expect(o.profileId, unittest.equals('foo')); | 111 unittest.expect(o.profileId, unittest.equals('foo')); |
113 } | 112 } |
114 buildCounterActivityActor--; | 113 buildCounterActivityActor--; |
115 } | 114 } |
116 | 115 |
| 116 buildUnnamed691() { |
| 117 var o = new core.List<core.String>(); |
| 118 o.add("foo"); |
| 119 o.add("foo"); |
| 120 return o; |
| 121 } |
| 122 |
| 123 checkUnnamed691(core.List<core.String> o) { |
| 124 unittest.expect(o, unittest.hasLength(2)); |
| 125 unittest.expect(o[0], unittest.equals('foo')); |
| 126 unittest.expect(o[1], unittest.equals('foo')); |
| 127 } |
| 128 |
117 buildUnnamed692() { | 129 buildUnnamed692() { |
118 var o = new core.List<core.String>(); | 130 var o = new core.List<core.String>(); |
119 o.add("foo"); | 131 o.add("foo"); |
120 o.add("foo"); | 132 o.add("foo"); |
121 return o; | 133 return o; |
122 } | 134 } |
123 | 135 |
124 checkUnnamed692(core.List<core.String> o) { | 136 checkUnnamed692(core.List<core.String> o) { |
125 unittest.expect(o, unittest.hasLength(2)); | 137 unittest.expect(o, unittest.hasLength(2)); |
126 unittest.expect(o[0], unittest.equals('foo')); | 138 unittest.expect(o[0], unittest.equals('foo')); |
127 unittest.expect(o[1], unittest.equals('foo')); | 139 unittest.expect(o[1], unittest.equals('foo')); |
128 } | |
129 | |
130 buildUnnamed693() { | |
131 var o = new core.List<core.String>(); | |
132 o.add("foo"); | |
133 o.add("foo"); | |
134 return o; | |
135 } | |
136 | |
137 checkUnnamed693(core.List<core.String> o) { | |
138 unittest.expect(o, unittest.hasLength(2)); | |
139 unittest.expect(o[0], unittest.equals('foo')); | |
140 unittest.expect(o[1], unittest.equals('foo')); | |
141 } | 140 } |
142 | 141 |
143 core.int buildCounterActivityEventsParameters = 0; | 142 core.int buildCounterActivityEventsParameters = 0; |
144 buildActivityEventsParameters() { | 143 buildActivityEventsParameters() { |
145 var o = new api.ActivityEventsParameters(); | 144 var o = new api.ActivityEventsParameters(); |
146 buildCounterActivityEventsParameters++; | 145 buildCounterActivityEventsParameters++; |
147 if (buildCounterActivityEventsParameters < 3) { | 146 if (buildCounterActivityEventsParameters < 3) { |
148 o.boolValue = true; | 147 o.boolValue = true; |
149 o.intValue = "foo"; | 148 o.intValue = "foo"; |
150 o.multiIntValue = buildUnnamed692(); | 149 o.multiIntValue = buildUnnamed691(); |
151 o.multiValue = buildUnnamed693(); | 150 o.multiValue = buildUnnamed692(); |
152 o.name = "foo"; | 151 o.name = "foo"; |
153 o.value = "foo"; | 152 o.value = "foo"; |
154 } | 153 } |
155 buildCounterActivityEventsParameters--; | 154 buildCounterActivityEventsParameters--; |
156 return o; | 155 return o; |
157 } | 156 } |
158 | 157 |
159 checkActivityEventsParameters(api.ActivityEventsParameters o) { | 158 checkActivityEventsParameters(api.ActivityEventsParameters o) { |
160 buildCounterActivityEventsParameters++; | 159 buildCounterActivityEventsParameters++; |
161 if (buildCounterActivityEventsParameters < 3) { | 160 if (buildCounterActivityEventsParameters < 3) { |
162 unittest.expect(o.boolValue, unittest.isTrue); | 161 unittest.expect(o.boolValue, unittest.isTrue); |
163 unittest.expect(o.intValue, unittest.equals('foo')); | 162 unittest.expect(o.intValue, unittest.equals('foo')); |
164 checkUnnamed692(o.multiIntValue); | 163 checkUnnamed691(o.multiIntValue); |
165 checkUnnamed693(o.multiValue); | 164 checkUnnamed692(o.multiValue); |
166 unittest.expect(o.name, unittest.equals('foo')); | 165 unittest.expect(o.name, unittest.equals('foo')); |
167 unittest.expect(o.value, unittest.equals('foo')); | 166 unittest.expect(o.value, unittest.equals('foo')); |
168 } | 167 } |
169 buildCounterActivityEventsParameters--; | 168 buildCounterActivityEventsParameters--; |
170 } | 169 } |
171 | 170 |
172 buildUnnamed694() { | 171 buildUnnamed693() { |
173 var o = new core.List<api.ActivityEventsParameters>(); | 172 var o = new core.List<api.ActivityEventsParameters>(); |
174 o.add(buildActivityEventsParameters()); | 173 o.add(buildActivityEventsParameters()); |
175 o.add(buildActivityEventsParameters()); | 174 o.add(buildActivityEventsParameters()); |
176 return o; | 175 return o; |
177 } | 176 } |
178 | 177 |
179 checkUnnamed694(core.List<api.ActivityEventsParameters> o) { | 178 checkUnnamed693(core.List<api.ActivityEventsParameters> o) { |
180 unittest.expect(o, unittest.hasLength(2)); | 179 unittest.expect(o, unittest.hasLength(2)); |
181 checkActivityEventsParameters(o[0]); | 180 checkActivityEventsParameters(o[0]); |
182 checkActivityEventsParameters(o[1]); | 181 checkActivityEventsParameters(o[1]); |
183 } | 182 } |
184 | 183 |
185 core.int buildCounterActivityEvents = 0; | 184 core.int buildCounterActivityEvents = 0; |
186 buildActivityEvents() { | 185 buildActivityEvents() { |
187 var o = new api.ActivityEvents(); | 186 var o = new api.ActivityEvents(); |
188 buildCounterActivityEvents++; | 187 buildCounterActivityEvents++; |
189 if (buildCounterActivityEvents < 3) { | 188 if (buildCounterActivityEvents < 3) { |
190 o.name = "foo"; | 189 o.name = "foo"; |
191 o.parameters = buildUnnamed694(); | 190 o.parameters = buildUnnamed693(); |
192 o.type = "foo"; | 191 o.type = "foo"; |
193 } | 192 } |
194 buildCounterActivityEvents--; | 193 buildCounterActivityEvents--; |
195 return o; | 194 return o; |
196 } | 195 } |
197 | 196 |
198 checkActivityEvents(api.ActivityEvents o) { | 197 checkActivityEvents(api.ActivityEvents o) { |
199 buildCounterActivityEvents++; | 198 buildCounterActivityEvents++; |
200 if (buildCounterActivityEvents < 3) { | 199 if (buildCounterActivityEvents < 3) { |
201 unittest.expect(o.name, unittest.equals('foo')); | 200 unittest.expect(o.name, unittest.equals('foo')); |
202 checkUnnamed694(o.parameters); | 201 checkUnnamed693(o.parameters); |
203 unittest.expect(o.type, unittest.equals('foo')); | 202 unittest.expect(o.type, unittest.equals('foo')); |
204 } | 203 } |
205 buildCounterActivityEvents--; | 204 buildCounterActivityEvents--; |
206 } | 205 } |
207 | 206 |
208 buildUnnamed695() { | 207 buildUnnamed694() { |
209 var o = new core.List<api.ActivityEvents>(); | 208 var o = new core.List<api.ActivityEvents>(); |
210 o.add(buildActivityEvents()); | 209 o.add(buildActivityEvents()); |
211 o.add(buildActivityEvents()); | 210 o.add(buildActivityEvents()); |
212 return o; | 211 return o; |
213 } | 212 } |
214 | 213 |
215 checkUnnamed695(core.List<api.ActivityEvents> o) { | 214 checkUnnamed694(core.List<api.ActivityEvents> o) { |
216 unittest.expect(o, unittest.hasLength(2)); | 215 unittest.expect(o, unittest.hasLength(2)); |
217 checkActivityEvents(o[0]); | 216 checkActivityEvents(o[0]); |
218 checkActivityEvents(o[1]); | 217 checkActivityEvents(o[1]); |
219 } | 218 } |
220 | 219 |
221 core.int buildCounterActivityId = 0; | 220 core.int buildCounterActivityId = 0; |
222 buildActivityId() { | 221 buildActivityId() { |
223 var o = new api.ActivityId(); | 222 var o = new api.ActivityId(); |
224 buildCounterActivityId++; | 223 buildCounterActivityId++; |
225 if (buildCounterActivityId < 3) { | 224 if (buildCounterActivityId < 3) { |
226 o.applicationName = "foo"; | 225 o.applicationName = "foo"; |
227 o.customerId = "foo"; | 226 o.customerId = "foo"; |
228 o.time = core.DateTime.parse("2002-02-27T14:01:02"); | 227 o.time = core.DateTime.parse("2002-02-27T14:01:02"); |
229 o.uniqueQualifier = "foo"; | 228 o.uniqueQualifier = "foo"; |
230 } | 229 } |
231 buildCounterActivityId--; | 230 buildCounterActivityId--; |
232 return o; | 231 return o; |
233 } | 232 } |
234 | 233 |
235 checkActivityId(api.ActivityId o) { | 234 checkActivityId(api.ActivityId o) { |
236 buildCounterActivityId++; | 235 buildCounterActivityId++; |
237 if (buildCounterActivityId < 3) { | 236 if (buildCounterActivityId < 3) { |
238 unittest.expect(o.applicationName, unittest.equals('foo')); | 237 unittest.expect(o.applicationName, unittest.equals('foo')); |
239 unittest.expect(o.customerId, unittest.equals('foo')); | 238 unittest.expect(o.customerId, unittest.equals('foo')); |
240 unittest.expect(o.time, unittest.equals(core.DateTime.parse("2002-02-27T14:0
1:02"))); | 239 unittest.expect( |
| 240 o.time, unittest.equals(core.DateTime.parse("2002-02-27T14:01:02"))); |
241 unittest.expect(o.uniqueQualifier, unittest.equals('foo')); | 241 unittest.expect(o.uniqueQualifier, unittest.equals('foo')); |
242 } | 242 } |
243 buildCounterActivityId--; | 243 buildCounterActivityId--; |
244 } | 244 } |
245 | 245 |
246 core.int buildCounterActivity = 0; | 246 core.int buildCounterActivity = 0; |
247 buildActivity() { | 247 buildActivity() { |
248 var o = new api.Activity(); | 248 var o = new api.Activity(); |
249 buildCounterActivity++; | 249 buildCounterActivity++; |
250 if (buildCounterActivity < 3) { | 250 if (buildCounterActivity < 3) { |
251 o.actor = buildActivityActor(); | 251 o.actor = buildActivityActor(); |
252 o.etag = "foo"; | 252 o.etag = "foo"; |
253 o.events = buildUnnamed695(); | 253 o.events = buildUnnamed694(); |
254 o.id = buildActivityId(); | 254 o.id = buildActivityId(); |
255 o.ipAddress = "foo"; | 255 o.ipAddress = "foo"; |
256 o.kind = "foo"; | 256 o.kind = "foo"; |
257 o.ownerDomain = "foo"; | 257 o.ownerDomain = "foo"; |
258 } | 258 } |
259 buildCounterActivity--; | 259 buildCounterActivity--; |
260 return o; | 260 return o; |
261 } | 261 } |
262 | 262 |
263 checkActivity(api.Activity o) { | 263 checkActivity(api.Activity o) { |
264 buildCounterActivity++; | 264 buildCounterActivity++; |
265 if (buildCounterActivity < 3) { | 265 if (buildCounterActivity < 3) { |
266 checkActivityActor(o.actor); | 266 checkActivityActor(o.actor); |
267 unittest.expect(o.etag, unittest.equals('foo')); | 267 unittest.expect(o.etag, unittest.equals('foo')); |
268 checkUnnamed695(o.events); | 268 checkUnnamed694(o.events); |
269 checkActivityId(o.id); | 269 checkActivityId(o.id); |
270 unittest.expect(o.ipAddress, unittest.equals('foo')); | 270 unittest.expect(o.ipAddress, unittest.equals('foo')); |
271 unittest.expect(o.kind, unittest.equals('foo')); | 271 unittest.expect(o.kind, unittest.equals('foo')); |
272 unittest.expect(o.ownerDomain, unittest.equals('foo')); | 272 unittest.expect(o.ownerDomain, unittest.equals('foo')); |
273 } | 273 } |
274 buildCounterActivity--; | 274 buildCounterActivity--; |
275 } | 275 } |
276 | 276 |
277 buildUnnamed696() { | 277 buildUnnamed695() { |
278 var o = new core.Map<core.String, core.String>(); | 278 var o = new core.Map<core.String, core.String>(); |
279 o["x"] = "foo"; | 279 o["x"] = "foo"; |
280 o["y"] = "foo"; | 280 o["y"] = "foo"; |
281 return o; | 281 return o; |
282 } | 282 } |
283 | 283 |
284 checkUnnamed696(core.Map<core.String, core.String> o) { | 284 checkUnnamed695(core.Map<core.String, core.String> o) { |
285 unittest.expect(o, unittest.hasLength(2)); | 285 unittest.expect(o, unittest.hasLength(2)); |
286 unittest.expect(o["x"], unittest.equals('foo')); | 286 unittest.expect(o["x"], unittest.equals('foo')); |
287 unittest.expect(o["y"], unittest.equals('foo')); | 287 unittest.expect(o["y"], unittest.equals('foo')); |
288 } | 288 } |
289 | 289 |
290 core.int buildCounterChannel = 0; | 290 core.int buildCounterChannel = 0; |
291 buildChannel() { | 291 buildChannel() { |
292 var o = new api.Channel(); | 292 var o = new api.Channel(); |
293 buildCounterChannel++; | 293 buildCounterChannel++; |
294 if (buildCounterChannel < 3) { | 294 if (buildCounterChannel < 3) { |
295 o.address = "foo"; | 295 o.address = "foo"; |
296 o.expiration = "foo"; | 296 o.expiration = "foo"; |
297 o.id = "foo"; | 297 o.id = "foo"; |
298 o.kind = "foo"; | 298 o.kind = "foo"; |
299 o.params = buildUnnamed696(); | 299 o.params = buildUnnamed695(); |
300 o.payload = true; | 300 o.payload = true; |
301 o.resourceId = "foo"; | 301 o.resourceId = "foo"; |
302 o.resourceUri = "foo"; | 302 o.resourceUri = "foo"; |
303 o.token = "foo"; | 303 o.token = "foo"; |
304 o.type = "foo"; | 304 o.type = "foo"; |
305 } | 305 } |
306 buildCounterChannel--; | 306 buildCounterChannel--; |
307 return o; | 307 return o; |
308 } | 308 } |
309 | 309 |
310 checkChannel(api.Channel o) { | 310 checkChannel(api.Channel o) { |
311 buildCounterChannel++; | 311 buildCounterChannel++; |
312 if (buildCounterChannel < 3) { | 312 if (buildCounterChannel < 3) { |
313 unittest.expect(o.address, unittest.equals('foo')); | 313 unittest.expect(o.address, unittest.equals('foo')); |
314 unittest.expect(o.expiration, unittest.equals('foo')); | 314 unittest.expect(o.expiration, unittest.equals('foo')); |
315 unittest.expect(o.id, unittest.equals('foo')); | 315 unittest.expect(o.id, unittest.equals('foo')); |
316 unittest.expect(o.kind, unittest.equals('foo')); | 316 unittest.expect(o.kind, unittest.equals('foo')); |
317 checkUnnamed696(o.params); | 317 checkUnnamed695(o.params); |
318 unittest.expect(o.payload, unittest.isTrue); | 318 unittest.expect(o.payload, unittest.isTrue); |
319 unittest.expect(o.resourceId, unittest.equals('foo')); | 319 unittest.expect(o.resourceId, unittest.equals('foo')); |
320 unittest.expect(o.resourceUri, unittest.equals('foo')); | 320 unittest.expect(o.resourceUri, unittest.equals('foo')); |
321 unittest.expect(o.token, unittest.equals('foo')); | 321 unittest.expect(o.token, unittest.equals('foo')); |
322 unittest.expect(o.type, unittest.equals('foo')); | 322 unittest.expect(o.type, unittest.equals('foo')); |
323 } | 323 } |
324 buildCounterChannel--; | 324 buildCounterChannel--; |
325 } | 325 } |
326 | 326 |
327 core.int buildCounterUsageReportEntity = 0; | 327 core.int buildCounterUsageReportEntity = 0; |
(...skipping 14 matching lines...) Expand all Loading... |
342 buildCounterUsageReportEntity++; | 342 buildCounterUsageReportEntity++; |
343 if (buildCounterUsageReportEntity < 3) { | 343 if (buildCounterUsageReportEntity < 3) { |
344 unittest.expect(o.customerId, unittest.equals('foo')); | 344 unittest.expect(o.customerId, unittest.equals('foo')); |
345 unittest.expect(o.profileId, unittest.equals('foo')); | 345 unittest.expect(o.profileId, unittest.equals('foo')); |
346 unittest.expect(o.type, unittest.equals('foo')); | 346 unittest.expect(o.type, unittest.equals('foo')); |
347 unittest.expect(o.userEmail, unittest.equals('foo')); | 347 unittest.expect(o.userEmail, unittest.equals('foo')); |
348 } | 348 } |
349 buildCounterUsageReportEntity--; | 349 buildCounterUsageReportEntity--; |
350 } | 350 } |
351 | 351 |
352 buildUnnamed697() { | 352 buildUnnamed696() { |
353 var o = new core.Map<core.String, core.Object>(); | 353 var o = new core.Map<core.String, core.Object>(); |
354 o["x"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; | 354 o["x"] = { |
355 o["y"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; | 355 'list': [1, 2, 3], |
| 356 'bool': true, |
| 357 'string': 'foo' |
| 358 }; |
| 359 o["y"] = { |
| 360 'list': [1, 2, 3], |
| 361 'bool': true, |
| 362 'string': 'foo' |
| 363 }; |
356 return o; | 364 return o; |
357 } | 365 } |
358 | 366 |
359 checkUnnamed697(core.Map<core.String, core.Object> o) { | 367 checkUnnamed696(core.Map<core.String, core.Object> o) { |
360 unittest.expect(o, unittest.hasLength(2)); | 368 unittest.expect(o, unittest.hasLength(2)); |
361 var casted1 = (o["x"]) as core.Map; unittest.expect(casted1, unittest.hasLengt
h(3)); unittest.expect(casted1["list"], unittest.equals([1, 2, 3])); unittest.ex
pect(casted1["bool"], unittest.equals(true)); unittest.expect(casted1["string"],
unittest.equals('foo')); | 369 var casted1 = (o["x"]) as core.Map; |
362 var casted2 = (o["y"]) as core.Map; unittest.expect(casted2, unittest.hasLengt
h(3)); unittest.expect(casted2["list"], unittest.equals([1, 2, 3])); unittest.ex
pect(casted2["bool"], unittest.equals(true)); unittest.expect(casted2["string"],
unittest.equals('foo')); | 370 unittest.expect(casted1, unittest.hasLength(3)); |
| 371 unittest.expect(casted1["list"], unittest.equals([1, 2, 3])); |
| 372 unittest.expect(casted1["bool"], unittest.equals(true)); |
| 373 unittest.expect(casted1["string"], unittest.equals('foo')); |
| 374 var casted2 = (o["y"]) as core.Map; |
| 375 unittest.expect(casted2, unittest.hasLength(3)); |
| 376 unittest.expect(casted2["list"], unittest.equals([1, 2, 3])); |
| 377 unittest.expect(casted2["bool"], unittest.equals(true)); |
| 378 unittest.expect(casted2["string"], unittest.equals('foo')); |
363 } | 379 } |
364 | 380 |
365 buildUnnamed698() { | 381 buildUnnamed697() { |
366 var o = new core.List<core.Map<core.String, core.Object>>(); | 382 var o = new core.List<core.Map<core.String, core.Object>>(); |
367 o.add(buildUnnamed697()); | 383 o.add(buildUnnamed696()); |
368 o.add(buildUnnamed697()); | 384 o.add(buildUnnamed696()); |
369 return o; | 385 return o; |
370 } | 386 } |
371 | 387 |
372 checkUnnamed698(core.List<core.Map<core.String, core.Object>> o) { | 388 checkUnnamed697(core.List<core.Map<core.String, core.Object>> o) { |
373 unittest.expect(o, unittest.hasLength(2)); | 389 unittest.expect(o, unittest.hasLength(2)); |
374 checkUnnamed697(o[0]); | 390 checkUnnamed696(o[0]); |
375 checkUnnamed697(o[1]); | 391 checkUnnamed696(o[1]); |
376 } | 392 } |
377 | 393 |
378 core.int buildCounterUsageReportParameters = 0; | 394 core.int buildCounterUsageReportParameters = 0; |
379 buildUsageReportParameters() { | 395 buildUsageReportParameters() { |
380 var o = new api.UsageReportParameters(); | 396 var o = new api.UsageReportParameters(); |
381 buildCounterUsageReportParameters++; | 397 buildCounterUsageReportParameters++; |
382 if (buildCounterUsageReportParameters < 3) { | 398 if (buildCounterUsageReportParameters < 3) { |
383 o.boolValue = true; | 399 o.boolValue = true; |
384 o.datetimeValue = core.DateTime.parse("2002-02-27T14:01:02"); | 400 o.datetimeValue = core.DateTime.parse("2002-02-27T14:01:02"); |
385 o.intValue = "foo"; | 401 o.intValue = "foo"; |
386 o.msgValue = buildUnnamed698(); | 402 o.msgValue = buildUnnamed697(); |
387 o.name = "foo"; | 403 o.name = "foo"; |
388 o.stringValue = "foo"; | 404 o.stringValue = "foo"; |
389 } | 405 } |
390 buildCounterUsageReportParameters--; | 406 buildCounterUsageReportParameters--; |
391 return o; | 407 return o; |
392 } | 408 } |
393 | 409 |
394 checkUsageReportParameters(api.UsageReportParameters o) { | 410 checkUsageReportParameters(api.UsageReportParameters o) { |
395 buildCounterUsageReportParameters++; | 411 buildCounterUsageReportParameters++; |
396 if (buildCounterUsageReportParameters < 3) { | 412 if (buildCounterUsageReportParameters < 3) { |
397 unittest.expect(o.boolValue, unittest.isTrue); | 413 unittest.expect(o.boolValue, unittest.isTrue); |
398 unittest.expect(o.datetimeValue, unittest.equals(core.DateTime.parse("2002-0
2-27T14:01:02"))); | 414 unittest.expect(o.datetimeValue, |
| 415 unittest.equals(core.DateTime.parse("2002-02-27T14:01:02"))); |
399 unittest.expect(o.intValue, unittest.equals('foo')); | 416 unittest.expect(o.intValue, unittest.equals('foo')); |
400 checkUnnamed698(o.msgValue); | 417 checkUnnamed697(o.msgValue); |
401 unittest.expect(o.name, unittest.equals('foo')); | 418 unittest.expect(o.name, unittest.equals('foo')); |
402 unittest.expect(o.stringValue, unittest.equals('foo')); | 419 unittest.expect(o.stringValue, unittest.equals('foo')); |
403 } | 420 } |
404 buildCounterUsageReportParameters--; | 421 buildCounterUsageReportParameters--; |
405 } | 422 } |
406 | 423 |
407 buildUnnamed699() { | 424 buildUnnamed698() { |
408 var o = new core.List<api.UsageReportParameters>(); | 425 var o = new core.List<api.UsageReportParameters>(); |
409 o.add(buildUsageReportParameters()); | 426 o.add(buildUsageReportParameters()); |
410 o.add(buildUsageReportParameters()); | 427 o.add(buildUsageReportParameters()); |
411 return o; | 428 return o; |
412 } | 429 } |
413 | 430 |
414 checkUnnamed699(core.List<api.UsageReportParameters> o) { | 431 checkUnnamed698(core.List<api.UsageReportParameters> o) { |
415 unittest.expect(o, unittest.hasLength(2)); | 432 unittest.expect(o, unittest.hasLength(2)); |
416 checkUsageReportParameters(o[0]); | 433 checkUsageReportParameters(o[0]); |
417 checkUsageReportParameters(o[1]); | 434 checkUsageReportParameters(o[1]); |
418 } | 435 } |
419 | 436 |
420 core.int buildCounterUsageReport = 0; | 437 core.int buildCounterUsageReport = 0; |
421 buildUsageReport() { | 438 buildUsageReport() { |
422 var o = new api.UsageReport(); | 439 var o = new api.UsageReport(); |
423 buildCounterUsageReport++; | 440 buildCounterUsageReport++; |
424 if (buildCounterUsageReport < 3) { | 441 if (buildCounterUsageReport < 3) { |
425 o.date = "foo"; | 442 o.date = "foo"; |
426 o.entity = buildUsageReportEntity(); | 443 o.entity = buildUsageReportEntity(); |
427 o.etag = "foo"; | 444 o.etag = "foo"; |
428 o.kind = "foo"; | 445 o.kind = "foo"; |
429 o.parameters = buildUnnamed699(); | 446 o.parameters = buildUnnamed698(); |
430 } | 447 } |
431 buildCounterUsageReport--; | 448 buildCounterUsageReport--; |
432 return o; | 449 return o; |
433 } | 450 } |
434 | 451 |
435 checkUsageReport(api.UsageReport o) { | 452 checkUsageReport(api.UsageReport o) { |
436 buildCounterUsageReport++; | 453 buildCounterUsageReport++; |
437 if (buildCounterUsageReport < 3) { | 454 if (buildCounterUsageReport < 3) { |
438 unittest.expect(o.date, unittest.equals('foo')); | 455 unittest.expect(o.date, unittest.equals('foo')); |
439 checkUsageReportEntity(o.entity); | 456 checkUsageReportEntity(o.entity); |
440 unittest.expect(o.etag, unittest.equals('foo')); | 457 unittest.expect(o.etag, unittest.equals('foo')); |
441 unittest.expect(o.kind, unittest.equals('foo')); | 458 unittest.expect(o.kind, unittest.equals('foo')); |
442 checkUnnamed699(o.parameters); | 459 checkUnnamed698(o.parameters); |
443 } | 460 } |
444 buildCounterUsageReport--; | 461 buildCounterUsageReport--; |
445 } | 462 } |
446 | 463 |
447 buildUnnamed700() { | 464 buildUnnamed699() { |
448 var o = new core.List<api.UsageReport>(); | 465 var o = new core.List<api.UsageReport>(); |
449 o.add(buildUsageReport()); | 466 o.add(buildUsageReport()); |
450 o.add(buildUsageReport()); | 467 o.add(buildUsageReport()); |
451 return o; | 468 return o; |
452 } | 469 } |
453 | 470 |
454 checkUnnamed700(core.List<api.UsageReport> o) { | 471 checkUnnamed699(core.List<api.UsageReport> o) { |
455 unittest.expect(o, unittest.hasLength(2)); | 472 unittest.expect(o, unittest.hasLength(2)); |
456 checkUsageReport(o[0]); | 473 checkUsageReport(o[0]); |
457 checkUsageReport(o[1]); | 474 checkUsageReport(o[1]); |
458 } | 475 } |
459 | 476 |
460 core.int buildCounterUsageReportsWarningsData = 0; | 477 core.int buildCounterUsageReportsWarningsData = 0; |
461 buildUsageReportsWarningsData() { | 478 buildUsageReportsWarningsData() { |
462 var o = new api.UsageReportsWarningsData(); | 479 var o = new api.UsageReportsWarningsData(); |
463 buildCounterUsageReportsWarningsData++; | 480 buildCounterUsageReportsWarningsData++; |
464 if (buildCounterUsageReportsWarningsData < 3) { | 481 if (buildCounterUsageReportsWarningsData < 3) { |
465 o.key = "foo"; | 482 o.key = "foo"; |
466 o.value = "foo"; | 483 o.value = "foo"; |
467 } | 484 } |
468 buildCounterUsageReportsWarningsData--; | 485 buildCounterUsageReportsWarningsData--; |
469 return o; | 486 return o; |
470 } | 487 } |
471 | 488 |
472 checkUsageReportsWarningsData(api.UsageReportsWarningsData o) { | 489 checkUsageReportsWarningsData(api.UsageReportsWarningsData o) { |
473 buildCounterUsageReportsWarningsData++; | 490 buildCounterUsageReportsWarningsData++; |
474 if (buildCounterUsageReportsWarningsData < 3) { | 491 if (buildCounterUsageReportsWarningsData < 3) { |
475 unittest.expect(o.key, unittest.equals('foo')); | 492 unittest.expect(o.key, unittest.equals('foo')); |
476 unittest.expect(o.value, unittest.equals('foo')); | 493 unittest.expect(o.value, unittest.equals('foo')); |
477 } | 494 } |
478 buildCounterUsageReportsWarningsData--; | 495 buildCounterUsageReportsWarningsData--; |
479 } | 496 } |
480 | 497 |
481 buildUnnamed701() { | 498 buildUnnamed700() { |
482 var o = new core.List<api.UsageReportsWarningsData>(); | 499 var o = new core.List<api.UsageReportsWarningsData>(); |
483 o.add(buildUsageReportsWarningsData()); | 500 o.add(buildUsageReportsWarningsData()); |
484 o.add(buildUsageReportsWarningsData()); | 501 o.add(buildUsageReportsWarningsData()); |
485 return o; | 502 return o; |
486 } | 503 } |
487 | 504 |
488 checkUnnamed701(core.List<api.UsageReportsWarningsData> o) { | 505 checkUnnamed700(core.List<api.UsageReportsWarningsData> o) { |
489 unittest.expect(o, unittest.hasLength(2)); | 506 unittest.expect(o, unittest.hasLength(2)); |
490 checkUsageReportsWarningsData(o[0]); | 507 checkUsageReportsWarningsData(o[0]); |
491 checkUsageReportsWarningsData(o[1]); | 508 checkUsageReportsWarningsData(o[1]); |
492 } | 509 } |
493 | 510 |
494 core.int buildCounterUsageReportsWarnings = 0; | 511 core.int buildCounterUsageReportsWarnings = 0; |
495 buildUsageReportsWarnings() { | 512 buildUsageReportsWarnings() { |
496 var o = new api.UsageReportsWarnings(); | 513 var o = new api.UsageReportsWarnings(); |
497 buildCounterUsageReportsWarnings++; | 514 buildCounterUsageReportsWarnings++; |
498 if (buildCounterUsageReportsWarnings < 3) { | 515 if (buildCounterUsageReportsWarnings < 3) { |
499 o.code = "foo"; | 516 o.code = "foo"; |
500 o.data = buildUnnamed701(); | 517 o.data = buildUnnamed700(); |
501 o.message = "foo"; | 518 o.message = "foo"; |
502 } | 519 } |
503 buildCounterUsageReportsWarnings--; | 520 buildCounterUsageReportsWarnings--; |
504 return o; | 521 return o; |
505 } | 522 } |
506 | 523 |
507 checkUsageReportsWarnings(api.UsageReportsWarnings o) { | 524 checkUsageReportsWarnings(api.UsageReportsWarnings o) { |
508 buildCounterUsageReportsWarnings++; | 525 buildCounterUsageReportsWarnings++; |
509 if (buildCounterUsageReportsWarnings < 3) { | 526 if (buildCounterUsageReportsWarnings < 3) { |
510 unittest.expect(o.code, unittest.equals('foo')); | 527 unittest.expect(o.code, unittest.equals('foo')); |
511 checkUnnamed701(o.data); | 528 checkUnnamed700(o.data); |
512 unittest.expect(o.message, unittest.equals('foo')); | 529 unittest.expect(o.message, unittest.equals('foo')); |
513 } | 530 } |
514 buildCounterUsageReportsWarnings--; | 531 buildCounterUsageReportsWarnings--; |
515 } | 532 } |
516 | 533 |
517 buildUnnamed702() { | 534 buildUnnamed701() { |
518 var o = new core.List<api.UsageReportsWarnings>(); | 535 var o = new core.List<api.UsageReportsWarnings>(); |
519 o.add(buildUsageReportsWarnings()); | 536 o.add(buildUsageReportsWarnings()); |
520 o.add(buildUsageReportsWarnings()); | 537 o.add(buildUsageReportsWarnings()); |
521 return o; | 538 return o; |
522 } | 539 } |
523 | 540 |
524 checkUnnamed702(core.List<api.UsageReportsWarnings> o) { | 541 checkUnnamed701(core.List<api.UsageReportsWarnings> o) { |
525 unittest.expect(o, unittest.hasLength(2)); | 542 unittest.expect(o, unittest.hasLength(2)); |
526 checkUsageReportsWarnings(o[0]); | 543 checkUsageReportsWarnings(o[0]); |
527 checkUsageReportsWarnings(o[1]); | 544 checkUsageReportsWarnings(o[1]); |
528 } | 545 } |
529 | 546 |
530 core.int buildCounterUsageReports = 0; | 547 core.int buildCounterUsageReports = 0; |
531 buildUsageReports() { | 548 buildUsageReports() { |
532 var o = new api.UsageReports(); | 549 var o = new api.UsageReports(); |
533 buildCounterUsageReports++; | 550 buildCounterUsageReports++; |
534 if (buildCounterUsageReports < 3) { | 551 if (buildCounterUsageReports < 3) { |
535 o.etag = "foo"; | 552 o.etag = "foo"; |
536 o.kind = "foo"; | 553 o.kind = "foo"; |
537 o.nextPageToken = "foo"; | 554 o.nextPageToken = "foo"; |
538 o.usageReports = buildUnnamed700(); | 555 o.usageReports = buildUnnamed699(); |
539 o.warnings = buildUnnamed702(); | 556 o.warnings = buildUnnamed701(); |
540 } | 557 } |
541 buildCounterUsageReports--; | 558 buildCounterUsageReports--; |
542 return o; | 559 return o; |
543 } | 560 } |
544 | 561 |
545 checkUsageReports(api.UsageReports o) { | 562 checkUsageReports(api.UsageReports o) { |
546 buildCounterUsageReports++; | 563 buildCounterUsageReports++; |
547 if (buildCounterUsageReports < 3) { | 564 if (buildCounterUsageReports < 3) { |
548 unittest.expect(o.etag, unittest.equals('foo')); | 565 unittest.expect(o.etag, unittest.equals('foo')); |
549 unittest.expect(o.kind, unittest.equals('foo')); | 566 unittest.expect(o.kind, unittest.equals('foo')); |
550 unittest.expect(o.nextPageToken, unittest.equals('foo')); | 567 unittest.expect(o.nextPageToken, unittest.equals('foo')); |
551 checkUnnamed700(o.usageReports); | 568 checkUnnamed699(o.usageReports); |
552 checkUnnamed702(o.warnings); | 569 checkUnnamed701(o.warnings); |
553 } | 570 } |
554 buildCounterUsageReports--; | 571 buildCounterUsageReports--; |
555 } | 572 } |
556 | 573 |
557 | |
558 main() { | 574 main() { |
559 unittest.group("obj-schema-Activities", () { | 575 unittest.group("obj-schema-Activities", () { |
560 unittest.test("to-json--from-json", () { | 576 unittest.test("to-json--from-json", () { |
561 var o = buildActivities(); | 577 var o = buildActivities(); |
562 var od = new api.Activities.fromJson(o.toJson()); | 578 var od = new api.Activities.fromJson(o.toJson()); |
563 checkActivities(od); | 579 checkActivities(od); |
564 }); | 580 }); |
565 }); | 581 }); |
566 | 582 |
567 | |
568 unittest.group("obj-schema-ActivityActor", () { | 583 unittest.group("obj-schema-ActivityActor", () { |
569 unittest.test("to-json--from-json", () { | 584 unittest.test("to-json--from-json", () { |
570 var o = buildActivityActor(); | 585 var o = buildActivityActor(); |
571 var od = new api.ActivityActor.fromJson(o.toJson()); | 586 var od = new api.ActivityActor.fromJson(o.toJson()); |
572 checkActivityActor(od); | 587 checkActivityActor(od); |
573 }); | 588 }); |
574 }); | 589 }); |
575 | 590 |
576 | |
577 unittest.group("obj-schema-ActivityEventsParameters", () { | 591 unittest.group("obj-schema-ActivityEventsParameters", () { |
578 unittest.test("to-json--from-json", () { | 592 unittest.test("to-json--from-json", () { |
579 var o = buildActivityEventsParameters(); | 593 var o = buildActivityEventsParameters(); |
580 var od = new api.ActivityEventsParameters.fromJson(o.toJson()); | 594 var od = new api.ActivityEventsParameters.fromJson(o.toJson()); |
581 checkActivityEventsParameters(od); | 595 checkActivityEventsParameters(od); |
582 }); | 596 }); |
583 }); | 597 }); |
584 | 598 |
585 | |
586 unittest.group("obj-schema-ActivityEvents", () { | 599 unittest.group("obj-schema-ActivityEvents", () { |
587 unittest.test("to-json--from-json", () { | 600 unittest.test("to-json--from-json", () { |
588 var o = buildActivityEvents(); | 601 var o = buildActivityEvents(); |
589 var od = new api.ActivityEvents.fromJson(o.toJson()); | 602 var od = new api.ActivityEvents.fromJson(o.toJson()); |
590 checkActivityEvents(od); | 603 checkActivityEvents(od); |
591 }); | 604 }); |
592 }); | 605 }); |
593 | 606 |
594 | |
595 unittest.group("obj-schema-ActivityId", () { | 607 unittest.group("obj-schema-ActivityId", () { |
596 unittest.test("to-json--from-json", () { | 608 unittest.test("to-json--from-json", () { |
597 var o = buildActivityId(); | 609 var o = buildActivityId(); |
598 var od = new api.ActivityId.fromJson(o.toJson()); | 610 var od = new api.ActivityId.fromJson(o.toJson()); |
599 checkActivityId(od); | 611 checkActivityId(od); |
600 }); | 612 }); |
601 }); | 613 }); |
602 | 614 |
603 | |
604 unittest.group("obj-schema-Activity", () { | 615 unittest.group("obj-schema-Activity", () { |
605 unittest.test("to-json--from-json", () { | 616 unittest.test("to-json--from-json", () { |
606 var o = buildActivity(); | 617 var o = buildActivity(); |
607 var od = new api.Activity.fromJson(o.toJson()); | 618 var od = new api.Activity.fromJson(o.toJson()); |
608 checkActivity(od); | 619 checkActivity(od); |
609 }); | 620 }); |
610 }); | 621 }); |
611 | 622 |
612 | |
613 unittest.group("obj-schema-Channel", () { | 623 unittest.group("obj-schema-Channel", () { |
614 unittest.test("to-json--from-json", () { | 624 unittest.test("to-json--from-json", () { |
615 var o = buildChannel(); | 625 var o = buildChannel(); |
616 var od = new api.Channel.fromJson(o.toJson()); | 626 var od = new api.Channel.fromJson(o.toJson()); |
617 checkChannel(od); | 627 checkChannel(od); |
618 }); | 628 }); |
619 }); | 629 }); |
620 | 630 |
621 | |
622 unittest.group("obj-schema-UsageReportEntity", () { | 631 unittest.group("obj-schema-UsageReportEntity", () { |
623 unittest.test("to-json--from-json", () { | 632 unittest.test("to-json--from-json", () { |
624 var o = buildUsageReportEntity(); | 633 var o = buildUsageReportEntity(); |
625 var od = new api.UsageReportEntity.fromJson(o.toJson()); | 634 var od = new api.UsageReportEntity.fromJson(o.toJson()); |
626 checkUsageReportEntity(od); | 635 checkUsageReportEntity(od); |
627 }); | 636 }); |
628 }); | 637 }); |
629 | 638 |
630 | |
631 unittest.group("obj-schema-UsageReportParameters", () { | 639 unittest.group("obj-schema-UsageReportParameters", () { |
632 unittest.test("to-json--from-json", () { | 640 unittest.test("to-json--from-json", () { |
633 var o = buildUsageReportParameters(); | 641 var o = buildUsageReportParameters(); |
634 var od = new api.UsageReportParameters.fromJson(o.toJson()); | 642 var od = new api.UsageReportParameters.fromJson(o.toJson()); |
635 checkUsageReportParameters(od); | 643 checkUsageReportParameters(od); |
636 }); | 644 }); |
637 }); | 645 }); |
638 | 646 |
639 | |
640 unittest.group("obj-schema-UsageReport", () { | 647 unittest.group("obj-schema-UsageReport", () { |
641 unittest.test("to-json--from-json", () { | 648 unittest.test("to-json--from-json", () { |
642 var o = buildUsageReport(); | 649 var o = buildUsageReport(); |
643 var od = new api.UsageReport.fromJson(o.toJson()); | 650 var od = new api.UsageReport.fromJson(o.toJson()); |
644 checkUsageReport(od); | 651 checkUsageReport(od); |
645 }); | 652 }); |
646 }); | 653 }); |
647 | 654 |
648 | |
649 unittest.group("obj-schema-UsageReportsWarningsData", () { | 655 unittest.group("obj-schema-UsageReportsWarningsData", () { |
650 unittest.test("to-json--from-json", () { | 656 unittest.test("to-json--from-json", () { |
651 var o = buildUsageReportsWarningsData(); | 657 var o = buildUsageReportsWarningsData(); |
652 var od = new api.UsageReportsWarningsData.fromJson(o.toJson()); | 658 var od = new api.UsageReportsWarningsData.fromJson(o.toJson()); |
653 checkUsageReportsWarningsData(od); | 659 checkUsageReportsWarningsData(od); |
654 }); | 660 }); |
655 }); | 661 }); |
656 | 662 |
657 | |
658 unittest.group("obj-schema-UsageReportsWarnings", () { | 663 unittest.group("obj-schema-UsageReportsWarnings", () { |
659 unittest.test("to-json--from-json", () { | 664 unittest.test("to-json--from-json", () { |
660 var o = buildUsageReportsWarnings(); | 665 var o = buildUsageReportsWarnings(); |
661 var od = new api.UsageReportsWarnings.fromJson(o.toJson()); | 666 var od = new api.UsageReportsWarnings.fromJson(o.toJson()); |
662 checkUsageReportsWarnings(od); | 667 checkUsageReportsWarnings(od); |
663 }); | 668 }); |
664 }); | 669 }); |
665 | 670 |
666 | |
667 unittest.group("obj-schema-UsageReports", () { | 671 unittest.group("obj-schema-UsageReports", () { |
668 unittest.test("to-json--from-json", () { | 672 unittest.test("to-json--from-json", () { |
669 var o = buildUsageReports(); | 673 var o = buildUsageReports(); |
670 var od = new api.UsageReports.fromJson(o.toJson()); | 674 var od = new api.UsageReports.fromJson(o.toJson()); |
671 checkUsageReports(od); | 675 checkUsageReports(od); |
672 }); | 676 }); |
673 }); | 677 }); |
674 | 678 |
675 | |
676 unittest.group("resource-ActivitiesResourceApi", () { | 679 unittest.group("resource-ActivitiesResourceApi", () { |
677 unittest.test("method--list", () { | 680 unittest.test("method--list", () { |
678 | |
679 var mock = new HttpServerMock(); | 681 var mock = new HttpServerMock(); |
680 api.ActivitiesResourceApi res = new api.AdminApi(mock).activities; | 682 api.ActivitiesResourceApi res = new api.AdminApi(mock).activities; |
681 var arg_userKey = "foo"; | 683 var arg_userKey = "foo"; |
682 var arg_applicationName = "foo"; | 684 var arg_applicationName = "foo"; |
683 var arg_actorIpAddress = "foo"; | 685 var arg_actorIpAddress = "foo"; |
684 var arg_customerId = "foo"; | 686 var arg_customerId = "foo"; |
685 var arg_endTime = "foo"; | 687 var arg_endTime = "foo"; |
686 var arg_eventName = "foo"; | 688 var arg_eventName = "foo"; |
687 var arg_filters = "foo"; | 689 var arg_filters = "foo"; |
688 var arg_maxResults = 42; | 690 var arg_maxResults = 42; |
689 var arg_pageToken = "foo"; | 691 var arg_pageToken = "foo"; |
690 var arg_startTime = "foo"; | 692 var arg_startTime = "foo"; |
691 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 693 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
692 var path = (req.url).path; | 694 var path = (req.url).path; |
693 var pathOffset = 0; | 695 var pathOffset = 0; |
694 var index; | 696 var index; |
695 var subPart; | 697 var subPart; |
696 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 698 unittest.expect( |
| 699 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
697 pathOffset += 1; | 700 pathOffset += 1; |
698 unittest.expect(path.substring(pathOffset, pathOffset + 17), unittest.eq
uals("admin/reports/v1/")); | 701 unittest.expect(path.substring(pathOffset, pathOffset + 17), |
| 702 unittest.equals("admin/reports/v1/")); |
699 pathOffset += 17; | 703 pathOffset += 17; |
700 unittest.expect(path.substring(pathOffset, pathOffset + 15), unittest.eq
uals("activity/users/")); | 704 unittest.expect(path.substring(pathOffset, pathOffset + 15), |
| 705 unittest.equals("activity/users/")); |
701 pathOffset += 15; | 706 pathOffset += 15; |
702 index = path.indexOf("/applications/", pathOffset); | 707 index = path.indexOf("/applications/", pathOffset); |
703 unittest.expect(index >= 0, unittest.isTrue); | 708 unittest.expect(index >= 0, unittest.isTrue); |
704 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | 709 subPart = |
| 710 core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
705 pathOffset = index; | 711 pathOffset = index; |
706 unittest.expect(subPart, unittest.equals("$arg_userKey")); | 712 unittest.expect(subPart, unittest.equals("$arg_userKey")); |
707 unittest.expect(path.substring(pathOffset, pathOffset + 14), unittest.eq
uals("/applications/")); | 713 unittest.expect(path.substring(pathOffset, pathOffset + 14), |
| 714 unittest.equals("/applications/")); |
708 pathOffset += 14; | 715 pathOffset += 14; |
709 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); | 716 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
710 pathOffset = path.length; | 717 pathOffset = path.length; |
711 unittest.expect(subPart, unittest.equals("$arg_applicationName")); | 718 unittest.expect(subPart, unittest.equals("$arg_applicationName")); |
712 | 719 |
713 var query = (req.url).query; | 720 var query = (req.url).query; |
714 var queryOffset = 0; | 721 var queryOffset = 0; |
715 var queryMap = {}; | 722 var queryMap = {}; |
716 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 723 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
717 parseBool(n) { | 724 parseBool(n) { |
718 if (n == "true") return true; | 725 if (n == "true") return true; |
719 if (n == "false") return false; | 726 if (n == "false") return false; |
720 if (n == null) return null; | 727 if (n == null) return null; |
721 throw new core.ArgumentError("Invalid boolean: $n"); | 728 throw new core.ArgumentError("Invalid boolean: $n"); |
722 } | 729 } |
| 730 |
723 if (query.length > 0) { | 731 if (query.length > 0) { |
724 for (var part in query.split("&")) { | 732 for (var part in query.split("&")) { |
725 var keyvalue = part.split("="); | 733 var keyvalue = part.split("="); |
726 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 734 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 735 core.Uri.decodeQueryComponent(keyvalue[1])); |
727 } | 736 } |
728 } | 737 } |
729 unittest.expect(queryMap["actorIpAddress"].first, unittest.equals(arg_ac
torIpAddress)); | 738 unittest.expect(queryMap["actorIpAddress"].first, |
730 unittest.expect(queryMap["customerId"].first, unittest.equals(arg_custom
erId)); | 739 unittest.equals(arg_actorIpAddress)); |
731 unittest.expect(queryMap["endTime"].first, unittest.equals(arg_endTime))
; | 740 unittest.expect( |
732 unittest.expect(queryMap["eventName"].first, unittest.equals(arg_eventNa
me)); | 741 queryMap["customerId"].first, unittest.equals(arg_customerId)); |
733 unittest.expect(queryMap["filters"].first, unittest.equals(arg_filters))
; | 742 unittest.expect( |
734 unittest.expect(core.int.parse(queryMap["maxResults"].first), unittest.e
quals(arg_maxResults)); | 743 queryMap["endTime"].first, unittest.equals(arg_endTime)); |
735 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); | 744 unittest.expect( |
736 unittest.expect(queryMap["startTime"].first, unittest.equals(arg_startTi
me)); | 745 queryMap["eventName"].first, unittest.equals(arg_eventName)); |
737 | 746 unittest.expect( |
| 747 queryMap["filters"].first, unittest.equals(arg_filters)); |
| 748 unittest.expect(core.int.parse(queryMap["maxResults"].first), |
| 749 unittest.equals(arg_maxResults)); |
| 750 unittest.expect( |
| 751 queryMap["pageToken"].first, unittest.equals(arg_pageToken)); |
| 752 unittest.expect( |
| 753 queryMap["startTime"].first, unittest.equals(arg_startTime)); |
738 | 754 |
739 var h = { | 755 var h = { |
740 "content-type" : "application/json; charset=utf-8", | 756 "content-type": "application/json; charset=utf-8", |
741 }; | 757 }; |
742 var resp = convert.JSON.encode(buildActivities()); | 758 var resp = convert.JSON.encode(buildActivities()); |
743 return new async.Future.value(stringResponse(200, h, resp)); | 759 return new async.Future.value(stringResponse(200, h, resp)); |
744 }), true); | 760 }), true); |
745 res.list(arg_userKey, arg_applicationName, actorIpAddress: arg_actorIpAddr
ess, customerId: arg_customerId, endTime: arg_endTime, eventName: arg_eventName,
filters: arg_filters, maxResults: arg_maxResults, pageToken: arg_pageToken, sta
rtTime: arg_startTime).then(unittest.expectAsync1(((api.Activities response) { | 761 res |
| 762 .list(arg_userKey, arg_applicationName, |
| 763 actorIpAddress: arg_actorIpAddress, |
| 764 customerId: arg_customerId, |
| 765 endTime: arg_endTime, |
| 766 eventName: arg_eventName, |
| 767 filters: arg_filters, |
| 768 maxResults: arg_maxResults, |
| 769 pageToken: arg_pageToken, |
| 770 startTime: arg_startTime) |
| 771 .then(unittest.expectAsync1(((api.Activities response) { |
746 checkActivities(response); | 772 checkActivities(response); |
747 }))); | 773 }))); |
748 }); | 774 }); |
749 | 775 |
750 unittest.test("method--watch", () { | 776 unittest.test("method--watch", () { |
751 | |
752 var mock = new HttpServerMock(); | 777 var mock = new HttpServerMock(); |
753 api.ActivitiesResourceApi res = new api.AdminApi(mock).activities; | 778 api.ActivitiesResourceApi res = new api.AdminApi(mock).activities; |
754 var arg_request = buildChannel(); | 779 var arg_request = buildChannel(); |
755 var arg_userKey = "foo"; | 780 var arg_userKey = "foo"; |
756 var arg_applicationName = "foo"; | 781 var arg_applicationName = "foo"; |
757 var arg_actorIpAddress = "foo"; | 782 var arg_actorIpAddress = "foo"; |
758 var arg_customerId = "foo"; | 783 var arg_customerId = "foo"; |
759 var arg_endTime = "foo"; | 784 var arg_endTime = "foo"; |
760 var arg_eventName = "foo"; | 785 var arg_eventName = "foo"; |
761 var arg_filters = "foo"; | 786 var arg_filters = "foo"; |
762 var arg_maxResults = 42; | 787 var arg_maxResults = 42; |
763 var arg_pageToken = "foo"; | 788 var arg_pageToken = "foo"; |
764 var arg_startTime = "foo"; | 789 var arg_startTime = "foo"; |
765 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 790 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
766 var obj = new api.Channel.fromJson(json); | 791 var obj = new api.Channel.fromJson(json); |
767 checkChannel(obj); | 792 checkChannel(obj); |
768 | 793 |
769 var path = (req.url).path; | 794 var path = (req.url).path; |
770 var pathOffset = 0; | 795 var pathOffset = 0; |
771 var index; | 796 var index; |
772 var subPart; | 797 var subPart; |
773 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 798 unittest.expect( |
| 799 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
774 pathOffset += 1; | 800 pathOffset += 1; |
775 unittest.expect(path.substring(pathOffset, pathOffset + 17), unittest.eq
uals("admin/reports/v1/")); | 801 unittest.expect(path.substring(pathOffset, pathOffset + 17), |
| 802 unittest.equals("admin/reports/v1/")); |
776 pathOffset += 17; | 803 pathOffset += 17; |
777 unittest.expect(path.substring(pathOffset, pathOffset + 15), unittest.eq
uals("activity/users/")); | 804 unittest.expect(path.substring(pathOffset, pathOffset + 15), |
| 805 unittest.equals("activity/users/")); |
778 pathOffset += 15; | 806 pathOffset += 15; |
779 index = path.indexOf("/applications/", pathOffset); | 807 index = path.indexOf("/applications/", pathOffset); |
780 unittest.expect(index >= 0, unittest.isTrue); | 808 unittest.expect(index >= 0, unittest.isTrue); |
781 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | 809 subPart = |
| 810 core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
782 pathOffset = index; | 811 pathOffset = index; |
783 unittest.expect(subPart, unittest.equals("$arg_userKey")); | 812 unittest.expect(subPart, unittest.equals("$arg_userKey")); |
784 unittest.expect(path.substring(pathOffset, pathOffset + 14), unittest.eq
uals("/applications/")); | 813 unittest.expect(path.substring(pathOffset, pathOffset + 14), |
| 814 unittest.equals("/applications/")); |
785 pathOffset += 14; | 815 pathOffset += 14; |
786 index = path.indexOf("/watch", pathOffset); | 816 index = path.indexOf("/watch", pathOffset); |
787 unittest.expect(index >= 0, unittest.isTrue); | 817 unittest.expect(index >= 0, unittest.isTrue); |
788 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | 818 subPart = |
| 819 core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
789 pathOffset = index; | 820 pathOffset = index; |
790 unittest.expect(subPart, unittest.equals("$arg_applicationName")); | 821 unittest.expect(subPart, unittest.equals("$arg_applicationName")); |
791 unittest.expect(path.substring(pathOffset, pathOffset + 6), unittest.equ
als("/watch")); | 822 unittest.expect(path.substring(pathOffset, pathOffset + 6), |
| 823 unittest.equals("/watch")); |
792 pathOffset += 6; | 824 pathOffset += 6; |
793 | 825 |
794 var query = (req.url).query; | 826 var query = (req.url).query; |
795 var queryOffset = 0; | 827 var queryOffset = 0; |
796 var queryMap = {}; | 828 var queryMap = {}; |
797 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 829 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
798 parseBool(n) { | 830 parseBool(n) { |
799 if (n == "true") return true; | 831 if (n == "true") return true; |
800 if (n == "false") return false; | 832 if (n == "false") return false; |
801 if (n == null) return null; | 833 if (n == null) return null; |
802 throw new core.ArgumentError("Invalid boolean: $n"); | 834 throw new core.ArgumentError("Invalid boolean: $n"); |
803 } | 835 } |
| 836 |
804 if (query.length > 0) { | 837 if (query.length > 0) { |
805 for (var part in query.split("&")) { | 838 for (var part in query.split("&")) { |
806 var keyvalue = part.split("="); | 839 var keyvalue = part.split("="); |
807 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 840 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 841 core.Uri.decodeQueryComponent(keyvalue[1])); |
808 } | 842 } |
809 } | 843 } |
810 unittest.expect(queryMap["actorIpAddress"].first, unittest.equals(arg_ac
torIpAddress)); | 844 unittest.expect(queryMap["actorIpAddress"].first, |
811 unittest.expect(queryMap["customerId"].first, unittest.equals(arg_custom
erId)); | 845 unittest.equals(arg_actorIpAddress)); |
812 unittest.expect(queryMap["endTime"].first, unittest.equals(arg_endTime))
; | 846 unittest.expect( |
813 unittest.expect(queryMap["eventName"].first, unittest.equals(arg_eventNa
me)); | 847 queryMap["customerId"].first, unittest.equals(arg_customerId)); |
814 unittest.expect(queryMap["filters"].first, unittest.equals(arg_filters))
; | 848 unittest.expect( |
815 unittest.expect(core.int.parse(queryMap["maxResults"].first), unittest.e
quals(arg_maxResults)); | 849 queryMap["endTime"].first, unittest.equals(arg_endTime)); |
816 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); | 850 unittest.expect( |
817 unittest.expect(queryMap["startTime"].first, unittest.equals(arg_startTi
me)); | 851 queryMap["eventName"].first, unittest.equals(arg_eventName)); |
818 | 852 unittest.expect( |
| 853 queryMap["filters"].first, unittest.equals(arg_filters)); |
| 854 unittest.expect(core.int.parse(queryMap["maxResults"].first), |
| 855 unittest.equals(arg_maxResults)); |
| 856 unittest.expect( |
| 857 queryMap["pageToken"].first, unittest.equals(arg_pageToken)); |
| 858 unittest.expect( |
| 859 queryMap["startTime"].first, unittest.equals(arg_startTime)); |
819 | 860 |
820 var h = { | 861 var h = { |
821 "content-type" : "application/json; charset=utf-8", | 862 "content-type": "application/json; charset=utf-8", |
822 }; | 863 }; |
823 var resp = convert.JSON.encode(buildChannel()); | 864 var resp = convert.JSON.encode(buildChannel()); |
824 return new async.Future.value(stringResponse(200, h, resp)); | 865 return new async.Future.value(stringResponse(200, h, resp)); |
825 }), true); | 866 }), true); |
826 res.watch(arg_request, arg_userKey, arg_applicationName, actorIpAddress: a
rg_actorIpAddress, customerId: arg_customerId, endTime: arg_endTime, eventName:
arg_eventName, filters: arg_filters, maxResults: arg_maxResults, pageToken: arg_
pageToken, startTime: arg_startTime).then(unittest.expectAsync1(((api.Channel re
sponse) { | 867 res |
| 868 .watch(arg_request, arg_userKey, arg_applicationName, |
| 869 actorIpAddress: arg_actorIpAddress, |
| 870 customerId: arg_customerId, |
| 871 endTime: arg_endTime, |
| 872 eventName: arg_eventName, |
| 873 filters: arg_filters, |
| 874 maxResults: arg_maxResults, |
| 875 pageToken: arg_pageToken, |
| 876 startTime: arg_startTime) |
| 877 .then(unittest.expectAsync1(((api.Channel response) { |
827 checkChannel(response); | 878 checkChannel(response); |
828 }))); | 879 }))); |
829 }); | 880 }); |
830 | |
831 }); | 881 }); |
832 | 882 |
833 | |
834 unittest.group("resource-ChannelsResourceApi", () { | 883 unittest.group("resource-ChannelsResourceApi", () { |
835 unittest.test("method--stop", () { | 884 unittest.test("method--stop", () { |
836 | |
837 var mock = new HttpServerMock(); | 885 var mock = new HttpServerMock(); |
838 api.ChannelsResourceApi res = new api.AdminApi(mock).channels; | 886 api.ChannelsResourceApi res = new api.AdminApi(mock).channels; |
839 var arg_request = buildChannel(); | 887 var arg_request = buildChannel(); |
840 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 888 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
841 var obj = new api.Channel.fromJson(json); | 889 var obj = new api.Channel.fromJson(json); |
842 checkChannel(obj); | 890 checkChannel(obj); |
843 | 891 |
844 var path = (req.url).path; | 892 var path = (req.url).path; |
845 var pathOffset = 0; | 893 var pathOffset = 0; |
846 var index; | 894 var index; |
847 var subPart; | 895 var subPart; |
848 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 896 unittest.expect( |
| 897 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
849 pathOffset += 1; | 898 pathOffset += 1; |
850 unittest.expect(path.substring(pathOffset, pathOffset + 30), unittest.eq
uals("admin/reports_v1/channels/stop")); | 899 unittest.expect(path.substring(pathOffset, pathOffset + 30), |
| 900 unittest.equals("admin/reports_v1/channels/stop")); |
851 pathOffset += 30; | 901 pathOffset += 30; |
852 | 902 |
853 var query = (req.url).query; | 903 var query = (req.url).query; |
854 var queryOffset = 0; | 904 var queryOffset = 0; |
855 var queryMap = {}; | 905 var queryMap = {}; |
856 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 906 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
857 parseBool(n) { | 907 parseBool(n) { |
858 if (n == "true") return true; | 908 if (n == "true") return true; |
859 if (n == "false") return false; | 909 if (n == "false") return false; |
860 if (n == null) return null; | 910 if (n == null) return null; |
861 throw new core.ArgumentError("Invalid boolean: $n"); | 911 throw new core.ArgumentError("Invalid boolean: $n"); |
862 } | 912 } |
| 913 |
863 if (query.length > 0) { | 914 if (query.length > 0) { |
864 for (var part in query.split("&")) { | 915 for (var part in query.split("&")) { |
865 var keyvalue = part.split("="); | 916 var keyvalue = part.split("="); |
866 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 917 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 918 core.Uri.decodeQueryComponent(keyvalue[1])); |
867 } | 919 } |
868 } | 920 } |
869 | 921 |
870 | |
871 var h = { | 922 var h = { |
872 "content-type" : "application/json; charset=utf-8", | 923 "content-type": "application/json; charset=utf-8", |
873 }; | 924 }; |
874 var resp = ""; | 925 var resp = ""; |
875 return new async.Future.value(stringResponse(200, h, resp)); | 926 return new async.Future.value(stringResponse(200, h, resp)); |
876 }), true); | 927 }), true); |
877 res.stop(arg_request).then(unittest.expectAsync1((_) {})); | 928 res.stop(arg_request).then(unittest.expectAsync1((_) {})); |
878 }); | 929 }); |
879 | |
880 }); | 930 }); |
881 | 931 |
882 | |
883 unittest.group("resource-CustomerUsageReportsResourceApi", () { | 932 unittest.group("resource-CustomerUsageReportsResourceApi", () { |
884 unittest.test("method--get", () { | 933 unittest.test("method--get", () { |
885 | |
886 var mock = new HttpServerMock(); | 934 var mock = new HttpServerMock(); |
887 api.CustomerUsageReportsResourceApi res = new api.AdminApi(mock).customerU
sageReports; | 935 api.CustomerUsageReportsResourceApi res = |
| 936 new api.AdminApi(mock).customerUsageReports; |
888 var arg_date = "foo"; | 937 var arg_date = "foo"; |
889 var arg_customerId = "foo"; | 938 var arg_customerId = "foo"; |
890 var arg_pageToken = "foo"; | 939 var arg_pageToken = "foo"; |
891 var arg_parameters = "foo"; | 940 var arg_parameters = "foo"; |
892 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 941 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
893 var path = (req.url).path; | 942 var path = (req.url).path; |
894 var pathOffset = 0; | 943 var pathOffset = 0; |
895 var index; | 944 var index; |
896 var subPart; | 945 var subPart; |
897 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 946 unittest.expect( |
| 947 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
898 pathOffset += 1; | 948 pathOffset += 1; |
899 unittest.expect(path.substring(pathOffset, pathOffset + 17), unittest.eq
uals("admin/reports/v1/")); | 949 unittest.expect(path.substring(pathOffset, pathOffset + 17), |
| 950 unittest.equals("admin/reports/v1/")); |
900 pathOffset += 17; | 951 pathOffset += 17; |
901 unittest.expect(path.substring(pathOffset, pathOffset + 12), unittest.eq
uals("usage/dates/")); | 952 unittest.expect(path.substring(pathOffset, pathOffset + 12), |
| 953 unittest.equals("usage/dates/")); |
902 pathOffset += 12; | 954 pathOffset += 12; |
903 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); | 955 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
904 pathOffset = path.length; | 956 pathOffset = path.length; |
905 unittest.expect(subPart, unittest.equals("$arg_date")); | 957 unittest.expect(subPart, unittest.equals("$arg_date")); |
906 | 958 |
907 var query = (req.url).query; | 959 var query = (req.url).query; |
908 var queryOffset = 0; | 960 var queryOffset = 0; |
909 var queryMap = {}; | 961 var queryMap = {}; |
910 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 962 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
911 parseBool(n) { | 963 parseBool(n) { |
912 if (n == "true") return true; | 964 if (n == "true") return true; |
913 if (n == "false") return false; | 965 if (n == "false") return false; |
914 if (n == null) return null; | 966 if (n == null) return null; |
915 throw new core.ArgumentError("Invalid boolean: $n"); | 967 throw new core.ArgumentError("Invalid boolean: $n"); |
916 } | 968 } |
| 969 |
917 if (query.length > 0) { | 970 if (query.length > 0) { |
918 for (var part in query.split("&")) { | 971 for (var part in query.split("&")) { |
919 var keyvalue = part.split("="); | 972 var keyvalue = part.split("="); |
920 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 973 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 974 core.Uri.decodeQueryComponent(keyvalue[1])); |
921 } | 975 } |
922 } | 976 } |
923 unittest.expect(queryMap["customerId"].first, unittest.equals(arg_custom
erId)); | 977 unittest.expect( |
924 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); | 978 queryMap["customerId"].first, unittest.equals(arg_customerId)); |
925 unittest.expect(queryMap["parameters"].first, unittest.equals(arg_parame
ters)); | 979 unittest.expect( |
926 | 980 queryMap["pageToken"].first, unittest.equals(arg_pageToken)); |
| 981 unittest.expect( |
| 982 queryMap["parameters"].first, unittest.equals(arg_parameters)); |
927 | 983 |
928 var h = { | 984 var h = { |
929 "content-type" : "application/json; charset=utf-8", | 985 "content-type": "application/json; charset=utf-8", |
930 }; | 986 }; |
931 var resp = convert.JSON.encode(buildUsageReports()); | 987 var resp = convert.JSON.encode(buildUsageReports()); |
932 return new async.Future.value(stringResponse(200, h, resp)); | 988 return new async.Future.value(stringResponse(200, h, resp)); |
933 }), true); | 989 }), true); |
934 res.get(arg_date, customerId: arg_customerId, pageToken: arg_pageToken, pa
rameters: arg_parameters).then(unittest.expectAsync1(((api.UsageReports response
) { | 990 res |
| 991 .get(arg_date, |
| 992 customerId: arg_customerId, |
| 993 pageToken: arg_pageToken, |
| 994 parameters: arg_parameters) |
| 995 .then(unittest.expectAsync1(((api.UsageReports response) { |
935 checkUsageReports(response); | 996 checkUsageReports(response); |
936 }))); | 997 }))); |
937 }); | 998 }); |
938 | |
939 }); | 999 }); |
940 | 1000 |
941 | |
942 unittest.group("resource-UserUsageReportResourceApi", () { | 1001 unittest.group("resource-UserUsageReportResourceApi", () { |
943 unittest.test("method--get", () { | 1002 unittest.test("method--get", () { |
944 | |
945 var mock = new HttpServerMock(); | 1003 var mock = new HttpServerMock(); |
946 api.UserUsageReportResourceApi res = new api.AdminApi(mock).userUsageRepor
t; | 1004 api.UserUsageReportResourceApi res = |
| 1005 new api.AdminApi(mock).userUsageReport; |
947 var arg_userKey = "foo"; | 1006 var arg_userKey = "foo"; |
948 var arg_date = "foo"; | 1007 var arg_date = "foo"; |
949 var arg_customerId = "foo"; | 1008 var arg_customerId = "foo"; |
950 var arg_filters = "foo"; | 1009 var arg_filters = "foo"; |
951 var arg_maxResults = 42; | 1010 var arg_maxResults = 42; |
952 var arg_pageToken = "foo"; | 1011 var arg_pageToken = "foo"; |
953 var arg_parameters = "foo"; | 1012 var arg_parameters = "foo"; |
954 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1013 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
955 var path = (req.url).path; | 1014 var path = (req.url).path; |
956 var pathOffset = 0; | 1015 var pathOffset = 0; |
957 var index; | 1016 var index; |
958 var subPart; | 1017 var subPart; |
959 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1018 unittest.expect( |
| 1019 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
960 pathOffset += 1; | 1020 pathOffset += 1; |
961 unittest.expect(path.substring(pathOffset, pathOffset + 17), unittest.eq
uals("admin/reports/v1/")); | 1021 unittest.expect(path.substring(pathOffset, pathOffset + 17), |
| 1022 unittest.equals("admin/reports/v1/")); |
962 pathOffset += 17; | 1023 pathOffset += 17; |
963 unittest.expect(path.substring(pathOffset, pathOffset + 12), unittest.eq
uals("usage/users/")); | 1024 unittest.expect(path.substring(pathOffset, pathOffset + 12), |
| 1025 unittest.equals("usage/users/")); |
964 pathOffset += 12; | 1026 pathOffset += 12; |
965 index = path.indexOf("/dates/", pathOffset); | 1027 index = path.indexOf("/dates/", pathOffset); |
966 unittest.expect(index >= 0, unittest.isTrue); | 1028 unittest.expect(index >= 0, unittest.isTrue); |
967 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | 1029 subPart = |
| 1030 core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
968 pathOffset = index; | 1031 pathOffset = index; |
969 unittest.expect(subPart, unittest.equals("$arg_userKey")); | 1032 unittest.expect(subPart, unittest.equals("$arg_userKey")); |
970 unittest.expect(path.substring(pathOffset, pathOffset + 7), unittest.equ
als("/dates/")); | 1033 unittest.expect(path.substring(pathOffset, pathOffset + 7), |
| 1034 unittest.equals("/dates/")); |
971 pathOffset += 7; | 1035 pathOffset += 7; |
972 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); | 1036 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
973 pathOffset = path.length; | 1037 pathOffset = path.length; |
974 unittest.expect(subPart, unittest.equals("$arg_date")); | 1038 unittest.expect(subPart, unittest.equals("$arg_date")); |
975 | 1039 |
976 var query = (req.url).query; | 1040 var query = (req.url).query; |
977 var queryOffset = 0; | 1041 var queryOffset = 0; |
978 var queryMap = {}; | 1042 var queryMap = {}; |
979 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1043 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
980 parseBool(n) { | 1044 parseBool(n) { |
981 if (n == "true") return true; | 1045 if (n == "true") return true; |
982 if (n == "false") return false; | 1046 if (n == "false") return false; |
983 if (n == null) return null; | 1047 if (n == null) return null; |
984 throw new core.ArgumentError("Invalid boolean: $n"); | 1048 throw new core.ArgumentError("Invalid boolean: $n"); |
985 } | 1049 } |
| 1050 |
986 if (query.length > 0) { | 1051 if (query.length > 0) { |
987 for (var part in query.split("&")) { | 1052 for (var part in query.split("&")) { |
988 var keyvalue = part.split("="); | 1053 var keyvalue = part.split("="); |
989 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1054 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1055 core.Uri.decodeQueryComponent(keyvalue[1])); |
990 } | 1056 } |
991 } | 1057 } |
992 unittest.expect(queryMap["customerId"].first, unittest.equals(arg_custom
erId)); | 1058 unittest.expect( |
993 unittest.expect(queryMap["filters"].first, unittest.equals(arg_filters))
; | 1059 queryMap["customerId"].first, unittest.equals(arg_customerId)); |
994 unittest.expect(core.int.parse(queryMap["maxResults"].first), unittest.e
quals(arg_maxResults)); | 1060 unittest.expect( |
995 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); | 1061 queryMap["filters"].first, unittest.equals(arg_filters)); |
996 unittest.expect(queryMap["parameters"].first, unittest.equals(arg_parame
ters)); | 1062 unittest.expect(core.int.parse(queryMap["maxResults"].first), |
997 | 1063 unittest.equals(arg_maxResults)); |
| 1064 unittest.expect( |
| 1065 queryMap["pageToken"].first, unittest.equals(arg_pageToken)); |
| 1066 unittest.expect( |
| 1067 queryMap["parameters"].first, unittest.equals(arg_parameters)); |
998 | 1068 |
999 var h = { | 1069 var h = { |
1000 "content-type" : "application/json; charset=utf-8", | 1070 "content-type": "application/json; charset=utf-8", |
1001 }; | 1071 }; |
1002 var resp = convert.JSON.encode(buildUsageReports()); | 1072 var resp = convert.JSON.encode(buildUsageReports()); |
1003 return new async.Future.value(stringResponse(200, h, resp)); | 1073 return new async.Future.value(stringResponse(200, h, resp)); |
1004 }), true); | 1074 }), true); |
1005 res.get(arg_userKey, arg_date, customerId: arg_customerId, filters: arg_fi
lters, maxResults: arg_maxResults, pageToken: arg_pageToken, parameters: arg_par
ameters).then(unittest.expectAsync1(((api.UsageReports response) { | 1075 res |
| 1076 .get(arg_userKey, arg_date, |
| 1077 customerId: arg_customerId, |
| 1078 filters: arg_filters, |
| 1079 maxResults: arg_maxResults, |
| 1080 pageToken: arg_pageToken, |
| 1081 parameters: arg_parameters) |
| 1082 .then(unittest.expectAsync1(((api.UsageReports response) { |
1006 checkUsageReports(response); | 1083 checkUsageReports(response); |
1007 }))); | 1084 }))); |
1008 }); | 1085 }); |
1009 | |
1010 }); | 1086 }); |
1011 | |
1012 | |
1013 } | 1087 } |
1014 | |
OLD | NEW |