Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(255)

Side by Side Diff: generated/googleapis/test/appsactivity/v1_test.dart

Issue 2936613002: Api-Roll 50: 2017-06-12 (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 library googleapis.appsactivity.v1.test; 1 library googleapis.appsactivity.v1.test;
2 2
3 import "dart:core" as core; 3 import "dart:core" as core;
4 import "dart:collection" as collection; 4 import "dart:collection" as collection;
5 import "dart:async" as async; 5 import "dart:async" as async;
6 import "dart:convert" as convert; 6 import "dart:convert" as convert;
7 7
8 import 'package:http/http.dart' as http; 8 import 'package:http/http.dart' as http;
9 import 'package:http/testing.dart' as http_testing; 9 import 'package:http/testing.dart' as http_testing;
10 import 'package:unittest/unittest.dart' as unittest; 10 import 'package:test/test.dart' as unittest;
11 11
12 import 'package:googleapis/appsactivity/v1.dart' as api; 12 import 'package:googleapis/appsactivity/v1.dart' as api;
13 13
14 class HttpServerMock extends http.BaseClient { 14 class HttpServerMock extends http.BaseClient {
15 core.Function _callback; 15 core.Function _callback;
16 core.bool _expectJson; 16 core.bool _expectJson;
17 17
18 void register(core.Function callback, core.bool expectJson) { 18 void register(core.Function callback, core.bool expectJson) {
19 _callback = callback; 19 _callback = callback;
20 _expectJson = expectJson; 20 _expectJson = expectJson;
(...skipping 18 matching lines...) Expand all
39 } else { 39 } else {
40 return stream.toBytes().then((data) { 40 return stream.toBytes().then((data) {
41 return _callback(request, data); 41 return _callback(request, data);
42 }); 42 });
43 } 43 }
44 } 44 }
45 } 45 }
46 } 46 }
47 47
48 http.StreamedResponse stringResponse( 48 http.StreamedResponse stringResponse(
49 core.int status, core.Map headers, core.String body) { 49 core.int status, core.Map<core.String, core.String> headers, core.String bod y) {
50 var stream = new async.Stream.fromIterable([convert.UTF8.encode(body)]); 50 var stream = new async.Stream.fromIterable([convert.UTF8.encode(body)]);
51 return new http.StreamedResponse(stream, status, headers: headers); 51 return new http.StreamedResponse(stream, status, headers: headers);
52 } 52 }
53 53
54 buildUnnamed1021() { 54 buildUnnamed1028() {
55 var o = new core.List<api.Event>(); 55 var o = new core.List<api.Event>();
56 o.add(buildEvent()); 56 o.add(buildEvent());
57 o.add(buildEvent()); 57 o.add(buildEvent());
58 return o; 58 return o;
59 } 59 }
60 60
61 checkUnnamed1021(core.List<api.Event> o) { 61 checkUnnamed1028(core.List<api.Event> o) {
62 unittest.expect(o, unittest.hasLength(2)); 62 unittest.expect(o, unittest.hasLength(2));
63 checkEvent(o[0]); 63 checkEvent(o[0]);
64 checkEvent(o[1]); 64 checkEvent(o[1]);
65 } 65 }
66 66
67 core.int buildCounterActivity = 0; 67 core.int buildCounterActivity = 0;
68 buildActivity() { 68 buildActivity() {
69 var o = new api.Activity(); 69 var o = new api.Activity();
70 buildCounterActivity++; 70 buildCounterActivity++;
71 if (buildCounterActivity < 3) { 71 if (buildCounterActivity < 3) {
72 o.combinedEvent = buildEvent(); 72 o.combinedEvent = buildEvent();
73 o.singleEvents = buildUnnamed1021(); 73 o.singleEvents = buildUnnamed1028();
74 } 74 }
75 buildCounterActivity--; 75 buildCounterActivity--;
76 return o; 76 return o;
77 } 77 }
78 78
79 checkActivity(api.Activity o) { 79 checkActivity(api.Activity o) {
80 buildCounterActivity++; 80 buildCounterActivity++;
81 if (buildCounterActivity < 3) { 81 if (buildCounterActivity < 3) {
82 checkEvent(o.combinedEvent); 82 checkEvent(o.combinedEvent);
83 checkUnnamed1021(o.singleEvents); 83 checkUnnamed1028(o.singleEvents);
84 } 84 }
85 buildCounterActivity--; 85 buildCounterActivity--;
86 } 86 }
87 87
88 buildUnnamed1022() { 88 buildUnnamed1029() {
89 var o = new core.List<core.String>(); 89 var o = new core.List<core.String>();
90 o.add("foo"); 90 o.add("foo");
91 o.add("foo"); 91 o.add("foo");
92 return o; 92 return o;
93 } 93 }
94 94
95 checkUnnamed1022(core.List<core.String> o) { 95 checkUnnamed1029(core.List<core.String> o) {
96 unittest.expect(o, unittest.hasLength(2)); 96 unittest.expect(o, unittest.hasLength(2));
97 unittest.expect(o[0], unittest.equals('foo')); 97 unittest.expect(o[0], unittest.equals('foo'));
98 unittest.expect(o[1], unittest.equals('foo')); 98 unittest.expect(o[1], unittest.equals('foo'));
99 } 99 }
100 100
101 buildUnnamed1023() { 101 buildUnnamed1030() {
102 var o = new core.List<api.PermissionChange>(); 102 var o = new core.List<api.PermissionChange>();
103 o.add(buildPermissionChange()); 103 o.add(buildPermissionChange());
104 o.add(buildPermissionChange()); 104 o.add(buildPermissionChange());
105 return o; 105 return o;
106 } 106 }
107 107
108 checkUnnamed1023(core.List<api.PermissionChange> o) { 108 checkUnnamed1030(core.List<api.PermissionChange> o) {
109 unittest.expect(o, unittest.hasLength(2)); 109 unittest.expect(o, unittest.hasLength(2));
110 checkPermissionChange(o[0]); 110 checkPermissionChange(o[0]);
111 checkPermissionChange(o[1]); 111 checkPermissionChange(o[1]);
112 } 112 }
113 113
114 core.int buildCounterEvent = 0; 114 core.int buildCounterEvent = 0;
115 buildEvent() { 115 buildEvent() {
116 var o = new api.Event(); 116 var o = new api.Event();
117 buildCounterEvent++; 117 buildCounterEvent++;
118 if (buildCounterEvent < 3) { 118 if (buildCounterEvent < 3) {
119 o.additionalEventTypes = buildUnnamed1022(); 119 o.additionalEventTypes = buildUnnamed1029();
120 o.eventTimeMillis = "foo"; 120 o.eventTimeMillis = "foo";
121 o.fromUserDeletion = true; 121 o.fromUserDeletion = true;
122 o.move = buildMove(); 122 o.move = buildMove();
123 o.permissionChanges = buildUnnamed1023(); 123 o.permissionChanges = buildUnnamed1030();
124 o.primaryEventType = "foo"; 124 o.primaryEventType = "foo";
125 o.rename = buildRename(); 125 o.rename = buildRename();
126 o.target = buildTarget(); 126 o.target = buildTarget();
127 o.user = buildUser(); 127 o.user = buildUser();
128 } 128 }
129 buildCounterEvent--; 129 buildCounterEvent--;
130 return o; 130 return o;
131 } 131 }
132 132
133 checkEvent(api.Event o) { 133 checkEvent(api.Event o) {
134 buildCounterEvent++; 134 buildCounterEvent++;
135 if (buildCounterEvent < 3) { 135 if (buildCounterEvent < 3) {
136 checkUnnamed1022(o.additionalEventTypes); 136 checkUnnamed1029(o.additionalEventTypes);
137 unittest.expect(o.eventTimeMillis, unittest.equals('foo')); 137 unittest.expect(o.eventTimeMillis, unittest.equals('foo'));
138 unittest.expect(o.fromUserDeletion, unittest.isTrue); 138 unittest.expect(o.fromUserDeletion, unittest.isTrue);
139 checkMove(o.move); 139 checkMove(o.move);
140 checkUnnamed1023(o.permissionChanges); 140 checkUnnamed1030(o.permissionChanges);
141 unittest.expect(o.primaryEventType, unittest.equals('foo')); 141 unittest.expect(o.primaryEventType, unittest.equals('foo'));
142 checkRename(o.rename); 142 checkRename(o.rename);
143 checkTarget(o.target); 143 checkTarget(o.target);
144 checkUser(o.user); 144 checkUser(o.user);
145 } 145 }
146 buildCounterEvent--; 146 buildCounterEvent--;
147 } 147 }
148 148
149 buildUnnamed1024() { 149 buildUnnamed1031() {
150 var o = new core.List<api.Activity>(); 150 var o = new core.List<api.Activity>();
151 o.add(buildActivity()); 151 o.add(buildActivity());
152 o.add(buildActivity()); 152 o.add(buildActivity());
153 return o; 153 return o;
154 } 154 }
155 155
156 checkUnnamed1024(core.List<api.Activity> o) { 156 checkUnnamed1031(core.List<api.Activity> o) {
157 unittest.expect(o, unittest.hasLength(2)); 157 unittest.expect(o, unittest.hasLength(2));
158 checkActivity(o[0]); 158 checkActivity(o[0]);
159 checkActivity(o[1]); 159 checkActivity(o[1]);
160 } 160 }
161 161
162 core.int buildCounterListActivitiesResponse = 0; 162 core.int buildCounterListActivitiesResponse = 0;
163 buildListActivitiesResponse() { 163 buildListActivitiesResponse() {
164 var o = new api.ListActivitiesResponse(); 164 var o = new api.ListActivitiesResponse();
165 buildCounterListActivitiesResponse++; 165 buildCounterListActivitiesResponse++;
166 if (buildCounterListActivitiesResponse < 3) { 166 if (buildCounterListActivitiesResponse < 3) {
167 o.activities = buildUnnamed1024(); 167 o.activities = buildUnnamed1031();
168 o.nextPageToken = "foo"; 168 o.nextPageToken = "foo";
169 } 169 }
170 buildCounterListActivitiesResponse--; 170 buildCounterListActivitiesResponse--;
171 return o; 171 return o;
172 } 172 }
173 173
174 checkListActivitiesResponse(api.ListActivitiesResponse o) { 174 checkListActivitiesResponse(api.ListActivitiesResponse o) {
175 buildCounterListActivitiesResponse++; 175 buildCounterListActivitiesResponse++;
176 if (buildCounterListActivitiesResponse < 3) { 176 if (buildCounterListActivitiesResponse < 3) {
177 checkUnnamed1024(o.activities); 177 checkUnnamed1031(o.activities);
178 unittest.expect(o.nextPageToken, unittest.equals('foo')); 178 unittest.expect(o.nextPageToken, unittest.equals('foo'));
179 } 179 }
180 buildCounterListActivitiesResponse--; 180 buildCounterListActivitiesResponse--;
181 } 181 }
182 182
183 buildUnnamed1025() { 183 buildUnnamed1032() {
184 var o = new core.List<api.Parent>(); 184 var o = new core.List<api.Parent>();
185 o.add(buildParent()); 185 o.add(buildParent());
186 o.add(buildParent()); 186 o.add(buildParent());
187 return o; 187 return o;
188 } 188 }
189 189
190 checkUnnamed1025(core.List<api.Parent> o) { 190 checkUnnamed1032(core.List<api.Parent> o) {
191 unittest.expect(o, unittest.hasLength(2)); 191 unittest.expect(o, unittest.hasLength(2));
192 checkParent(o[0]); 192 checkParent(o[0]);
193 checkParent(o[1]); 193 checkParent(o[1]);
194 } 194 }
195 195
196 buildUnnamed1026() { 196 buildUnnamed1033() {
197 var o = new core.List<api.Parent>(); 197 var o = new core.List<api.Parent>();
198 o.add(buildParent()); 198 o.add(buildParent());
199 o.add(buildParent()); 199 o.add(buildParent());
200 return o; 200 return o;
201 } 201 }
202 202
203 checkUnnamed1026(core.List<api.Parent> o) { 203 checkUnnamed1033(core.List<api.Parent> o) {
204 unittest.expect(o, unittest.hasLength(2)); 204 unittest.expect(o, unittest.hasLength(2));
205 checkParent(o[0]); 205 checkParent(o[0]);
206 checkParent(o[1]); 206 checkParent(o[1]);
207 } 207 }
208 208
209 core.int buildCounterMove = 0; 209 core.int buildCounterMove = 0;
210 buildMove() { 210 buildMove() {
211 var o = new api.Move(); 211 var o = new api.Move();
212 buildCounterMove++; 212 buildCounterMove++;
213 if (buildCounterMove < 3) { 213 if (buildCounterMove < 3) {
214 o.addedParents = buildUnnamed1025(); 214 o.addedParents = buildUnnamed1032();
215 o.removedParents = buildUnnamed1026(); 215 o.removedParents = buildUnnamed1033();
216 } 216 }
217 buildCounterMove--; 217 buildCounterMove--;
218 return o; 218 return o;
219 } 219 }
220 220
221 checkMove(api.Move o) { 221 checkMove(api.Move o) {
222 buildCounterMove++; 222 buildCounterMove++;
223 if (buildCounterMove < 3) { 223 if (buildCounterMove < 3) {
224 checkUnnamed1025(o.addedParents); 224 checkUnnamed1032(o.addedParents);
225 checkUnnamed1026(o.removedParents); 225 checkUnnamed1033(o.removedParents);
226 } 226 }
227 buildCounterMove--; 227 buildCounterMove--;
228 } 228 }
229 229
230 core.int buildCounterParent = 0; 230 core.int buildCounterParent = 0;
231 buildParent() { 231 buildParent() {
232 var o = new api.Parent(); 232 var o = new api.Parent();
233 buildCounterParent++; 233 buildCounterParent++;
234 if (buildCounterParent < 3) { 234 if (buildCounterParent < 3) {
235 o.id = "foo"; 235 o.id = "foo";
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 unittest.expect(o.name, unittest.equals('foo')); 272 unittest.expect(o.name, unittest.equals('foo'));
273 unittest.expect(o.permissionId, unittest.equals('foo')); 273 unittest.expect(o.permissionId, unittest.equals('foo'));
274 unittest.expect(o.role, unittest.equals('foo')); 274 unittest.expect(o.role, unittest.equals('foo'));
275 unittest.expect(o.type, unittest.equals('foo')); 275 unittest.expect(o.type, unittest.equals('foo'));
276 checkUser(o.user); 276 checkUser(o.user);
277 unittest.expect(o.withLink, unittest.isTrue); 277 unittest.expect(o.withLink, unittest.isTrue);
278 } 278 }
279 buildCounterPermission--; 279 buildCounterPermission--;
280 } 280 }
281 281
282 buildUnnamed1027() { 282 buildUnnamed1034() {
283 var o = new core.List<api.Permission>(); 283 var o = new core.List<api.Permission>();
284 o.add(buildPermission()); 284 o.add(buildPermission());
285 o.add(buildPermission()); 285 o.add(buildPermission());
286 return o; 286 return o;
287 } 287 }
288 288
289 checkUnnamed1027(core.List<api.Permission> o) { 289 checkUnnamed1034(core.List<api.Permission> o) {
290 unittest.expect(o, unittest.hasLength(2)); 290 unittest.expect(o, unittest.hasLength(2));
291 checkPermission(o[0]); 291 checkPermission(o[0]);
292 checkPermission(o[1]); 292 checkPermission(o[1]);
293 } 293 }
294 294
295 buildUnnamed1028() { 295 buildUnnamed1035() {
296 var o = new core.List<api.Permission>(); 296 var o = new core.List<api.Permission>();
297 o.add(buildPermission()); 297 o.add(buildPermission());
298 o.add(buildPermission()); 298 o.add(buildPermission());
299 return o; 299 return o;
300 } 300 }
301 301
302 checkUnnamed1028(core.List<api.Permission> o) { 302 checkUnnamed1035(core.List<api.Permission> o) {
303 unittest.expect(o, unittest.hasLength(2)); 303 unittest.expect(o, unittest.hasLength(2));
304 checkPermission(o[0]); 304 checkPermission(o[0]);
305 checkPermission(o[1]); 305 checkPermission(o[1]);
306 } 306 }
307 307
308 core.int buildCounterPermissionChange = 0; 308 core.int buildCounterPermissionChange = 0;
309 buildPermissionChange() { 309 buildPermissionChange() {
310 var o = new api.PermissionChange(); 310 var o = new api.PermissionChange();
311 buildCounterPermissionChange++; 311 buildCounterPermissionChange++;
312 if (buildCounterPermissionChange < 3) { 312 if (buildCounterPermissionChange < 3) {
313 o.addedPermissions = buildUnnamed1027(); 313 o.addedPermissions = buildUnnamed1034();
314 o.removedPermissions = buildUnnamed1028(); 314 o.removedPermissions = buildUnnamed1035();
315 } 315 }
316 buildCounterPermissionChange--; 316 buildCounterPermissionChange--;
317 return o; 317 return o;
318 } 318 }
319 319
320 checkPermissionChange(api.PermissionChange o) { 320 checkPermissionChange(api.PermissionChange o) {
321 buildCounterPermissionChange++; 321 buildCounterPermissionChange++;
322 if (buildCounterPermissionChange < 3) { 322 if (buildCounterPermissionChange < 3) {
323 checkUnnamed1027(o.addedPermissions); 323 checkUnnamed1034(o.addedPermissions);
324 checkUnnamed1028(o.removedPermissions); 324 checkUnnamed1035(o.removedPermissions);
325 } 325 }
326 buildCounterPermissionChange--; 326 buildCounterPermissionChange--;
327 } 327 }
328 328
329 core.int buildCounterPhoto = 0; 329 core.int buildCounterPhoto = 0;
330 buildPhoto() { 330 buildPhoto() {
331 var o = new api.Photo(); 331 var o = new api.Photo();
332 buildCounterPhoto++; 332 buildCounterPhoto++;
333 if (buildCounterPhoto < 3) { 333 if (buildCounterPhoto < 3) {
334 o.url = "foo"; 334 o.url = "foo";
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 522
523 var mock = new HttpServerMock(); 523 var mock = new HttpServerMock();
524 api.ActivitiesResourceApi res = new api.AppsactivityApi(mock).activities; 524 api.ActivitiesResourceApi res = new api.AppsactivityApi(mock).activities;
525 var arg_drive_ancestorId = "foo"; 525 var arg_drive_ancestorId = "foo";
526 var arg_drive_fileId = "foo"; 526 var arg_drive_fileId = "foo";
527 var arg_groupingStrategy = "foo"; 527 var arg_groupingStrategy = "foo";
528 var arg_pageSize = 42; 528 var arg_pageSize = 42;
529 var arg_pageToken = "foo"; 529 var arg_pageToken = "foo";
530 var arg_source = "foo"; 530 var arg_source = "foo";
531 var arg_userId = "foo"; 531 var arg_userId = "foo";
532 mock.register(unittest.expectAsync((http.BaseRequest req, json) { 532 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
533 var path = (req.url).path; 533 var path = (req.url).path;
534 var pathOffset = 0; 534 var pathOffset = 0;
535 var index; 535 var index;
536 var subPart; 536 var subPart;
537 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/")); 537 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/"));
538 pathOffset += 1; 538 pathOffset += 1;
539 unittest.expect(path.substring(pathOffset, pathOffset + 16), unittest.eq uals("appsactivity/v1/")); 539 unittest.expect(path.substring(pathOffset, pathOffset + 16), unittest.eq uals("appsactivity/v1/"));
540 pathOffset += 16; 540 pathOffset += 16;
541 unittest.expect(path.substring(pathOffset, pathOffset + 10), unittest.eq uals("activities")); 541 unittest.expect(path.substring(pathOffset, pathOffset + 10), unittest.eq uals("activities"));
542 pathOffset += 10; 542 pathOffset += 10;
(...skipping 22 matching lines...) Expand all
565 unittest.expect(queryMap["source"].first, unittest.equals(arg_source)); 565 unittest.expect(queryMap["source"].first, unittest.equals(arg_source));
566 unittest.expect(queryMap["userId"].first, unittest.equals(arg_userId)); 566 unittest.expect(queryMap["userId"].first, unittest.equals(arg_userId));
567 567
568 568
569 var h = { 569 var h = {
570 "content-type" : "application/json; charset=utf-8", 570 "content-type" : "application/json; charset=utf-8",
571 }; 571 };
572 var resp = convert.JSON.encode(buildListActivitiesResponse()); 572 var resp = convert.JSON.encode(buildListActivitiesResponse());
573 return new async.Future.value(stringResponse(200, h, resp)); 573 return new async.Future.value(stringResponse(200, h, resp));
574 }), true); 574 }), true);
575 res.list(drive_ancestorId: arg_drive_ancestorId, drive_fileId: arg_drive_f ileId, groupingStrategy: arg_groupingStrategy, pageSize: arg_pageSize, pageToken : arg_pageToken, source: arg_source, userId: arg_userId).then(unittest.expectAsy nc(((api.ListActivitiesResponse response) { 575 res.list(drive_ancestorId: arg_drive_ancestorId, drive_fileId: arg_drive_f ileId, groupingStrategy: arg_groupingStrategy, pageSize: arg_pageSize, pageToken : arg_pageToken, source: arg_source, userId: arg_userId).then(unittest.expectAsy nc1(((api.ListActivitiesResponse response) {
576 checkListActivitiesResponse(response); 576 checkListActivitiesResponse(response);
577 }))); 577 })));
578 }); 578 });
579 579
580 }); 580 });
581 581
582 582
583 } 583 }
584 584
OLDNEW
« no previous file with comments | « generated/googleapis/test/appengine/v1_test.dart ('k') | generated/googleapis/test/appstate/v1_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698