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

Side by Side Diff: generated/googleapis_beta/test/pubsub/v1beta2_test.dart

Issue 3006323002: Api-Roll 54: 2017-09-11 (Closed)
Patch Set: use 2.0.0-dev.infinity sdk constraint in pubspecs Created 3 years, 3 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_beta.pubsub.v1beta2.test; 1 library googleapis_beta.pubsub.v1beta2.test;
2 2
3 import "dart:core" as core; 3 import "dart:core" as core;
4 import "dart:collection" as collection;
5 import "dart:async" as async; 4 import "dart:async" as async;
6 import "dart:convert" as convert; 5 import "dart:convert" as convert;
7 6
8 import 'package:http/http.dart' as http; 7 import 'package:http/http.dart' as http;
9 import 'package:http/testing.dart' as http_testing;
10 import 'package:test/test.dart' as unittest; 8 import 'package:test/test.dart' as unittest;
11 9
12 import 'package:googleapis_beta/pubsub/v1beta2.dart' as api; 10 import 'package:googleapis_beta/pubsub/v1beta2.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 buildUnnamed3340() { 53 buildUnnamed3333() {
55 var o = new core.List<core.String>(); 54 var o = new core.List<core.String>();
56 o.add("foo"); 55 o.add("foo");
57 o.add("foo"); 56 o.add("foo");
58 return o; 57 return o;
59 } 58 }
60 59
61 checkUnnamed3340(core.List<core.String> o) { 60 checkUnnamed3333(core.List<core.String> o) {
62 unittest.expect(o, unittest.hasLength(2)); 61 unittest.expect(o, unittest.hasLength(2));
63 unittest.expect(o[0], unittest.equals('foo')); 62 unittest.expect(o[0], unittest.equals('foo'));
64 unittest.expect(o[1], unittest.equals('foo')); 63 unittest.expect(o[1], unittest.equals('foo'));
65 } 64 }
66 65
67 core.int buildCounterAcknowledgeRequest = 0; 66 core.int buildCounterAcknowledgeRequest = 0;
68 buildAcknowledgeRequest() { 67 buildAcknowledgeRequest() {
69 var o = new api.AcknowledgeRequest(); 68 var o = new api.AcknowledgeRequest();
70 buildCounterAcknowledgeRequest++; 69 buildCounterAcknowledgeRequest++;
71 if (buildCounterAcknowledgeRequest < 3) { 70 if (buildCounterAcknowledgeRequest < 3) {
72 o.ackIds = buildUnnamed3340(); 71 o.ackIds = buildUnnamed3333();
73 } 72 }
74 buildCounterAcknowledgeRequest--; 73 buildCounterAcknowledgeRequest--;
75 return o; 74 return o;
76 } 75 }
77 76
78 checkAcknowledgeRequest(api.AcknowledgeRequest o) { 77 checkAcknowledgeRequest(api.AcknowledgeRequest o) {
79 buildCounterAcknowledgeRequest++; 78 buildCounterAcknowledgeRequest++;
80 if (buildCounterAcknowledgeRequest < 3) { 79 if (buildCounterAcknowledgeRequest < 3) {
81 checkUnnamed3340(o.ackIds); 80 checkUnnamed3333(o.ackIds);
82 } 81 }
83 buildCounterAcknowledgeRequest--; 82 buildCounterAcknowledgeRequest--;
84 } 83 }
85 84
86 buildUnnamed3341() { 85 buildUnnamed3334() {
87 var o = new core.List<core.String>(); 86 var o = new core.List<core.String>();
88 o.add("foo"); 87 o.add("foo");
89 o.add("foo"); 88 o.add("foo");
90 return o; 89 return o;
91 } 90 }
92 91
93 checkUnnamed3341(core.List<core.String> o) { 92 checkUnnamed3334(core.List<core.String> o) {
94 unittest.expect(o, unittest.hasLength(2)); 93 unittest.expect(o, unittest.hasLength(2));
95 unittest.expect(o[0], unittest.equals('foo')); 94 unittest.expect(o[0], unittest.equals('foo'));
96 unittest.expect(o[1], unittest.equals('foo')); 95 unittest.expect(o[1], unittest.equals('foo'));
97 } 96 }
98 97
99 core.int buildCounterBinding = 0; 98 core.int buildCounterBinding = 0;
100 buildBinding() { 99 buildBinding() {
101 var o = new api.Binding(); 100 var o = new api.Binding();
102 buildCounterBinding++; 101 buildCounterBinding++;
103 if (buildCounterBinding < 3) { 102 if (buildCounterBinding < 3) {
104 o.members = buildUnnamed3341(); 103 o.members = buildUnnamed3334();
105 o.role = "foo"; 104 o.role = "foo";
106 } 105 }
107 buildCounterBinding--; 106 buildCounterBinding--;
108 return o; 107 return o;
109 } 108 }
110 109
111 checkBinding(api.Binding o) { 110 checkBinding(api.Binding o) {
112 buildCounterBinding++; 111 buildCounterBinding++;
113 if (buildCounterBinding < 3) { 112 if (buildCounterBinding < 3) {
114 checkUnnamed3341(o.members); 113 checkUnnamed3334(o.members);
115 unittest.expect(o.role, unittest.equals('foo')); 114 unittest.expect(o.role, unittest.equals('foo'));
116 } 115 }
117 buildCounterBinding--; 116 buildCounterBinding--;
118 } 117 }
119 118
120 core.int buildCounterEmpty = 0; 119 core.int buildCounterEmpty = 0;
121 buildEmpty() { 120 buildEmpty() {
122 var o = new api.Empty(); 121 var o = new api.Empty();
123 buildCounterEmpty++; 122 buildCounterEmpty++;
124 if (buildCounterEmpty < 3) { 123 if (buildCounterEmpty < 3) {}
125 }
126 buildCounterEmpty--; 124 buildCounterEmpty--;
127 return o; 125 return o;
128 } 126 }
129 127
130 checkEmpty(api.Empty o) { 128 checkEmpty(api.Empty o) {
131 buildCounterEmpty++; 129 buildCounterEmpty++;
132 if (buildCounterEmpty < 3) { 130 if (buildCounterEmpty < 3) {}
133 }
134 buildCounterEmpty--; 131 buildCounterEmpty--;
135 } 132 }
136 133
137 buildUnnamed3342() { 134 buildUnnamed3335() {
138 var o = new core.List<api.Subscription>(); 135 var o = new core.List<api.Subscription>();
139 o.add(buildSubscription()); 136 o.add(buildSubscription());
140 o.add(buildSubscription()); 137 o.add(buildSubscription());
141 return o; 138 return o;
142 } 139 }
143 140
144 checkUnnamed3342(core.List<api.Subscription> o) { 141 checkUnnamed3335(core.List<api.Subscription> o) {
145 unittest.expect(o, unittest.hasLength(2)); 142 unittest.expect(o, unittest.hasLength(2));
146 checkSubscription(o[0]); 143 checkSubscription(o[0]);
147 checkSubscription(o[1]); 144 checkSubscription(o[1]);
148 } 145 }
149 146
150 core.int buildCounterListSubscriptionsResponse = 0; 147 core.int buildCounterListSubscriptionsResponse = 0;
151 buildListSubscriptionsResponse() { 148 buildListSubscriptionsResponse() {
152 var o = new api.ListSubscriptionsResponse(); 149 var o = new api.ListSubscriptionsResponse();
153 buildCounterListSubscriptionsResponse++; 150 buildCounterListSubscriptionsResponse++;
154 if (buildCounterListSubscriptionsResponse < 3) { 151 if (buildCounterListSubscriptionsResponse < 3) {
155 o.nextPageToken = "foo"; 152 o.nextPageToken = "foo";
156 o.subscriptions = buildUnnamed3342(); 153 o.subscriptions = buildUnnamed3335();
157 } 154 }
158 buildCounterListSubscriptionsResponse--; 155 buildCounterListSubscriptionsResponse--;
159 return o; 156 return o;
160 } 157 }
161 158
162 checkListSubscriptionsResponse(api.ListSubscriptionsResponse o) { 159 checkListSubscriptionsResponse(api.ListSubscriptionsResponse o) {
163 buildCounterListSubscriptionsResponse++; 160 buildCounterListSubscriptionsResponse++;
164 if (buildCounterListSubscriptionsResponse < 3) { 161 if (buildCounterListSubscriptionsResponse < 3) {
165 unittest.expect(o.nextPageToken, unittest.equals('foo')); 162 unittest.expect(o.nextPageToken, unittest.equals('foo'));
166 checkUnnamed3342(o.subscriptions); 163 checkUnnamed3335(o.subscriptions);
167 } 164 }
168 buildCounterListSubscriptionsResponse--; 165 buildCounterListSubscriptionsResponse--;
169 } 166 }
170 167
171 buildUnnamed3343() { 168 buildUnnamed3336() {
172 var o = new core.List<core.String>(); 169 var o = new core.List<core.String>();
173 o.add("foo"); 170 o.add("foo");
174 o.add("foo"); 171 o.add("foo");
175 return o; 172 return o;
176 } 173 }
177 174
178 checkUnnamed3343(core.List<core.String> o) { 175 checkUnnamed3336(core.List<core.String> o) {
179 unittest.expect(o, unittest.hasLength(2)); 176 unittest.expect(o, unittest.hasLength(2));
180 unittest.expect(o[0], unittest.equals('foo')); 177 unittest.expect(o[0], unittest.equals('foo'));
181 unittest.expect(o[1], unittest.equals('foo')); 178 unittest.expect(o[1], unittest.equals('foo'));
182 } 179 }
183 180
184 core.int buildCounterListTopicSubscriptionsResponse = 0; 181 core.int buildCounterListTopicSubscriptionsResponse = 0;
185 buildListTopicSubscriptionsResponse() { 182 buildListTopicSubscriptionsResponse() {
186 var o = new api.ListTopicSubscriptionsResponse(); 183 var o = new api.ListTopicSubscriptionsResponse();
187 buildCounterListTopicSubscriptionsResponse++; 184 buildCounterListTopicSubscriptionsResponse++;
188 if (buildCounterListTopicSubscriptionsResponse < 3) { 185 if (buildCounterListTopicSubscriptionsResponse < 3) {
189 o.nextPageToken = "foo"; 186 o.nextPageToken = "foo";
190 o.subscriptions = buildUnnamed3343(); 187 o.subscriptions = buildUnnamed3336();
191 } 188 }
192 buildCounterListTopicSubscriptionsResponse--; 189 buildCounterListTopicSubscriptionsResponse--;
193 return o; 190 return o;
194 } 191 }
195 192
196 checkListTopicSubscriptionsResponse(api.ListTopicSubscriptionsResponse o) { 193 checkListTopicSubscriptionsResponse(api.ListTopicSubscriptionsResponse o) {
197 buildCounterListTopicSubscriptionsResponse++; 194 buildCounterListTopicSubscriptionsResponse++;
198 if (buildCounterListTopicSubscriptionsResponse < 3) { 195 if (buildCounterListTopicSubscriptionsResponse < 3) {
199 unittest.expect(o.nextPageToken, unittest.equals('foo')); 196 unittest.expect(o.nextPageToken, unittest.equals('foo'));
200 checkUnnamed3343(o.subscriptions); 197 checkUnnamed3336(o.subscriptions);
201 } 198 }
202 buildCounterListTopicSubscriptionsResponse--; 199 buildCounterListTopicSubscriptionsResponse--;
203 } 200 }
204 201
205 buildUnnamed3344() { 202 buildUnnamed3337() {
206 var o = new core.List<api.Topic>(); 203 var o = new core.List<api.Topic>();
207 o.add(buildTopic()); 204 o.add(buildTopic());
208 o.add(buildTopic()); 205 o.add(buildTopic());
209 return o; 206 return o;
210 } 207 }
211 208
212 checkUnnamed3344(core.List<api.Topic> o) { 209 checkUnnamed3337(core.List<api.Topic> o) {
213 unittest.expect(o, unittest.hasLength(2)); 210 unittest.expect(o, unittest.hasLength(2));
214 checkTopic(o[0]); 211 checkTopic(o[0]);
215 checkTopic(o[1]); 212 checkTopic(o[1]);
216 } 213 }
217 214
218 core.int buildCounterListTopicsResponse = 0; 215 core.int buildCounterListTopicsResponse = 0;
219 buildListTopicsResponse() { 216 buildListTopicsResponse() {
220 var o = new api.ListTopicsResponse(); 217 var o = new api.ListTopicsResponse();
221 buildCounterListTopicsResponse++; 218 buildCounterListTopicsResponse++;
222 if (buildCounterListTopicsResponse < 3) { 219 if (buildCounterListTopicsResponse < 3) {
223 o.nextPageToken = "foo"; 220 o.nextPageToken = "foo";
224 o.topics = buildUnnamed3344(); 221 o.topics = buildUnnamed3337();
225 } 222 }
226 buildCounterListTopicsResponse--; 223 buildCounterListTopicsResponse--;
227 return o; 224 return o;
228 } 225 }
229 226
230 checkListTopicsResponse(api.ListTopicsResponse o) { 227 checkListTopicsResponse(api.ListTopicsResponse o) {
231 buildCounterListTopicsResponse++; 228 buildCounterListTopicsResponse++;
232 if (buildCounterListTopicsResponse < 3) { 229 if (buildCounterListTopicsResponse < 3) {
233 unittest.expect(o.nextPageToken, unittest.equals('foo')); 230 unittest.expect(o.nextPageToken, unittest.equals('foo'));
234 checkUnnamed3344(o.topics); 231 checkUnnamed3337(o.topics);
235 } 232 }
236 buildCounterListTopicsResponse--; 233 buildCounterListTopicsResponse--;
237 } 234 }
238 235
239 buildUnnamed3345() { 236 buildUnnamed3338() {
240 var o = new core.List<core.String>(); 237 var o = new core.List<core.String>();
241 o.add("foo"); 238 o.add("foo");
242 o.add("foo"); 239 o.add("foo");
243 return o; 240 return o;
244 } 241 }
245 242
246 checkUnnamed3345(core.List<core.String> o) { 243 checkUnnamed3338(core.List<core.String> o) {
247 unittest.expect(o, unittest.hasLength(2)); 244 unittest.expect(o, unittest.hasLength(2));
248 unittest.expect(o[0], unittest.equals('foo')); 245 unittest.expect(o[0], unittest.equals('foo'));
249 unittest.expect(o[1], unittest.equals('foo')); 246 unittest.expect(o[1], unittest.equals('foo'));
250 } 247 }
251 248
252 core.int buildCounterModifyAckDeadlineRequest = 0; 249 core.int buildCounterModifyAckDeadlineRequest = 0;
253 buildModifyAckDeadlineRequest() { 250 buildModifyAckDeadlineRequest() {
254 var o = new api.ModifyAckDeadlineRequest(); 251 var o = new api.ModifyAckDeadlineRequest();
255 buildCounterModifyAckDeadlineRequest++; 252 buildCounterModifyAckDeadlineRequest++;
256 if (buildCounterModifyAckDeadlineRequest < 3) { 253 if (buildCounterModifyAckDeadlineRequest < 3) {
257 o.ackDeadlineSeconds = 42; 254 o.ackDeadlineSeconds = 42;
258 o.ackId = "foo"; 255 o.ackId = "foo";
259 o.ackIds = buildUnnamed3345(); 256 o.ackIds = buildUnnamed3338();
260 } 257 }
261 buildCounterModifyAckDeadlineRequest--; 258 buildCounterModifyAckDeadlineRequest--;
262 return o; 259 return o;
263 } 260 }
264 261
265 checkModifyAckDeadlineRequest(api.ModifyAckDeadlineRequest o) { 262 checkModifyAckDeadlineRequest(api.ModifyAckDeadlineRequest o) {
266 buildCounterModifyAckDeadlineRequest++; 263 buildCounterModifyAckDeadlineRequest++;
267 if (buildCounterModifyAckDeadlineRequest < 3) { 264 if (buildCounterModifyAckDeadlineRequest < 3) {
268 unittest.expect(o.ackDeadlineSeconds, unittest.equals(42)); 265 unittest.expect(o.ackDeadlineSeconds, unittest.equals(42));
269 unittest.expect(o.ackId, unittest.equals('foo')); 266 unittest.expect(o.ackId, unittest.equals('foo'));
270 checkUnnamed3345(o.ackIds); 267 checkUnnamed3338(o.ackIds);
271 } 268 }
272 buildCounterModifyAckDeadlineRequest--; 269 buildCounterModifyAckDeadlineRequest--;
273 } 270 }
274 271
275 core.int buildCounterModifyPushConfigRequest = 0; 272 core.int buildCounterModifyPushConfigRequest = 0;
276 buildModifyPushConfigRequest() { 273 buildModifyPushConfigRequest() {
277 var o = new api.ModifyPushConfigRequest(); 274 var o = new api.ModifyPushConfigRequest();
278 buildCounterModifyPushConfigRequest++; 275 buildCounterModifyPushConfigRequest++;
279 if (buildCounterModifyPushConfigRequest < 3) { 276 if (buildCounterModifyPushConfigRequest < 3) {
280 o.pushConfig = buildPushConfig(); 277 o.pushConfig = buildPushConfig();
281 } 278 }
282 buildCounterModifyPushConfigRequest--; 279 buildCounterModifyPushConfigRequest--;
283 return o; 280 return o;
284 } 281 }
285 282
286 checkModifyPushConfigRequest(api.ModifyPushConfigRequest o) { 283 checkModifyPushConfigRequest(api.ModifyPushConfigRequest o) {
287 buildCounterModifyPushConfigRequest++; 284 buildCounterModifyPushConfigRequest++;
288 if (buildCounterModifyPushConfigRequest < 3) { 285 if (buildCounterModifyPushConfigRequest < 3) {
289 checkPushConfig(o.pushConfig); 286 checkPushConfig(o.pushConfig);
290 } 287 }
291 buildCounterModifyPushConfigRequest--; 288 buildCounterModifyPushConfigRequest--;
292 } 289 }
293 290
294 buildUnnamed3346() { 291 buildUnnamed3339() {
295 var o = new core.List<api.Binding>(); 292 var o = new core.List<api.Binding>();
296 o.add(buildBinding()); 293 o.add(buildBinding());
297 o.add(buildBinding()); 294 o.add(buildBinding());
298 return o; 295 return o;
299 } 296 }
300 297
301 checkUnnamed3346(core.List<api.Binding> o) { 298 checkUnnamed3339(core.List<api.Binding> o) {
302 unittest.expect(o, unittest.hasLength(2)); 299 unittest.expect(o, unittest.hasLength(2));
303 checkBinding(o[0]); 300 checkBinding(o[0]);
304 checkBinding(o[1]); 301 checkBinding(o[1]);
305 } 302 }
306 303
307 core.int buildCounterPolicy = 0; 304 core.int buildCounterPolicy = 0;
308 buildPolicy() { 305 buildPolicy() {
309 var o = new api.Policy(); 306 var o = new api.Policy();
310 buildCounterPolicy++; 307 buildCounterPolicy++;
311 if (buildCounterPolicy < 3) { 308 if (buildCounterPolicy < 3) {
312 o.bindings = buildUnnamed3346(); 309 o.bindings = buildUnnamed3339();
313 o.etag = "foo"; 310 o.etag = "foo";
314 o.version = 42; 311 o.version = 42;
315 } 312 }
316 buildCounterPolicy--; 313 buildCounterPolicy--;
317 return o; 314 return o;
318 } 315 }
319 316
320 checkPolicy(api.Policy o) { 317 checkPolicy(api.Policy o) {
321 buildCounterPolicy++; 318 buildCounterPolicy++;
322 if (buildCounterPolicy < 3) { 319 if (buildCounterPolicy < 3) {
323 checkUnnamed3346(o.bindings); 320 checkUnnamed3339(o.bindings);
324 unittest.expect(o.etag, unittest.equals('foo')); 321 unittest.expect(o.etag, unittest.equals('foo'));
325 unittest.expect(o.version, unittest.equals(42)); 322 unittest.expect(o.version, unittest.equals(42));
326 } 323 }
327 buildCounterPolicy--; 324 buildCounterPolicy--;
328 } 325 }
329 326
330 buildUnnamed3347() { 327 buildUnnamed3340() {
331 var o = new core.List<api.PubsubMessage>(); 328 var o = new core.List<api.PubsubMessage>();
332 o.add(buildPubsubMessage()); 329 o.add(buildPubsubMessage());
333 o.add(buildPubsubMessage()); 330 o.add(buildPubsubMessage());
334 return o; 331 return o;
335 } 332 }
336 333
337 checkUnnamed3347(core.List<api.PubsubMessage> o) { 334 checkUnnamed3340(core.List<api.PubsubMessage> o) {
338 unittest.expect(o, unittest.hasLength(2)); 335 unittest.expect(o, unittest.hasLength(2));
339 checkPubsubMessage(o[0]); 336 checkPubsubMessage(o[0]);
340 checkPubsubMessage(o[1]); 337 checkPubsubMessage(o[1]);
341 } 338 }
342 339
343 core.int buildCounterPublishRequest = 0; 340 core.int buildCounterPublishRequest = 0;
344 buildPublishRequest() { 341 buildPublishRequest() {
345 var o = new api.PublishRequest(); 342 var o = new api.PublishRequest();
346 buildCounterPublishRequest++; 343 buildCounterPublishRequest++;
347 if (buildCounterPublishRequest < 3) { 344 if (buildCounterPublishRequest < 3) {
348 o.messages = buildUnnamed3347(); 345 o.messages = buildUnnamed3340();
349 } 346 }
350 buildCounterPublishRequest--; 347 buildCounterPublishRequest--;
351 return o; 348 return o;
352 } 349 }
353 350
354 checkPublishRequest(api.PublishRequest o) { 351 checkPublishRequest(api.PublishRequest o) {
355 buildCounterPublishRequest++; 352 buildCounterPublishRequest++;
356 if (buildCounterPublishRequest < 3) { 353 if (buildCounterPublishRequest < 3) {
357 checkUnnamed3347(o.messages); 354 checkUnnamed3340(o.messages);
358 } 355 }
359 buildCounterPublishRequest--; 356 buildCounterPublishRequest--;
360 } 357 }
361 358
362 buildUnnamed3348() { 359 buildUnnamed3341() {
363 var o = new core.List<core.String>(); 360 var o = new core.List<core.String>();
364 o.add("foo"); 361 o.add("foo");
365 o.add("foo"); 362 o.add("foo");
366 return o; 363 return o;
367 } 364 }
368 365
369 checkUnnamed3348(core.List<core.String> o) { 366 checkUnnamed3341(core.List<core.String> o) {
370 unittest.expect(o, unittest.hasLength(2)); 367 unittest.expect(o, unittest.hasLength(2));
371 unittest.expect(o[0], unittest.equals('foo')); 368 unittest.expect(o[0], unittest.equals('foo'));
372 unittest.expect(o[1], unittest.equals('foo')); 369 unittest.expect(o[1], unittest.equals('foo'));
373 } 370 }
374 371
375 core.int buildCounterPublishResponse = 0; 372 core.int buildCounterPublishResponse = 0;
376 buildPublishResponse() { 373 buildPublishResponse() {
377 var o = new api.PublishResponse(); 374 var o = new api.PublishResponse();
378 buildCounterPublishResponse++; 375 buildCounterPublishResponse++;
379 if (buildCounterPublishResponse < 3) { 376 if (buildCounterPublishResponse < 3) {
380 o.messageIds = buildUnnamed3348(); 377 o.messageIds = buildUnnamed3341();
381 } 378 }
382 buildCounterPublishResponse--; 379 buildCounterPublishResponse--;
383 return o; 380 return o;
384 } 381 }
385 382
386 checkPublishResponse(api.PublishResponse o) { 383 checkPublishResponse(api.PublishResponse o) {
387 buildCounterPublishResponse++; 384 buildCounterPublishResponse++;
388 if (buildCounterPublishResponse < 3) { 385 if (buildCounterPublishResponse < 3) {
389 checkUnnamed3348(o.messageIds); 386 checkUnnamed3341(o.messageIds);
390 } 387 }
391 buildCounterPublishResponse--; 388 buildCounterPublishResponse--;
392 } 389 }
393 390
394 buildUnnamed3349() { 391 buildUnnamed3342() {
395 var o = new core.Map<core.String, core.String>(); 392 var o = new core.Map<core.String, core.String>();
396 o["x"] = "foo"; 393 o["x"] = "foo";
397 o["y"] = "foo"; 394 o["y"] = "foo";
398 return o; 395 return o;
399 } 396 }
400 397
401 checkUnnamed3349(core.Map<core.String, core.String> o) { 398 checkUnnamed3342(core.Map<core.String, core.String> o) {
402 unittest.expect(o, unittest.hasLength(2)); 399 unittest.expect(o, unittest.hasLength(2));
403 unittest.expect(o["x"], unittest.equals('foo')); 400 unittest.expect(o["x"], unittest.equals('foo'));
404 unittest.expect(o["y"], unittest.equals('foo')); 401 unittest.expect(o["y"], unittest.equals('foo'));
405 } 402 }
406 403
407 core.int buildCounterPubsubMessage = 0; 404 core.int buildCounterPubsubMessage = 0;
408 buildPubsubMessage() { 405 buildPubsubMessage() {
409 var o = new api.PubsubMessage(); 406 var o = new api.PubsubMessage();
410 buildCounterPubsubMessage++; 407 buildCounterPubsubMessage++;
411 if (buildCounterPubsubMessage < 3) { 408 if (buildCounterPubsubMessage < 3) {
412 o.attributes = buildUnnamed3349(); 409 o.attributes = buildUnnamed3342();
413 o.data = "foo"; 410 o.data = "foo";
414 o.messageId = "foo"; 411 o.messageId = "foo";
415 o.publishTime = "foo"; 412 o.publishTime = "foo";
416 } 413 }
417 buildCounterPubsubMessage--; 414 buildCounterPubsubMessage--;
418 return o; 415 return o;
419 } 416 }
420 417
421 checkPubsubMessage(api.PubsubMessage o) { 418 checkPubsubMessage(api.PubsubMessage o) {
422 buildCounterPubsubMessage++; 419 buildCounterPubsubMessage++;
423 if (buildCounterPubsubMessage < 3) { 420 if (buildCounterPubsubMessage < 3) {
424 checkUnnamed3349(o.attributes); 421 checkUnnamed3342(o.attributes);
425 unittest.expect(o.data, unittest.equals('foo')); 422 unittest.expect(o.data, unittest.equals('foo'));
426 unittest.expect(o.messageId, unittest.equals('foo')); 423 unittest.expect(o.messageId, unittest.equals('foo'));
427 unittest.expect(o.publishTime, unittest.equals('foo')); 424 unittest.expect(o.publishTime, unittest.equals('foo'));
428 } 425 }
429 buildCounterPubsubMessage--; 426 buildCounterPubsubMessage--;
430 } 427 }
431 428
432 core.int buildCounterPullRequest = 0; 429 core.int buildCounterPullRequest = 0;
433 buildPullRequest() { 430 buildPullRequest() {
434 var o = new api.PullRequest(); 431 var o = new api.PullRequest();
435 buildCounterPullRequest++; 432 buildCounterPullRequest++;
436 if (buildCounterPullRequest < 3) { 433 if (buildCounterPullRequest < 3) {
437 o.maxMessages = 42; 434 o.maxMessages = 42;
438 o.returnImmediately = true; 435 o.returnImmediately = true;
439 } 436 }
440 buildCounterPullRequest--; 437 buildCounterPullRequest--;
441 return o; 438 return o;
442 } 439 }
443 440
444 checkPullRequest(api.PullRequest o) { 441 checkPullRequest(api.PullRequest o) {
445 buildCounterPullRequest++; 442 buildCounterPullRequest++;
446 if (buildCounterPullRequest < 3) { 443 if (buildCounterPullRequest < 3) {
447 unittest.expect(o.maxMessages, unittest.equals(42)); 444 unittest.expect(o.maxMessages, unittest.equals(42));
448 unittest.expect(o.returnImmediately, unittest.isTrue); 445 unittest.expect(o.returnImmediately, unittest.isTrue);
449 } 446 }
450 buildCounterPullRequest--; 447 buildCounterPullRequest--;
451 } 448 }
452 449
453 buildUnnamed3350() { 450 buildUnnamed3343() {
454 var o = new core.List<api.ReceivedMessage>(); 451 var o = new core.List<api.ReceivedMessage>();
455 o.add(buildReceivedMessage()); 452 o.add(buildReceivedMessage());
456 o.add(buildReceivedMessage()); 453 o.add(buildReceivedMessage());
457 return o; 454 return o;
458 } 455 }
459 456
460 checkUnnamed3350(core.List<api.ReceivedMessage> o) { 457 checkUnnamed3343(core.List<api.ReceivedMessage> o) {
461 unittest.expect(o, unittest.hasLength(2)); 458 unittest.expect(o, unittest.hasLength(2));
462 checkReceivedMessage(o[0]); 459 checkReceivedMessage(o[0]);
463 checkReceivedMessage(o[1]); 460 checkReceivedMessage(o[1]);
464 } 461 }
465 462
466 core.int buildCounterPullResponse = 0; 463 core.int buildCounterPullResponse = 0;
467 buildPullResponse() { 464 buildPullResponse() {
468 var o = new api.PullResponse(); 465 var o = new api.PullResponse();
469 buildCounterPullResponse++; 466 buildCounterPullResponse++;
470 if (buildCounterPullResponse < 3) { 467 if (buildCounterPullResponse < 3) {
471 o.receivedMessages = buildUnnamed3350(); 468 o.receivedMessages = buildUnnamed3343();
472 } 469 }
473 buildCounterPullResponse--; 470 buildCounterPullResponse--;
474 return o; 471 return o;
475 } 472 }
476 473
477 checkPullResponse(api.PullResponse o) { 474 checkPullResponse(api.PullResponse o) {
478 buildCounterPullResponse++; 475 buildCounterPullResponse++;
479 if (buildCounterPullResponse < 3) { 476 if (buildCounterPullResponse < 3) {
480 checkUnnamed3350(o.receivedMessages); 477 checkUnnamed3343(o.receivedMessages);
481 } 478 }
482 buildCounterPullResponse--; 479 buildCounterPullResponse--;
483 } 480 }
484 481
485 buildUnnamed3351() { 482 buildUnnamed3344() {
486 var o = new core.Map<core.String, core.String>(); 483 var o = new core.Map<core.String, core.String>();
487 o["x"] = "foo"; 484 o["x"] = "foo";
488 o["y"] = "foo"; 485 o["y"] = "foo";
489 return o; 486 return o;
490 } 487 }
491 488
492 checkUnnamed3351(core.Map<core.String, core.String> o) { 489 checkUnnamed3344(core.Map<core.String, core.String> o) {
493 unittest.expect(o, unittest.hasLength(2)); 490 unittest.expect(o, unittest.hasLength(2));
494 unittest.expect(o["x"], unittest.equals('foo')); 491 unittest.expect(o["x"], unittest.equals('foo'));
495 unittest.expect(o["y"], unittest.equals('foo')); 492 unittest.expect(o["y"], unittest.equals('foo'));
496 } 493 }
497 494
498 core.int buildCounterPushConfig = 0; 495 core.int buildCounterPushConfig = 0;
499 buildPushConfig() { 496 buildPushConfig() {
500 var o = new api.PushConfig(); 497 var o = new api.PushConfig();
501 buildCounterPushConfig++; 498 buildCounterPushConfig++;
502 if (buildCounterPushConfig < 3) { 499 if (buildCounterPushConfig < 3) {
503 o.attributes = buildUnnamed3351(); 500 o.attributes = buildUnnamed3344();
504 o.pushEndpoint = "foo"; 501 o.pushEndpoint = "foo";
505 } 502 }
506 buildCounterPushConfig--; 503 buildCounterPushConfig--;
507 return o; 504 return o;
508 } 505 }
509 506
510 checkPushConfig(api.PushConfig o) { 507 checkPushConfig(api.PushConfig o) {
511 buildCounterPushConfig++; 508 buildCounterPushConfig++;
512 if (buildCounterPushConfig < 3) { 509 if (buildCounterPushConfig < 3) {
513 checkUnnamed3351(o.attributes); 510 checkUnnamed3344(o.attributes);
514 unittest.expect(o.pushEndpoint, unittest.equals('foo')); 511 unittest.expect(o.pushEndpoint, unittest.equals('foo'));
515 } 512 }
516 buildCounterPushConfig--; 513 buildCounterPushConfig--;
517 } 514 }
518 515
519 core.int buildCounterReceivedMessage = 0; 516 core.int buildCounterReceivedMessage = 0;
520 buildReceivedMessage() { 517 buildReceivedMessage() {
521 var o = new api.ReceivedMessage(); 518 var o = new api.ReceivedMessage();
522 buildCounterReceivedMessage++; 519 buildCounterReceivedMessage++;
523 if (buildCounterReceivedMessage < 3) { 520 if (buildCounterReceivedMessage < 3) {
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 buildCounterSubscription++; 571 buildCounterSubscription++;
575 if (buildCounterSubscription < 3) { 572 if (buildCounterSubscription < 3) {
576 unittest.expect(o.ackDeadlineSeconds, unittest.equals(42)); 573 unittest.expect(o.ackDeadlineSeconds, unittest.equals(42));
577 unittest.expect(o.name, unittest.equals('foo')); 574 unittest.expect(o.name, unittest.equals('foo'));
578 checkPushConfig(o.pushConfig); 575 checkPushConfig(o.pushConfig);
579 unittest.expect(o.topic, unittest.equals('foo')); 576 unittest.expect(o.topic, unittest.equals('foo'));
580 } 577 }
581 buildCounterSubscription--; 578 buildCounterSubscription--;
582 } 579 }
583 580
584 buildUnnamed3352() { 581 buildUnnamed3345() {
585 var o = new core.List<core.String>(); 582 var o = new core.List<core.String>();
586 o.add("foo"); 583 o.add("foo");
587 o.add("foo"); 584 o.add("foo");
588 return o; 585 return o;
589 } 586 }
590 587
591 checkUnnamed3352(core.List<core.String> o) { 588 checkUnnamed3345(core.List<core.String> o) {
592 unittest.expect(o, unittest.hasLength(2)); 589 unittest.expect(o, unittest.hasLength(2));
593 unittest.expect(o[0], unittest.equals('foo')); 590 unittest.expect(o[0], unittest.equals('foo'));
594 unittest.expect(o[1], unittest.equals('foo')); 591 unittest.expect(o[1], unittest.equals('foo'));
595 } 592 }
596 593
597 core.int buildCounterTestIamPermissionsRequest = 0; 594 core.int buildCounterTestIamPermissionsRequest = 0;
598 buildTestIamPermissionsRequest() { 595 buildTestIamPermissionsRequest() {
599 var o = new api.TestIamPermissionsRequest(); 596 var o = new api.TestIamPermissionsRequest();
600 buildCounterTestIamPermissionsRequest++; 597 buildCounterTestIamPermissionsRequest++;
601 if (buildCounterTestIamPermissionsRequest < 3) { 598 if (buildCounterTestIamPermissionsRequest < 3) {
602 o.permissions = buildUnnamed3352(); 599 o.permissions = buildUnnamed3345();
603 } 600 }
604 buildCounterTestIamPermissionsRequest--; 601 buildCounterTestIamPermissionsRequest--;
605 return o; 602 return o;
606 } 603 }
607 604
608 checkTestIamPermissionsRequest(api.TestIamPermissionsRequest o) { 605 checkTestIamPermissionsRequest(api.TestIamPermissionsRequest o) {
609 buildCounterTestIamPermissionsRequest++; 606 buildCounterTestIamPermissionsRequest++;
610 if (buildCounterTestIamPermissionsRequest < 3) { 607 if (buildCounterTestIamPermissionsRequest < 3) {
611 checkUnnamed3352(o.permissions); 608 checkUnnamed3345(o.permissions);
612 } 609 }
613 buildCounterTestIamPermissionsRequest--; 610 buildCounterTestIamPermissionsRequest--;
614 } 611 }
615 612
616 buildUnnamed3353() { 613 buildUnnamed3346() {
617 var o = new core.List<core.String>(); 614 var o = new core.List<core.String>();
618 o.add("foo"); 615 o.add("foo");
619 o.add("foo"); 616 o.add("foo");
620 return o; 617 return o;
621 } 618 }
622 619
623 checkUnnamed3353(core.List<core.String> o) { 620 checkUnnamed3346(core.List<core.String> o) {
624 unittest.expect(o, unittest.hasLength(2)); 621 unittest.expect(o, unittest.hasLength(2));
625 unittest.expect(o[0], unittest.equals('foo')); 622 unittest.expect(o[0], unittest.equals('foo'));
626 unittest.expect(o[1], unittest.equals('foo')); 623 unittest.expect(o[1], unittest.equals('foo'));
627 } 624 }
628 625
629 core.int buildCounterTestIamPermissionsResponse = 0; 626 core.int buildCounterTestIamPermissionsResponse = 0;
630 buildTestIamPermissionsResponse() { 627 buildTestIamPermissionsResponse() {
631 var o = new api.TestIamPermissionsResponse(); 628 var o = new api.TestIamPermissionsResponse();
632 buildCounterTestIamPermissionsResponse++; 629 buildCounterTestIamPermissionsResponse++;
633 if (buildCounterTestIamPermissionsResponse < 3) { 630 if (buildCounterTestIamPermissionsResponse < 3) {
634 o.permissions = buildUnnamed3353(); 631 o.permissions = buildUnnamed3346();
635 } 632 }
636 buildCounterTestIamPermissionsResponse--; 633 buildCounterTestIamPermissionsResponse--;
637 return o; 634 return o;
638 } 635 }
639 636
640 checkTestIamPermissionsResponse(api.TestIamPermissionsResponse o) { 637 checkTestIamPermissionsResponse(api.TestIamPermissionsResponse o) {
641 buildCounterTestIamPermissionsResponse++; 638 buildCounterTestIamPermissionsResponse++;
642 if (buildCounterTestIamPermissionsResponse < 3) { 639 if (buildCounterTestIamPermissionsResponse < 3) {
643 checkUnnamed3353(o.permissions); 640 checkUnnamed3346(o.permissions);
644 } 641 }
645 buildCounterTestIamPermissionsResponse--; 642 buildCounterTestIamPermissionsResponse--;
646 } 643 }
647 644
648 core.int buildCounterTopic = 0; 645 core.int buildCounterTopic = 0;
649 buildTopic() { 646 buildTopic() {
650 var o = new api.Topic(); 647 var o = new api.Topic();
651 buildCounterTopic++; 648 buildCounterTopic++;
652 if (buildCounterTopic < 3) { 649 if (buildCounterTopic < 3) {
653 o.name = "foo"; 650 o.name = "foo";
654 } 651 }
655 buildCounterTopic--; 652 buildCounterTopic--;
656 return o; 653 return o;
657 } 654 }
658 655
659 checkTopic(api.Topic o) { 656 checkTopic(api.Topic o) {
660 buildCounterTopic++; 657 buildCounterTopic++;
661 if (buildCounterTopic < 3) { 658 if (buildCounterTopic < 3) {
662 unittest.expect(o.name, unittest.equals('foo')); 659 unittest.expect(o.name, unittest.equals('foo'));
663 } 660 }
664 buildCounterTopic--; 661 buildCounterTopic--;
665 } 662 }
666 663
667
668 main() { 664 main() {
669 unittest.group("obj-schema-AcknowledgeRequest", () { 665 unittest.group("obj-schema-AcknowledgeRequest", () {
670 unittest.test("to-json--from-json", () { 666 unittest.test("to-json--from-json", () {
671 var o = buildAcknowledgeRequest(); 667 var o = buildAcknowledgeRequest();
672 var od = new api.AcknowledgeRequest.fromJson(o.toJson()); 668 var od = new api.AcknowledgeRequest.fromJson(o.toJson());
673 checkAcknowledgeRequest(od); 669 checkAcknowledgeRequest(od);
674 }); 670 });
675 }); 671 });
676 672
677
678 unittest.group("obj-schema-Binding", () { 673 unittest.group("obj-schema-Binding", () {
679 unittest.test("to-json--from-json", () { 674 unittest.test("to-json--from-json", () {
680 var o = buildBinding(); 675 var o = buildBinding();
681 var od = new api.Binding.fromJson(o.toJson()); 676 var od = new api.Binding.fromJson(o.toJson());
682 checkBinding(od); 677 checkBinding(od);
683 }); 678 });
684 }); 679 });
685 680
686
687 unittest.group("obj-schema-Empty", () { 681 unittest.group("obj-schema-Empty", () {
688 unittest.test("to-json--from-json", () { 682 unittest.test("to-json--from-json", () {
689 var o = buildEmpty(); 683 var o = buildEmpty();
690 var od = new api.Empty.fromJson(o.toJson()); 684 var od = new api.Empty.fromJson(o.toJson());
691 checkEmpty(od); 685 checkEmpty(od);
692 }); 686 });
693 }); 687 });
694 688
695
696 unittest.group("obj-schema-ListSubscriptionsResponse", () { 689 unittest.group("obj-schema-ListSubscriptionsResponse", () {
697 unittest.test("to-json--from-json", () { 690 unittest.test("to-json--from-json", () {
698 var o = buildListSubscriptionsResponse(); 691 var o = buildListSubscriptionsResponse();
699 var od = new api.ListSubscriptionsResponse.fromJson(o.toJson()); 692 var od = new api.ListSubscriptionsResponse.fromJson(o.toJson());
700 checkListSubscriptionsResponse(od); 693 checkListSubscriptionsResponse(od);
701 }); 694 });
702 }); 695 });
703 696
704
705 unittest.group("obj-schema-ListTopicSubscriptionsResponse", () { 697 unittest.group("obj-schema-ListTopicSubscriptionsResponse", () {
706 unittest.test("to-json--from-json", () { 698 unittest.test("to-json--from-json", () {
707 var o = buildListTopicSubscriptionsResponse(); 699 var o = buildListTopicSubscriptionsResponse();
708 var od = new api.ListTopicSubscriptionsResponse.fromJson(o.toJson()); 700 var od = new api.ListTopicSubscriptionsResponse.fromJson(o.toJson());
709 checkListTopicSubscriptionsResponse(od); 701 checkListTopicSubscriptionsResponse(od);
710 }); 702 });
711 }); 703 });
712 704
713
714 unittest.group("obj-schema-ListTopicsResponse", () { 705 unittest.group("obj-schema-ListTopicsResponse", () {
715 unittest.test("to-json--from-json", () { 706 unittest.test("to-json--from-json", () {
716 var o = buildListTopicsResponse(); 707 var o = buildListTopicsResponse();
717 var od = new api.ListTopicsResponse.fromJson(o.toJson()); 708 var od = new api.ListTopicsResponse.fromJson(o.toJson());
718 checkListTopicsResponse(od); 709 checkListTopicsResponse(od);
719 }); 710 });
720 }); 711 });
721 712
722
723 unittest.group("obj-schema-ModifyAckDeadlineRequest", () { 713 unittest.group("obj-schema-ModifyAckDeadlineRequest", () {
724 unittest.test("to-json--from-json", () { 714 unittest.test("to-json--from-json", () {
725 var o = buildModifyAckDeadlineRequest(); 715 var o = buildModifyAckDeadlineRequest();
726 var od = new api.ModifyAckDeadlineRequest.fromJson(o.toJson()); 716 var od = new api.ModifyAckDeadlineRequest.fromJson(o.toJson());
727 checkModifyAckDeadlineRequest(od); 717 checkModifyAckDeadlineRequest(od);
728 }); 718 });
729 }); 719 });
730 720
731
732 unittest.group("obj-schema-ModifyPushConfigRequest", () { 721 unittest.group("obj-schema-ModifyPushConfigRequest", () {
733 unittest.test("to-json--from-json", () { 722 unittest.test("to-json--from-json", () {
734 var o = buildModifyPushConfigRequest(); 723 var o = buildModifyPushConfigRequest();
735 var od = new api.ModifyPushConfigRequest.fromJson(o.toJson()); 724 var od = new api.ModifyPushConfigRequest.fromJson(o.toJson());
736 checkModifyPushConfigRequest(od); 725 checkModifyPushConfigRequest(od);
737 }); 726 });
738 }); 727 });
739 728
740
741 unittest.group("obj-schema-Policy", () { 729 unittest.group("obj-schema-Policy", () {
742 unittest.test("to-json--from-json", () { 730 unittest.test("to-json--from-json", () {
743 var o = buildPolicy(); 731 var o = buildPolicy();
744 var od = new api.Policy.fromJson(o.toJson()); 732 var od = new api.Policy.fromJson(o.toJson());
745 checkPolicy(od); 733 checkPolicy(od);
746 }); 734 });
747 }); 735 });
748 736
749
750 unittest.group("obj-schema-PublishRequest", () { 737 unittest.group("obj-schema-PublishRequest", () {
751 unittest.test("to-json--from-json", () { 738 unittest.test("to-json--from-json", () {
752 var o = buildPublishRequest(); 739 var o = buildPublishRequest();
753 var od = new api.PublishRequest.fromJson(o.toJson()); 740 var od = new api.PublishRequest.fromJson(o.toJson());
754 checkPublishRequest(od); 741 checkPublishRequest(od);
755 }); 742 });
756 }); 743 });
757 744
758
759 unittest.group("obj-schema-PublishResponse", () { 745 unittest.group("obj-schema-PublishResponse", () {
760 unittest.test("to-json--from-json", () { 746 unittest.test("to-json--from-json", () {
761 var o = buildPublishResponse(); 747 var o = buildPublishResponse();
762 var od = new api.PublishResponse.fromJson(o.toJson()); 748 var od = new api.PublishResponse.fromJson(o.toJson());
763 checkPublishResponse(od); 749 checkPublishResponse(od);
764 }); 750 });
765 }); 751 });
766 752
767
768 unittest.group("obj-schema-PubsubMessage", () { 753 unittest.group("obj-schema-PubsubMessage", () {
769 unittest.test("to-json--from-json", () { 754 unittest.test("to-json--from-json", () {
770 var o = buildPubsubMessage(); 755 var o = buildPubsubMessage();
771 var od = new api.PubsubMessage.fromJson(o.toJson()); 756 var od = new api.PubsubMessage.fromJson(o.toJson());
772 checkPubsubMessage(od); 757 checkPubsubMessage(od);
773 }); 758 });
774 }); 759 });
775 760
776
777 unittest.group("obj-schema-PullRequest", () { 761 unittest.group("obj-schema-PullRequest", () {
778 unittest.test("to-json--from-json", () { 762 unittest.test("to-json--from-json", () {
779 var o = buildPullRequest(); 763 var o = buildPullRequest();
780 var od = new api.PullRequest.fromJson(o.toJson()); 764 var od = new api.PullRequest.fromJson(o.toJson());
781 checkPullRequest(od); 765 checkPullRequest(od);
782 }); 766 });
783 }); 767 });
784 768
785
786 unittest.group("obj-schema-PullResponse", () { 769 unittest.group("obj-schema-PullResponse", () {
787 unittest.test("to-json--from-json", () { 770 unittest.test("to-json--from-json", () {
788 var o = buildPullResponse(); 771 var o = buildPullResponse();
789 var od = new api.PullResponse.fromJson(o.toJson()); 772 var od = new api.PullResponse.fromJson(o.toJson());
790 checkPullResponse(od); 773 checkPullResponse(od);
791 }); 774 });
792 }); 775 });
793 776
794
795 unittest.group("obj-schema-PushConfig", () { 777 unittest.group("obj-schema-PushConfig", () {
796 unittest.test("to-json--from-json", () { 778 unittest.test("to-json--from-json", () {
797 var o = buildPushConfig(); 779 var o = buildPushConfig();
798 var od = new api.PushConfig.fromJson(o.toJson()); 780 var od = new api.PushConfig.fromJson(o.toJson());
799 checkPushConfig(od); 781 checkPushConfig(od);
800 }); 782 });
801 }); 783 });
802 784
803
804 unittest.group("obj-schema-ReceivedMessage", () { 785 unittest.group("obj-schema-ReceivedMessage", () {
805 unittest.test("to-json--from-json", () { 786 unittest.test("to-json--from-json", () {
806 var o = buildReceivedMessage(); 787 var o = buildReceivedMessage();
807 var od = new api.ReceivedMessage.fromJson(o.toJson()); 788 var od = new api.ReceivedMessage.fromJson(o.toJson());
808 checkReceivedMessage(od); 789 checkReceivedMessage(od);
809 }); 790 });
810 }); 791 });
811 792
812
813 unittest.group("obj-schema-SetIamPolicyRequest", () { 793 unittest.group("obj-schema-SetIamPolicyRequest", () {
814 unittest.test("to-json--from-json", () { 794 unittest.test("to-json--from-json", () {
815 var o = buildSetIamPolicyRequest(); 795 var o = buildSetIamPolicyRequest();
816 var od = new api.SetIamPolicyRequest.fromJson(o.toJson()); 796 var od = new api.SetIamPolicyRequest.fromJson(o.toJson());
817 checkSetIamPolicyRequest(od); 797 checkSetIamPolicyRequest(od);
818 }); 798 });
819 }); 799 });
820 800
821
822 unittest.group("obj-schema-Subscription", () { 801 unittest.group("obj-schema-Subscription", () {
823 unittest.test("to-json--from-json", () { 802 unittest.test("to-json--from-json", () {
824 var o = buildSubscription(); 803 var o = buildSubscription();
825 var od = new api.Subscription.fromJson(o.toJson()); 804 var od = new api.Subscription.fromJson(o.toJson());
826 checkSubscription(od); 805 checkSubscription(od);
827 }); 806 });
828 }); 807 });
829 808
830
831 unittest.group("obj-schema-TestIamPermissionsRequest", () { 809 unittest.group("obj-schema-TestIamPermissionsRequest", () {
832 unittest.test("to-json--from-json", () { 810 unittest.test("to-json--from-json", () {
833 var o = buildTestIamPermissionsRequest(); 811 var o = buildTestIamPermissionsRequest();
834 var od = new api.TestIamPermissionsRequest.fromJson(o.toJson()); 812 var od = new api.TestIamPermissionsRequest.fromJson(o.toJson());
835 checkTestIamPermissionsRequest(od); 813 checkTestIamPermissionsRequest(od);
836 }); 814 });
837 }); 815 });
838 816
839
840 unittest.group("obj-schema-TestIamPermissionsResponse", () { 817 unittest.group("obj-schema-TestIamPermissionsResponse", () {
841 unittest.test("to-json--from-json", () { 818 unittest.test("to-json--from-json", () {
842 var o = buildTestIamPermissionsResponse(); 819 var o = buildTestIamPermissionsResponse();
843 var od = new api.TestIamPermissionsResponse.fromJson(o.toJson()); 820 var od = new api.TestIamPermissionsResponse.fromJson(o.toJson());
844 checkTestIamPermissionsResponse(od); 821 checkTestIamPermissionsResponse(od);
845 }); 822 });
846 }); 823 });
847 824
848
849 unittest.group("obj-schema-Topic", () { 825 unittest.group("obj-schema-Topic", () {
850 unittest.test("to-json--from-json", () { 826 unittest.test("to-json--from-json", () {
851 var o = buildTopic(); 827 var o = buildTopic();
852 var od = new api.Topic.fromJson(o.toJson()); 828 var od = new api.Topic.fromJson(o.toJson());
853 checkTopic(od); 829 checkTopic(od);
854 }); 830 });
855 }); 831 });
856 832
857
858 unittest.group("resource-ProjectsSubscriptionsResourceApi", () { 833 unittest.group("resource-ProjectsSubscriptionsResourceApi", () {
859 unittest.test("method--acknowledge", () { 834 unittest.test("method--acknowledge", () {
860
861 var mock = new HttpServerMock(); 835 var mock = new HttpServerMock();
862 api.ProjectsSubscriptionsResourceApi res = new api.PubsubApi(mock).project s.subscriptions; 836 api.ProjectsSubscriptionsResourceApi res =
837 new api.PubsubApi(mock).projects.subscriptions;
863 var arg_request = buildAcknowledgeRequest(); 838 var arg_request = buildAcknowledgeRequest();
864 var arg_subscription = "foo"; 839 var arg_subscription = "foo";
865 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { 840 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
866 var obj = new api.AcknowledgeRequest.fromJson(json); 841 var obj = new api.AcknowledgeRequest.fromJson(json);
867 checkAcknowledgeRequest(obj); 842 checkAcknowledgeRequest(obj);
868 843
869 var path = (req.url).path; 844 var path = (req.url).path;
870 var pathOffset = 0; 845 var pathOffset = 0;
871 var index; 846 var index;
872 var subPart; 847 var subPart;
873 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/")); 848 unittest.expect(
849 path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
874 pathOffset += 1; 850 pathOffset += 1;
875 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ als("v1beta2/")); 851 unittest.expect(path.substring(pathOffset, pathOffset + 8),
852 unittest.equals("v1beta2/"));
876 pathOffset += 8; 853 pathOffset += 8;
877 // NOTE: We cannot test reserved expansions due to the inability to reve rse the operation; 854 // NOTE: We cannot test reserved expansions due to the inability to reve rse the operation;
878 855
879 var query = (req.url).query; 856 var query = (req.url).query;
880 var queryOffset = 0; 857 var queryOffset = 0;
881 var queryMap = {}; 858 var queryMap = {};
882 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); 859 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
883 parseBool(n) { 860 parseBool(n) {
884 if (n == "true") return true; 861 if (n == "true") return true;
885 if (n == "false") return false; 862 if (n == "false") return false;
886 if (n == null) return null; 863 if (n == null) return null;
887 throw new core.ArgumentError("Invalid boolean: $n"); 864 throw new core.ArgumentError("Invalid boolean: $n");
888 } 865 }
866
889 if (query.length > 0) { 867 if (query.length > 0) {
890 for (var part in query.split("&")) { 868 for (var part in query.split("&")) {
891 var keyvalue = part.split("="); 869 var keyvalue = part.split("=");
892 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1])); 870 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]),
871 core.Uri.decodeQueryComponent(keyvalue[1]));
893 } 872 }
894 } 873 }
895 874
896
897 var h = { 875 var h = {
898 "content-type" : "application/json; charset=utf-8", 876 "content-type": "application/json; charset=utf-8",
899 }; 877 };
900 var resp = convert.JSON.encode(buildEmpty()); 878 var resp = convert.JSON.encode(buildEmpty());
901 return new async.Future.value(stringResponse(200, h, resp)); 879 return new async.Future.value(stringResponse(200, h, resp));
902 }), true); 880 }), true);
903 res.acknowledge(arg_request, arg_subscription).then(unittest.expectAsync1( ((api.Empty response) { 881 res
882 .acknowledge(arg_request, arg_subscription)
883 .then(unittest.expectAsync1(((api.Empty response) {
904 checkEmpty(response); 884 checkEmpty(response);
905 }))); 885 })));
906 }); 886 });
907 887
908 unittest.test("method--create", () { 888 unittest.test("method--create", () {
909
910 var mock = new HttpServerMock(); 889 var mock = new HttpServerMock();
911 api.ProjectsSubscriptionsResourceApi res = new api.PubsubApi(mock).project s.subscriptions; 890 api.ProjectsSubscriptionsResourceApi res =
891 new api.PubsubApi(mock).projects.subscriptions;
912 var arg_request = buildSubscription(); 892 var arg_request = buildSubscription();
913 var arg_name = "foo"; 893 var arg_name = "foo";
914 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { 894 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
915 var obj = new api.Subscription.fromJson(json); 895 var obj = new api.Subscription.fromJson(json);
916 checkSubscription(obj); 896 checkSubscription(obj);
917 897
918 var path = (req.url).path; 898 var path = (req.url).path;
919 var pathOffset = 0; 899 var pathOffset = 0;
920 var index; 900 var index;
921 var subPart; 901 var subPart;
922 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/")); 902 unittest.expect(
903 path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
923 pathOffset += 1; 904 pathOffset += 1;
924 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ als("v1beta2/")); 905 unittest.expect(path.substring(pathOffset, pathOffset + 8),
906 unittest.equals("v1beta2/"));
925 pathOffset += 8; 907 pathOffset += 8;
926 // NOTE: We cannot test reserved expansions due to the inability to reve rse the operation; 908 // NOTE: We cannot test reserved expansions due to the inability to reve rse the operation;
927 909
928 var query = (req.url).query; 910 var query = (req.url).query;
929 var queryOffset = 0; 911 var queryOffset = 0;
930 var queryMap = {}; 912 var queryMap = {};
931 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); 913 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
932 parseBool(n) { 914 parseBool(n) {
933 if (n == "true") return true; 915 if (n == "true") return true;
934 if (n == "false") return false; 916 if (n == "false") return false;
935 if (n == null) return null; 917 if (n == null) return null;
936 throw new core.ArgumentError("Invalid boolean: $n"); 918 throw new core.ArgumentError("Invalid boolean: $n");
937 } 919 }
920
938 if (query.length > 0) { 921 if (query.length > 0) {
939 for (var part in query.split("&")) { 922 for (var part in query.split("&")) {
940 var keyvalue = part.split("="); 923 var keyvalue = part.split("=");
941 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1])); 924 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]),
925 core.Uri.decodeQueryComponent(keyvalue[1]));
942 } 926 }
943 } 927 }
944 928
945
946 var h = { 929 var h = {
947 "content-type" : "application/json; charset=utf-8", 930 "content-type": "application/json; charset=utf-8",
948 }; 931 };
949 var resp = convert.JSON.encode(buildSubscription()); 932 var resp = convert.JSON.encode(buildSubscription());
950 return new async.Future.value(stringResponse(200, h, resp)); 933 return new async.Future.value(stringResponse(200, h, resp));
951 }), true); 934 }), true);
952 res.create(arg_request, arg_name).then(unittest.expectAsync1(((api.Subscri ption response) { 935 res
936 .create(arg_request, arg_name)
937 .then(unittest.expectAsync1(((api.Subscription response) {
953 checkSubscription(response); 938 checkSubscription(response);
954 }))); 939 })));
955 }); 940 });
956 941
957 unittest.test("method--delete", () { 942 unittest.test("method--delete", () {
958
959 var mock = new HttpServerMock(); 943 var mock = new HttpServerMock();
960 api.ProjectsSubscriptionsResourceApi res = new api.PubsubApi(mock).project s.subscriptions; 944 api.ProjectsSubscriptionsResourceApi res =
945 new api.PubsubApi(mock).projects.subscriptions;
961 var arg_subscription = "foo"; 946 var arg_subscription = "foo";
962 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { 947 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
963 var path = (req.url).path; 948 var path = (req.url).path;
964 var pathOffset = 0; 949 var pathOffset = 0;
965 var index; 950 var index;
966 var subPart; 951 var subPart;
967 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/")); 952 unittest.expect(
953 path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
968 pathOffset += 1; 954 pathOffset += 1;
969 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ als("v1beta2/")); 955 unittest.expect(path.substring(pathOffset, pathOffset + 8),
956 unittest.equals("v1beta2/"));
970 pathOffset += 8; 957 pathOffset += 8;
971 // NOTE: We cannot test reserved expansions due to the inability to reve rse the operation; 958 // NOTE: We cannot test reserved expansions due to the inability to reve rse the operation;
972 959
973 var query = (req.url).query; 960 var query = (req.url).query;
974 var queryOffset = 0; 961 var queryOffset = 0;
975 var queryMap = {}; 962 var queryMap = {};
976 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); 963 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
977 parseBool(n) { 964 parseBool(n) {
978 if (n == "true") return true; 965 if (n == "true") return true;
979 if (n == "false") return false; 966 if (n == "false") return false;
980 if (n == null) return null; 967 if (n == null) return null;
981 throw new core.ArgumentError("Invalid boolean: $n"); 968 throw new core.ArgumentError("Invalid boolean: $n");
982 } 969 }
970
983 if (query.length > 0) { 971 if (query.length > 0) {
984 for (var part in query.split("&")) { 972 for (var part in query.split("&")) {
985 var keyvalue = part.split("="); 973 var keyvalue = part.split("=");
986 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1])); 974 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]),
975 core.Uri.decodeQueryComponent(keyvalue[1]));
987 } 976 }
988 } 977 }
989 978
990
991 var h = { 979 var h = {
992 "content-type" : "application/json; charset=utf-8", 980 "content-type": "application/json; charset=utf-8",
993 }; 981 };
994 var resp = convert.JSON.encode(buildEmpty()); 982 var resp = convert.JSON.encode(buildEmpty());
995 return new async.Future.value(stringResponse(200, h, resp)); 983 return new async.Future.value(stringResponse(200, h, resp));
996 }), true); 984 }), true);
997 res.delete(arg_subscription).then(unittest.expectAsync1(((api.Empty respon se) { 985 res
986 .delete(arg_subscription)
987 .then(unittest.expectAsync1(((api.Empty response) {
998 checkEmpty(response); 988 checkEmpty(response);
999 }))); 989 })));
1000 }); 990 });
1001 991
1002 unittest.test("method--get", () { 992 unittest.test("method--get", () {
1003
1004 var mock = new HttpServerMock(); 993 var mock = new HttpServerMock();
1005 api.ProjectsSubscriptionsResourceApi res = new api.PubsubApi(mock).project s.subscriptions; 994 api.ProjectsSubscriptionsResourceApi res =
995 new api.PubsubApi(mock).projects.subscriptions;
1006 var arg_subscription = "foo"; 996 var arg_subscription = "foo";
1007 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { 997 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
1008 var path = (req.url).path; 998 var path = (req.url).path;
1009 var pathOffset = 0; 999 var pathOffset = 0;
1010 var index; 1000 var index;
1011 var subPart; 1001 var subPart;
1012 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/")); 1002 unittest.expect(
1003 path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
1013 pathOffset += 1; 1004 pathOffset += 1;
1014 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ als("v1beta2/")); 1005 unittest.expect(path.substring(pathOffset, pathOffset + 8),
1006 unittest.equals("v1beta2/"));
1015 pathOffset += 8; 1007 pathOffset += 8;
1016 // NOTE: We cannot test reserved expansions due to the inability to reve rse the operation; 1008 // NOTE: We cannot test reserved expansions due to the inability to reve rse the operation;
1017 1009
1018 var query = (req.url).query; 1010 var query = (req.url).query;
1019 var queryOffset = 0; 1011 var queryOffset = 0;
1020 var queryMap = {}; 1012 var queryMap = {};
1021 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); 1013 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
1022 parseBool(n) { 1014 parseBool(n) {
1023 if (n == "true") return true; 1015 if (n == "true") return true;
1024 if (n == "false") return false; 1016 if (n == "false") return false;
1025 if (n == null) return null; 1017 if (n == null) return null;
1026 throw new core.ArgumentError("Invalid boolean: $n"); 1018 throw new core.ArgumentError("Invalid boolean: $n");
1027 } 1019 }
1020
1028 if (query.length > 0) { 1021 if (query.length > 0) {
1029 for (var part in query.split("&")) { 1022 for (var part in query.split("&")) {
1030 var keyvalue = part.split("="); 1023 var keyvalue = part.split("=");
1031 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1])); 1024 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]),
1025 core.Uri.decodeQueryComponent(keyvalue[1]));
1032 } 1026 }
1033 } 1027 }
1034 1028
1035
1036 var h = { 1029 var h = {
1037 "content-type" : "application/json; charset=utf-8", 1030 "content-type": "application/json; charset=utf-8",
1038 }; 1031 };
1039 var resp = convert.JSON.encode(buildSubscription()); 1032 var resp = convert.JSON.encode(buildSubscription());
1040 return new async.Future.value(stringResponse(200, h, resp)); 1033 return new async.Future.value(stringResponse(200, h, resp));
1041 }), true); 1034 }), true);
1042 res.get(arg_subscription).then(unittest.expectAsync1(((api.Subscription re sponse) { 1035 res
1036 .get(arg_subscription)
1037 .then(unittest.expectAsync1(((api.Subscription response) {
1043 checkSubscription(response); 1038 checkSubscription(response);
1044 }))); 1039 })));
1045 }); 1040 });
1046 1041
1047 unittest.test("method--getIamPolicy", () { 1042 unittest.test("method--getIamPolicy", () {
1048
1049 var mock = new HttpServerMock(); 1043 var mock = new HttpServerMock();
1050 api.ProjectsSubscriptionsResourceApi res = new api.PubsubApi(mock).project s.subscriptions; 1044 api.ProjectsSubscriptionsResourceApi res =
1045 new api.PubsubApi(mock).projects.subscriptions;
1051 var arg_resource = "foo"; 1046 var arg_resource = "foo";
1052 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { 1047 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
1053 var path = (req.url).path; 1048 var path = (req.url).path;
1054 var pathOffset = 0; 1049 var pathOffset = 0;
1055 var index; 1050 var index;
1056 var subPart; 1051 var subPart;
1057 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/")); 1052 unittest.expect(
1053 path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
1058 pathOffset += 1; 1054 pathOffset += 1;
1059 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ als("v1beta2/")); 1055 unittest.expect(path.substring(pathOffset, pathOffset + 8),
1056 unittest.equals("v1beta2/"));
1060 pathOffset += 8; 1057 pathOffset += 8;
1061 // NOTE: We cannot test reserved expansions due to the inability to reve rse the operation; 1058 // NOTE: We cannot test reserved expansions due to the inability to reve rse the operation;
1062 1059
1063 var query = (req.url).query; 1060 var query = (req.url).query;
1064 var queryOffset = 0; 1061 var queryOffset = 0;
1065 var queryMap = {}; 1062 var queryMap = {};
1066 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); 1063 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
1067 parseBool(n) { 1064 parseBool(n) {
1068 if (n == "true") return true; 1065 if (n == "true") return true;
1069 if (n == "false") return false; 1066 if (n == "false") return false;
1070 if (n == null) return null; 1067 if (n == null) return null;
1071 throw new core.ArgumentError("Invalid boolean: $n"); 1068 throw new core.ArgumentError("Invalid boolean: $n");
1072 } 1069 }
1070
1073 if (query.length > 0) { 1071 if (query.length > 0) {
1074 for (var part in query.split("&")) { 1072 for (var part in query.split("&")) {
1075 var keyvalue = part.split("="); 1073 var keyvalue = part.split("=");
1076 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1])); 1074 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]),
1075 core.Uri.decodeQueryComponent(keyvalue[1]));
1077 } 1076 }
1078 } 1077 }
1079 1078
1080
1081 var h = { 1079 var h = {
1082 "content-type" : "application/json; charset=utf-8", 1080 "content-type": "application/json; charset=utf-8",
1083 }; 1081 };
1084 var resp = convert.JSON.encode(buildPolicy()); 1082 var resp = convert.JSON.encode(buildPolicy());
1085 return new async.Future.value(stringResponse(200, h, resp)); 1083 return new async.Future.value(stringResponse(200, h, resp));
1086 }), true); 1084 }), true);
1087 res.getIamPolicy(arg_resource).then(unittest.expectAsync1(((api.Policy res ponse) { 1085 res
1086 .getIamPolicy(arg_resource)
1087 .then(unittest.expectAsync1(((api.Policy response) {
1088 checkPolicy(response); 1088 checkPolicy(response);
1089 }))); 1089 })));
1090 }); 1090 });
1091 1091
1092 unittest.test("method--list", () { 1092 unittest.test("method--list", () {
1093
1094 var mock = new HttpServerMock(); 1093 var mock = new HttpServerMock();
1095 api.ProjectsSubscriptionsResourceApi res = new api.PubsubApi(mock).project s.subscriptions; 1094 api.ProjectsSubscriptionsResourceApi res =
1095 new api.PubsubApi(mock).projects.subscriptions;
1096 var arg_project = "foo"; 1096 var arg_project = "foo";
1097 var arg_pageToken = "foo"; 1097 var arg_pageToken = "foo";
1098 var arg_pageSize = 42; 1098 var arg_pageSize = 42;
1099 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { 1099 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
1100 var path = (req.url).path; 1100 var path = (req.url).path;
1101 var pathOffset = 0; 1101 var pathOffset = 0;
1102 var index; 1102 var index;
1103 var subPart; 1103 var subPart;
1104 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/")); 1104 unittest.expect(
1105 path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
1105 pathOffset += 1; 1106 pathOffset += 1;
1106 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ als("v1beta2/")); 1107 unittest.expect(path.substring(pathOffset, pathOffset + 8),
1108 unittest.equals("v1beta2/"));
1107 pathOffset += 8; 1109 pathOffset += 8;
1108 // NOTE: We cannot test reserved expansions due to the inability to reve rse the operation; 1110 // NOTE: We cannot test reserved expansions due to the inability to reve rse the operation;
1109 1111
1110 var query = (req.url).query; 1112 var query = (req.url).query;
1111 var queryOffset = 0; 1113 var queryOffset = 0;
1112 var queryMap = {}; 1114 var queryMap = {};
1113 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); 1115 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
1114 parseBool(n) { 1116 parseBool(n) {
1115 if (n == "true") return true; 1117 if (n == "true") return true;
1116 if (n == "false") return false; 1118 if (n == "false") return false;
1117 if (n == null) return null; 1119 if (n == null) return null;
1118 throw new core.ArgumentError("Invalid boolean: $n"); 1120 throw new core.ArgumentError("Invalid boolean: $n");
1119 } 1121 }
1122
1120 if (query.length > 0) { 1123 if (query.length > 0) {
1121 for (var part in query.split("&")) { 1124 for (var part in query.split("&")) {
1122 var keyvalue = part.split("="); 1125 var keyvalue = part.split("=");
1123 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1])); 1126 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]),
1127 core.Uri.decodeQueryComponent(keyvalue[1]));
1124 } 1128 }
1125 } 1129 }
1126 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok en)); 1130 unittest.expect(
1127 unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equ als(arg_pageSize)); 1131 queryMap["pageToken"].first, unittest.equals(arg_pageToken));
1128 1132 unittest.expect(core.int.parse(queryMap["pageSize"].first),
1133 unittest.equals(arg_pageSize));
1129 1134
1130 var h = { 1135 var h = {
1131 "content-type" : "application/json; charset=utf-8", 1136 "content-type": "application/json; charset=utf-8",
1132 }; 1137 };
1133 var resp = convert.JSON.encode(buildListSubscriptionsResponse()); 1138 var resp = convert.JSON.encode(buildListSubscriptionsResponse());
1134 return new async.Future.value(stringResponse(200, h, resp)); 1139 return new async.Future.value(stringResponse(200, h, resp));
1135 }), true); 1140 }), true);
1136 res.list(arg_project, pageToken: arg_pageToken, pageSize: arg_pageSize).th en(unittest.expectAsync1(((api.ListSubscriptionsResponse response) { 1141 res
1142 .list(arg_project, pageToken: arg_pageToken, pageSize: arg_pageSize)
1143 .then(
1144 unittest.expectAsync1(((api.ListSubscriptionsResponse response) {
1137 checkListSubscriptionsResponse(response); 1145 checkListSubscriptionsResponse(response);
1138 }))); 1146 })));
1139 }); 1147 });
1140 1148
1141 unittest.test("method--modifyAckDeadline", () { 1149 unittest.test("method--modifyAckDeadline", () {
1142
1143 var mock = new HttpServerMock(); 1150 var mock = new HttpServerMock();
1144 api.ProjectsSubscriptionsResourceApi res = new api.PubsubApi(mock).project s.subscriptions; 1151 api.ProjectsSubscriptionsResourceApi res =
1152 new api.PubsubApi(mock).projects.subscriptions;
1145 var arg_request = buildModifyAckDeadlineRequest(); 1153 var arg_request = buildModifyAckDeadlineRequest();
1146 var arg_subscription = "foo"; 1154 var arg_subscription = "foo";
1147 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { 1155 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
1148 var obj = new api.ModifyAckDeadlineRequest.fromJson(json); 1156 var obj = new api.ModifyAckDeadlineRequest.fromJson(json);
1149 checkModifyAckDeadlineRequest(obj); 1157 checkModifyAckDeadlineRequest(obj);
1150 1158
1151 var path = (req.url).path; 1159 var path = (req.url).path;
1152 var pathOffset = 0; 1160 var pathOffset = 0;
1153 var index; 1161 var index;
1154 var subPart; 1162 var subPart;
1155 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/")); 1163 unittest.expect(
1164 path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
1156 pathOffset += 1; 1165 pathOffset += 1;
1157 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ als("v1beta2/")); 1166 unittest.expect(path.substring(pathOffset, pathOffset + 8),
1167 unittest.equals("v1beta2/"));
1158 pathOffset += 8; 1168 pathOffset += 8;
1159 // NOTE: We cannot test reserved expansions due to the inability to reve rse the operation; 1169 // NOTE: We cannot test reserved expansions due to the inability to reve rse the operation;
1160 1170
1161 var query = (req.url).query; 1171 var query = (req.url).query;
1162 var queryOffset = 0; 1172 var queryOffset = 0;
1163 var queryMap = {}; 1173 var queryMap = {};
1164 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); 1174 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
1165 parseBool(n) { 1175 parseBool(n) {
1166 if (n == "true") return true; 1176 if (n == "true") return true;
1167 if (n == "false") return false; 1177 if (n == "false") return false;
1168 if (n == null) return null; 1178 if (n == null) return null;
1169 throw new core.ArgumentError("Invalid boolean: $n"); 1179 throw new core.ArgumentError("Invalid boolean: $n");
1170 } 1180 }
1181
1171 if (query.length > 0) { 1182 if (query.length > 0) {
1172 for (var part in query.split("&")) { 1183 for (var part in query.split("&")) {
1173 var keyvalue = part.split("="); 1184 var keyvalue = part.split("=");
1174 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1])); 1185 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]),
1186 core.Uri.decodeQueryComponent(keyvalue[1]));
1175 } 1187 }
1176 } 1188 }
1177 1189
1178
1179 var h = { 1190 var h = {
1180 "content-type" : "application/json; charset=utf-8", 1191 "content-type": "application/json; charset=utf-8",
1181 }; 1192 };
1182 var resp = convert.JSON.encode(buildEmpty()); 1193 var resp = convert.JSON.encode(buildEmpty());
1183 return new async.Future.value(stringResponse(200, h, resp)); 1194 return new async.Future.value(stringResponse(200, h, resp));
1184 }), true); 1195 }), true);
1185 res.modifyAckDeadline(arg_request, arg_subscription).then(unittest.expectA sync1(((api.Empty response) { 1196 res
1197 .modifyAckDeadline(arg_request, arg_subscription)
1198 .then(unittest.expectAsync1(((api.Empty response) {
1186 checkEmpty(response); 1199 checkEmpty(response);
1187 }))); 1200 })));
1188 }); 1201 });
1189 1202
1190 unittest.test("method--modifyPushConfig", () { 1203 unittest.test("method--modifyPushConfig", () {
1191
1192 var mock = new HttpServerMock(); 1204 var mock = new HttpServerMock();
1193 api.ProjectsSubscriptionsResourceApi res = new api.PubsubApi(mock).project s.subscriptions; 1205 api.ProjectsSubscriptionsResourceApi res =
1206 new api.PubsubApi(mock).projects.subscriptions;
1194 var arg_request = buildModifyPushConfigRequest(); 1207 var arg_request = buildModifyPushConfigRequest();
1195 var arg_subscription = "foo"; 1208 var arg_subscription = "foo";
1196 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { 1209 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
1197 var obj = new api.ModifyPushConfigRequest.fromJson(json); 1210 var obj = new api.ModifyPushConfigRequest.fromJson(json);
1198 checkModifyPushConfigRequest(obj); 1211 checkModifyPushConfigRequest(obj);
1199 1212
1200 var path = (req.url).path; 1213 var path = (req.url).path;
1201 var pathOffset = 0; 1214 var pathOffset = 0;
1202 var index; 1215 var index;
1203 var subPart; 1216 var subPart;
1204 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/")); 1217 unittest.expect(
1218 path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
1205 pathOffset += 1; 1219 pathOffset += 1;
1206 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ als("v1beta2/")); 1220 unittest.expect(path.substring(pathOffset, pathOffset + 8),
1221 unittest.equals("v1beta2/"));
1207 pathOffset += 8; 1222 pathOffset += 8;
1208 // NOTE: We cannot test reserved expansions due to the inability to reve rse the operation; 1223 // NOTE: We cannot test reserved expansions due to the inability to reve rse the operation;
1209 1224
1210 var query = (req.url).query; 1225 var query = (req.url).query;
1211 var queryOffset = 0; 1226 var queryOffset = 0;
1212 var queryMap = {}; 1227 var queryMap = {};
1213 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); 1228 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
1214 parseBool(n) { 1229 parseBool(n) {
1215 if (n == "true") return true; 1230 if (n == "true") return true;
1216 if (n == "false") return false; 1231 if (n == "false") return false;
1217 if (n == null) return null; 1232 if (n == null) return null;
1218 throw new core.ArgumentError("Invalid boolean: $n"); 1233 throw new core.ArgumentError("Invalid boolean: $n");
1219 } 1234 }
1235
1220 if (query.length > 0) { 1236 if (query.length > 0) {
1221 for (var part in query.split("&")) { 1237 for (var part in query.split("&")) {
1222 var keyvalue = part.split("="); 1238 var keyvalue = part.split("=");
1223 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1])); 1239 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]),
1240 core.Uri.decodeQueryComponent(keyvalue[1]));
1224 } 1241 }
1225 } 1242 }
1226 1243
1227
1228 var h = { 1244 var h = {
1229 "content-type" : "application/json; charset=utf-8", 1245 "content-type": "application/json; charset=utf-8",
1230 }; 1246 };
1231 var resp = convert.JSON.encode(buildEmpty()); 1247 var resp = convert.JSON.encode(buildEmpty());
1232 return new async.Future.value(stringResponse(200, h, resp)); 1248 return new async.Future.value(stringResponse(200, h, resp));
1233 }), true); 1249 }), true);
1234 res.modifyPushConfig(arg_request, arg_subscription).then(unittest.expectAs ync1(((api.Empty response) { 1250 res
1251 .modifyPushConfig(arg_request, arg_subscription)
1252 .then(unittest.expectAsync1(((api.Empty response) {
1235 checkEmpty(response); 1253 checkEmpty(response);
1236 }))); 1254 })));
1237 }); 1255 });
1238 1256
1239 unittest.test("method--pull", () { 1257 unittest.test("method--pull", () {
1240
1241 var mock = new HttpServerMock(); 1258 var mock = new HttpServerMock();
1242 api.ProjectsSubscriptionsResourceApi res = new api.PubsubApi(mock).project s.subscriptions; 1259 api.ProjectsSubscriptionsResourceApi res =
1260 new api.PubsubApi(mock).projects.subscriptions;
1243 var arg_request = buildPullRequest(); 1261 var arg_request = buildPullRequest();
1244 var arg_subscription = "foo"; 1262 var arg_subscription = "foo";
1245 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { 1263 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
1246 var obj = new api.PullRequest.fromJson(json); 1264 var obj = new api.PullRequest.fromJson(json);
1247 checkPullRequest(obj); 1265 checkPullRequest(obj);
1248 1266
1249 var path = (req.url).path; 1267 var path = (req.url).path;
1250 var pathOffset = 0; 1268 var pathOffset = 0;
1251 var index; 1269 var index;
1252 var subPart; 1270 var subPart;
1253 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/")); 1271 unittest.expect(
1272 path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
1254 pathOffset += 1; 1273 pathOffset += 1;
1255 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ als("v1beta2/")); 1274 unittest.expect(path.substring(pathOffset, pathOffset + 8),
1275 unittest.equals("v1beta2/"));
1256 pathOffset += 8; 1276 pathOffset += 8;
1257 // NOTE: We cannot test reserved expansions due to the inability to reve rse the operation; 1277 // NOTE: We cannot test reserved expansions due to the inability to reve rse the operation;
1258 1278
1259 var query = (req.url).query; 1279 var query = (req.url).query;
1260 var queryOffset = 0; 1280 var queryOffset = 0;
1261 var queryMap = {}; 1281 var queryMap = {};
1262 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); 1282 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
1263 parseBool(n) { 1283 parseBool(n) {
1264 if (n == "true") return true; 1284 if (n == "true") return true;
1265 if (n == "false") return false; 1285 if (n == "false") return false;
1266 if (n == null) return null; 1286 if (n == null) return null;
1267 throw new core.ArgumentError("Invalid boolean: $n"); 1287 throw new core.ArgumentError("Invalid boolean: $n");
1268 } 1288 }
1289
1269 if (query.length > 0) { 1290 if (query.length > 0) {
1270 for (var part in query.split("&")) { 1291 for (var part in query.split("&")) {
1271 var keyvalue = part.split("="); 1292 var keyvalue = part.split("=");
1272 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1])); 1293 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]),
1294 core.Uri.decodeQueryComponent(keyvalue[1]));
1273 } 1295 }
1274 } 1296 }
1275 1297
1276
1277 var h = { 1298 var h = {
1278 "content-type" : "application/json; charset=utf-8", 1299 "content-type": "application/json; charset=utf-8",
1279 }; 1300 };
1280 var resp = convert.JSON.encode(buildPullResponse()); 1301 var resp = convert.JSON.encode(buildPullResponse());
1281 return new async.Future.value(stringResponse(200, h, resp)); 1302 return new async.Future.value(stringResponse(200, h, resp));
1282 }), true); 1303 }), true);
1283 res.pull(arg_request, arg_subscription).then(unittest.expectAsync1(((api.P ullResponse response) { 1304 res
1305 .pull(arg_request, arg_subscription)
1306 .then(unittest.expectAsync1(((api.PullResponse response) {
1284 checkPullResponse(response); 1307 checkPullResponse(response);
1285 }))); 1308 })));
1286 }); 1309 });
1287 1310
1288 unittest.test("method--setIamPolicy", () { 1311 unittest.test("method--setIamPolicy", () {
1289
1290 var mock = new HttpServerMock(); 1312 var mock = new HttpServerMock();
1291 api.ProjectsSubscriptionsResourceApi res = new api.PubsubApi(mock).project s.subscriptions; 1313 api.ProjectsSubscriptionsResourceApi res =
1314 new api.PubsubApi(mock).projects.subscriptions;
1292 var arg_request = buildSetIamPolicyRequest(); 1315 var arg_request = buildSetIamPolicyRequest();
1293 var arg_resource = "foo"; 1316 var arg_resource = "foo";
1294 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { 1317 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
1295 var obj = new api.SetIamPolicyRequest.fromJson(json); 1318 var obj = new api.SetIamPolicyRequest.fromJson(json);
1296 checkSetIamPolicyRequest(obj); 1319 checkSetIamPolicyRequest(obj);
1297 1320
1298 var path = (req.url).path; 1321 var path = (req.url).path;
1299 var pathOffset = 0; 1322 var pathOffset = 0;
1300 var index; 1323 var index;
1301 var subPart; 1324 var subPart;
1302 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/")); 1325 unittest.expect(
1326 path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
1303 pathOffset += 1; 1327 pathOffset += 1;
1304 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ als("v1beta2/")); 1328 unittest.expect(path.substring(pathOffset, pathOffset + 8),
1329 unittest.equals("v1beta2/"));
1305 pathOffset += 8; 1330 pathOffset += 8;
1306 // NOTE: We cannot test reserved expansions due to the inability to reve rse the operation; 1331 // NOTE: We cannot test reserved expansions due to the inability to reve rse the operation;
1307 1332
1308 var query = (req.url).query; 1333 var query = (req.url).query;
1309 var queryOffset = 0; 1334 var queryOffset = 0;
1310 var queryMap = {}; 1335 var queryMap = {};
1311 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); 1336 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
1312 parseBool(n) { 1337 parseBool(n) {
1313 if (n == "true") return true; 1338 if (n == "true") return true;
1314 if (n == "false") return false; 1339 if (n == "false") return false;
1315 if (n == null) return null; 1340 if (n == null) return null;
1316 throw new core.ArgumentError("Invalid boolean: $n"); 1341 throw new core.ArgumentError("Invalid boolean: $n");
1317 } 1342 }
1343
1318 if (query.length > 0) { 1344 if (query.length > 0) {
1319 for (var part in query.split("&")) { 1345 for (var part in query.split("&")) {
1320 var keyvalue = part.split("="); 1346 var keyvalue = part.split("=");
1321 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1])); 1347 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]),
1348 core.Uri.decodeQueryComponent(keyvalue[1]));
1322 } 1349 }
1323 } 1350 }
1324 1351
1325
1326 var h = { 1352 var h = {
1327 "content-type" : "application/json; charset=utf-8", 1353 "content-type": "application/json; charset=utf-8",
1328 }; 1354 };
1329 var resp = convert.JSON.encode(buildPolicy()); 1355 var resp = convert.JSON.encode(buildPolicy());
1330 return new async.Future.value(stringResponse(200, h, resp)); 1356 return new async.Future.value(stringResponse(200, h, resp));
1331 }), true); 1357 }), true);
1332 res.setIamPolicy(arg_request, arg_resource).then(unittest.expectAsync1(((a pi.Policy response) { 1358 res
1359 .setIamPolicy(arg_request, arg_resource)
1360 .then(unittest.expectAsync1(((api.Policy response) {
1333 checkPolicy(response); 1361 checkPolicy(response);
1334 }))); 1362 })));
1335 }); 1363 });
1336 1364
1337 unittest.test("method--testIamPermissions", () { 1365 unittest.test("method--testIamPermissions", () {
1338
1339 var mock = new HttpServerMock(); 1366 var mock = new HttpServerMock();
1340 api.ProjectsSubscriptionsResourceApi res = new api.PubsubApi(mock).project s.subscriptions; 1367 api.ProjectsSubscriptionsResourceApi res =
1368 new api.PubsubApi(mock).projects.subscriptions;
1341 var arg_request = buildTestIamPermissionsRequest(); 1369 var arg_request = buildTestIamPermissionsRequest();
1342 var arg_resource = "foo"; 1370 var arg_resource = "foo";
1343 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { 1371 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
1344 var obj = new api.TestIamPermissionsRequest.fromJson(json); 1372 var obj = new api.TestIamPermissionsRequest.fromJson(json);
1345 checkTestIamPermissionsRequest(obj); 1373 checkTestIamPermissionsRequest(obj);
1346 1374
1347 var path = (req.url).path; 1375 var path = (req.url).path;
1348 var pathOffset = 0; 1376 var pathOffset = 0;
1349 var index; 1377 var index;
1350 var subPart; 1378 var subPart;
1351 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/")); 1379 unittest.expect(
1380 path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
1352 pathOffset += 1; 1381 pathOffset += 1;
1353 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ als("v1beta2/")); 1382 unittest.expect(path.substring(pathOffset, pathOffset + 8),
1383 unittest.equals("v1beta2/"));
1354 pathOffset += 8; 1384 pathOffset += 8;
1355 // NOTE: We cannot test reserved expansions due to the inability to reve rse the operation; 1385 // NOTE: We cannot test reserved expansions due to the inability to reve rse the operation;
1356 1386
1357 var query = (req.url).query; 1387 var query = (req.url).query;
1358 var queryOffset = 0; 1388 var queryOffset = 0;
1359 var queryMap = {}; 1389 var queryMap = {};
1360 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); 1390 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
1361 parseBool(n) { 1391 parseBool(n) {
1362 if (n == "true") return true; 1392 if (n == "true") return true;
1363 if (n == "false") return false; 1393 if (n == "false") return false;
1364 if (n == null) return null; 1394 if (n == null) return null;
1365 throw new core.ArgumentError("Invalid boolean: $n"); 1395 throw new core.ArgumentError("Invalid boolean: $n");
1366 } 1396 }
1397
1367 if (query.length > 0) { 1398 if (query.length > 0) {
1368 for (var part in query.split("&")) { 1399 for (var part in query.split("&")) {
1369 var keyvalue = part.split("="); 1400 var keyvalue = part.split("=");
1370 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1])); 1401 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]),
1402 core.Uri.decodeQueryComponent(keyvalue[1]));
1371 } 1403 }
1372 } 1404 }
1373 1405
1374
1375 var h = { 1406 var h = {
1376 "content-type" : "application/json; charset=utf-8", 1407 "content-type": "application/json; charset=utf-8",
1377 }; 1408 };
1378 var resp = convert.JSON.encode(buildTestIamPermissionsResponse()); 1409 var resp = convert.JSON.encode(buildTestIamPermissionsResponse());
1379 return new async.Future.value(stringResponse(200, h, resp)); 1410 return new async.Future.value(stringResponse(200, h, resp));
1380 }), true); 1411 }), true);
1381 res.testIamPermissions(arg_request, arg_resource).then(unittest.expectAsyn c1(((api.TestIamPermissionsResponse response) { 1412 res.testIamPermissions(arg_request, arg_resource).then(
1413 unittest.expectAsync1(((api.TestIamPermissionsResponse response) {
1382 checkTestIamPermissionsResponse(response); 1414 checkTestIamPermissionsResponse(response);
1383 }))); 1415 })));
1384 }); 1416 });
1385
1386 }); 1417 });
1387 1418
1388
1389 unittest.group("resource-ProjectsTopicsResourceApi", () { 1419 unittest.group("resource-ProjectsTopicsResourceApi", () {
1390 unittest.test("method--create", () { 1420 unittest.test("method--create", () {
1391
1392 var mock = new HttpServerMock(); 1421 var mock = new HttpServerMock();
1393 api.ProjectsTopicsResourceApi res = new api.PubsubApi(mock).projects.topic s; 1422 api.ProjectsTopicsResourceApi res =
1423 new api.PubsubApi(mock).projects.topics;
1394 var arg_request = buildTopic(); 1424 var arg_request = buildTopic();
1395 var arg_name = "foo"; 1425 var arg_name = "foo";
1396 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { 1426 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
1397 var obj = new api.Topic.fromJson(json); 1427 var obj = new api.Topic.fromJson(json);
1398 checkTopic(obj); 1428 checkTopic(obj);
1399 1429
1400 var path = (req.url).path; 1430 var path = (req.url).path;
1401 var pathOffset = 0; 1431 var pathOffset = 0;
1402 var index; 1432 var index;
1403 var subPart; 1433 var subPart;
1404 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/")); 1434 unittest.expect(
1435 path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
1405 pathOffset += 1; 1436 pathOffset += 1;
1406 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ als("v1beta2/")); 1437 unittest.expect(path.substring(pathOffset, pathOffset + 8),
1438 unittest.equals("v1beta2/"));
1407 pathOffset += 8; 1439 pathOffset += 8;
1408 // NOTE: We cannot test reserved expansions due to the inability to reve rse the operation; 1440 // NOTE: We cannot test reserved expansions due to the inability to reve rse the operation;
1409 1441
1410 var query = (req.url).query; 1442 var query = (req.url).query;
1411 var queryOffset = 0; 1443 var queryOffset = 0;
1412 var queryMap = {}; 1444 var queryMap = {};
1413 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); 1445 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
1414 parseBool(n) { 1446 parseBool(n) {
1415 if (n == "true") return true; 1447 if (n == "true") return true;
1416 if (n == "false") return false; 1448 if (n == "false") return false;
1417 if (n == null) return null; 1449 if (n == null) return null;
1418 throw new core.ArgumentError("Invalid boolean: $n"); 1450 throw new core.ArgumentError("Invalid boolean: $n");
1419 } 1451 }
1452
1420 if (query.length > 0) { 1453 if (query.length > 0) {
1421 for (var part in query.split("&")) { 1454 for (var part in query.split("&")) {
1422 var keyvalue = part.split("="); 1455 var keyvalue = part.split("=");
1423 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1])); 1456 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]),
1457 core.Uri.decodeQueryComponent(keyvalue[1]));
1424 } 1458 }
1425 } 1459 }
1426 1460
1427
1428 var h = { 1461 var h = {
1429 "content-type" : "application/json; charset=utf-8", 1462 "content-type": "application/json; charset=utf-8",
1430 }; 1463 };
1431 var resp = convert.JSON.encode(buildTopic()); 1464 var resp = convert.JSON.encode(buildTopic());
1432 return new async.Future.value(stringResponse(200, h, resp)); 1465 return new async.Future.value(stringResponse(200, h, resp));
1433 }), true); 1466 }), true);
1434 res.create(arg_request, arg_name).then(unittest.expectAsync1(((api.Topic r esponse) { 1467 res
1468 .create(arg_request, arg_name)
1469 .then(unittest.expectAsync1(((api.Topic response) {
1435 checkTopic(response); 1470 checkTopic(response);
1436 }))); 1471 })));
1437 }); 1472 });
1438 1473
1439 unittest.test("method--delete", () { 1474 unittest.test("method--delete", () {
1440
1441 var mock = new HttpServerMock(); 1475 var mock = new HttpServerMock();
1442 api.ProjectsTopicsResourceApi res = new api.PubsubApi(mock).projects.topic s; 1476 api.ProjectsTopicsResourceApi res =
1477 new api.PubsubApi(mock).projects.topics;
1443 var arg_topic = "foo"; 1478 var arg_topic = "foo";
1444 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { 1479 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
1445 var path = (req.url).path; 1480 var path = (req.url).path;
1446 var pathOffset = 0; 1481 var pathOffset = 0;
1447 var index; 1482 var index;
1448 var subPart; 1483 var subPart;
1449 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/")); 1484 unittest.expect(
1485 path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
1450 pathOffset += 1; 1486 pathOffset += 1;
1451 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ als("v1beta2/")); 1487 unittest.expect(path.substring(pathOffset, pathOffset + 8),
1488 unittest.equals("v1beta2/"));
1452 pathOffset += 8; 1489 pathOffset += 8;
1453 // NOTE: We cannot test reserved expansions due to the inability to reve rse the operation; 1490 // NOTE: We cannot test reserved expansions due to the inability to reve rse the operation;
1454 1491
1455 var query = (req.url).query; 1492 var query = (req.url).query;
1456 var queryOffset = 0; 1493 var queryOffset = 0;
1457 var queryMap = {}; 1494 var queryMap = {};
1458 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); 1495 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
1459 parseBool(n) { 1496 parseBool(n) {
1460 if (n == "true") return true; 1497 if (n == "true") return true;
1461 if (n == "false") return false; 1498 if (n == "false") return false;
1462 if (n == null) return null; 1499 if (n == null) return null;
1463 throw new core.ArgumentError("Invalid boolean: $n"); 1500 throw new core.ArgumentError("Invalid boolean: $n");
1464 } 1501 }
1502
1465 if (query.length > 0) { 1503 if (query.length > 0) {
1466 for (var part in query.split("&")) { 1504 for (var part in query.split("&")) {
1467 var keyvalue = part.split("="); 1505 var keyvalue = part.split("=");
1468 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1])); 1506 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]),
1507 core.Uri.decodeQueryComponent(keyvalue[1]));
1469 } 1508 }
1470 } 1509 }
1471 1510
1472
1473 var h = { 1511 var h = {
1474 "content-type" : "application/json; charset=utf-8", 1512 "content-type": "application/json; charset=utf-8",
1475 }; 1513 };
1476 var resp = convert.JSON.encode(buildEmpty()); 1514 var resp = convert.JSON.encode(buildEmpty());
1477 return new async.Future.value(stringResponse(200, h, resp)); 1515 return new async.Future.value(stringResponse(200, h, resp));
1478 }), true); 1516 }), true);
1479 res.delete(arg_topic).then(unittest.expectAsync1(((api.Empty response) { 1517 res.delete(arg_topic).then(unittest.expectAsync1(((api.Empty response) {
1480 checkEmpty(response); 1518 checkEmpty(response);
1481 }))); 1519 })));
1482 }); 1520 });
1483 1521
1484 unittest.test("method--get", () { 1522 unittest.test("method--get", () {
1485
1486 var mock = new HttpServerMock(); 1523 var mock = new HttpServerMock();
1487 api.ProjectsTopicsResourceApi res = new api.PubsubApi(mock).projects.topic s; 1524 api.ProjectsTopicsResourceApi res =
1525 new api.PubsubApi(mock).projects.topics;
1488 var arg_topic = "foo"; 1526 var arg_topic = "foo";
1489 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { 1527 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
1490 var path = (req.url).path; 1528 var path = (req.url).path;
1491 var pathOffset = 0; 1529 var pathOffset = 0;
1492 var index; 1530 var index;
1493 var subPart; 1531 var subPart;
1494 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/")); 1532 unittest.expect(
1533 path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
1495 pathOffset += 1; 1534 pathOffset += 1;
1496 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ als("v1beta2/")); 1535 unittest.expect(path.substring(pathOffset, pathOffset + 8),
1536 unittest.equals("v1beta2/"));
1497 pathOffset += 8; 1537 pathOffset += 8;
1498 // NOTE: We cannot test reserved expansions due to the inability to reve rse the operation; 1538 // NOTE: We cannot test reserved expansions due to the inability to reve rse the operation;
1499 1539
1500 var query = (req.url).query; 1540 var query = (req.url).query;
1501 var queryOffset = 0; 1541 var queryOffset = 0;
1502 var queryMap = {}; 1542 var queryMap = {};
1503 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); 1543 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
1504 parseBool(n) { 1544 parseBool(n) {
1505 if (n == "true") return true; 1545 if (n == "true") return true;
1506 if (n == "false") return false; 1546 if (n == "false") return false;
1507 if (n == null) return null; 1547 if (n == null) return null;
1508 throw new core.ArgumentError("Invalid boolean: $n"); 1548 throw new core.ArgumentError("Invalid boolean: $n");
1509 } 1549 }
1550
1510 if (query.length > 0) { 1551 if (query.length > 0) {
1511 for (var part in query.split("&")) { 1552 for (var part in query.split("&")) {
1512 var keyvalue = part.split("="); 1553 var keyvalue = part.split("=");
1513 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1])); 1554 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]),
1555 core.Uri.decodeQueryComponent(keyvalue[1]));
1514 } 1556 }
1515 } 1557 }
1516 1558
1517
1518 var h = { 1559 var h = {
1519 "content-type" : "application/json; charset=utf-8", 1560 "content-type": "application/json; charset=utf-8",
1520 }; 1561 };
1521 var resp = convert.JSON.encode(buildTopic()); 1562 var resp = convert.JSON.encode(buildTopic());
1522 return new async.Future.value(stringResponse(200, h, resp)); 1563 return new async.Future.value(stringResponse(200, h, resp));
1523 }), true); 1564 }), true);
1524 res.get(arg_topic).then(unittest.expectAsync1(((api.Topic response) { 1565 res.get(arg_topic).then(unittest.expectAsync1(((api.Topic response) {
1525 checkTopic(response); 1566 checkTopic(response);
1526 }))); 1567 })));
1527 }); 1568 });
1528 1569
1529 unittest.test("method--getIamPolicy", () { 1570 unittest.test("method--getIamPolicy", () {
1530
1531 var mock = new HttpServerMock(); 1571 var mock = new HttpServerMock();
1532 api.ProjectsTopicsResourceApi res = new api.PubsubApi(mock).projects.topic s; 1572 api.ProjectsTopicsResourceApi res =
1573 new api.PubsubApi(mock).projects.topics;
1533 var arg_resource = "foo"; 1574 var arg_resource = "foo";
1534 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { 1575 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
1535 var path = (req.url).path; 1576 var path = (req.url).path;
1536 var pathOffset = 0; 1577 var pathOffset = 0;
1537 var index; 1578 var index;
1538 var subPart; 1579 var subPart;
1539 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/")); 1580 unittest.expect(
1581 path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
1540 pathOffset += 1; 1582 pathOffset += 1;
1541 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ als("v1beta2/")); 1583 unittest.expect(path.substring(pathOffset, pathOffset + 8),
1584 unittest.equals("v1beta2/"));
1542 pathOffset += 8; 1585 pathOffset += 8;
1543 // NOTE: We cannot test reserved expansions due to the inability to reve rse the operation; 1586 // NOTE: We cannot test reserved expansions due to the inability to reve rse the operation;
1544 1587
1545 var query = (req.url).query; 1588 var query = (req.url).query;
1546 var queryOffset = 0; 1589 var queryOffset = 0;
1547 var queryMap = {}; 1590 var queryMap = {};
1548 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); 1591 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
1549 parseBool(n) { 1592 parseBool(n) {
1550 if (n == "true") return true; 1593 if (n == "true") return true;
1551 if (n == "false") return false; 1594 if (n == "false") return false;
1552 if (n == null) return null; 1595 if (n == null) return null;
1553 throw new core.ArgumentError("Invalid boolean: $n"); 1596 throw new core.ArgumentError("Invalid boolean: $n");
1554 } 1597 }
1598
1555 if (query.length > 0) { 1599 if (query.length > 0) {
1556 for (var part in query.split("&")) { 1600 for (var part in query.split("&")) {
1557 var keyvalue = part.split("="); 1601 var keyvalue = part.split("=");
1558 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1])); 1602 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]),
1603 core.Uri.decodeQueryComponent(keyvalue[1]));
1559 } 1604 }
1560 } 1605 }
1561 1606
1562
1563 var h = { 1607 var h = {
1564 "content-type" : "application/json; charset=utf-8", 1608 "content-type": "application/json; charset=utf-8",
1565 }; 1609 };
1566 var resp = convert.JSON.encode(buildPolicy()); 1610 var resp = convert.JSON.encode(buildPolicy());
1567 return new async.Future.value(stringResponse(200, h, resp)); 1611 return new async.Future.value(stringResponse(200, h, resp));
1568 }), true); 1612 }), true);
1569 res.getIamPolicy(arg_resource).then(unittest.expectAsync1(((api.Policy res ponse) { 1613 res
1614 .getIamPolicy(arg_resource)
1615 .then(unittest.expectAsync1(((api.Policy response) {
1570 checkPolicy(response); 1616 checkPolicy(response);
1571 }))); 1617 })));
1572 }); 1618 });
1573 1619
1574 unittest.test("method--list", () { 1620 unittest.test("method--list", () {
1575
1576 var mock = new HttpServerMock(); 1621 var mock = new HttpServerMock();
1577 api.ProjectsTopicsResourceApi res = new api.PubsubApi(mock).projects.topic s; 1622 api.ProjectsTopicsResourceApi res =
1623 new api.PubsubApi(mock).projects.topics;
1578 var arg_project = "foo"; 1624 var arg_project = "foo";
1579 var arg_pageToken = "foo"; 1625 var arg_pageToken = "foo";
1580 var arg_pageSize = 42; 1626 var arg_pageSize = 42;
1581 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { 1627 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
1582 var path = (req.url).path; 1628 var path = (req.url).path;
1583 var pathOffset = 0; 1629 var pathOffset = 0;
1584 var index; 1630 var index;
1585 var subPart; 1631 var subPart;
1586 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/")); 1632 unittest.expect(
1633 path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
1587 pathOffset += 1; 1634 pathOffset += 1;
1588 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ als("v1beta2/")); 1635 unittest.expect(path.substring(pathOffset, pathOffset + 8),
1636 unittest.equals("v1beta2/"));
1589 pathOffset += 8; 1637 pathOffset += 8;
1590 // NOTE: We cannot test reserved expansions due to the inability to reve rse the operation; 1638 // NOTE: We cannot test reserved expansions due to the inability to reve rse the operation;
1591 1639
1592 var query = (req.url).query; 1640 var query = (req.url).query;
1593 var queryOffset = 0; 1641 var queryOffset = 0;
1594 var queryMap = {}; 1642 var queryMap = {};
1595 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); 1643 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
1596 parseBool(n) { 1644 parseBool(n) {
1597 if (n == "true") return true; 1645 if (n == "true") return true;
1598 if (n == "false") return false; 1646 if (n == "false") return false;
1599 if (n == null) return null; 1647 if (n == null) return null;
1600 throw new core.ArgumentError("Invalid boolean: $n"); 1648 throw new core.ArgumentError("Invalid boolean: $n");
1601 } 1649 }
1650
1602 if (query.length > 0) { 1651 if (query.length > 0) {
1603 for (var part in query.split("&")) { 1652 for (var part in query.split("&")) {
1604 var keyvalue = part.split("="); 1653 var keyvalue = part.split("=");
1605 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1])); 1654 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]),
1655 core.Uri.decodeQueryComponent(keyvalue[1]));
1606 } 1656 }
1607 } 1657 }
1608 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok en)); 1658 unittest.expect(
1609 unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equ als(arg_pageSize)); 1659 queryMap["pageToken"].first, unittest.equals(arg_pageToken));
1610 1660 unittest.expect(core.int.parse(queryMap["pageSize"].first),
1661 unittest.equals(arg_pageSize));
1611 1662
1612 var h = { 1663 var h = {
1613 "content-type" : "application/json; charset=utf-8", 1664 "content-type": "application/json; charset=utf-8",
1614 }; 1665 };
1615 var resp = convert.JSON.encode(buildListTopicsResponse()); 1666 var resp = convert.JSON.encode(buildListTopicsResponse());
1616 return new async.Future.value(stringResponse(200, h, resp)); 1667 return new async.Future.value(stringResponse(200, h, resp));
1617 }), true); 1668 }), true);
1618 res.list(arg_project, pageToken: arg_pageToken, pageSize: arg_pageSize).th en(unittest.expectAsync1(((api.ListTopicsResponse response) { 1669 res
1670 .list(arg_project, pageToken: arg_pageToken, pageSize: arg_pageSize)
1671 .then(unittest.expectAsync1(((api.ListTopicsResponse response) {
1619 checkListTopicsResponse(response); 1672 checkListTopicsResponse(response);
1620 }))); 1673 })));
1621 }); 1674 });
1622 1675
1623 unittest.test("method--publish", () { 1676 unittest.test("method--publish", () {
1624
1625 var mock = new HttpServerMock(); 1677 var mock = new HttpServerMock();
1626 api.ProjectsTopicsResourceApi res = new api.PubsubApi(mock).projects.topic s; 1678 api.ProjectsTopicsResourceApi res =
1679 new api.PubsubApi(mock).projects.topics;
1627 var arg_request = buildPublishRequest(); 1680 var arg_request = buildPublishRequest();
1628 var arg_topic = "foo"; 1681 var arg_topic = "foo";
1629 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { 1682 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
1630 var obj = new api.PublishRequest.fromJson(json); 1683 var obj = new api.PublishRequest.fromJson(json);
1631 checkPublishRequest(obj); 1684 checkPublishRequest(obj);
1632 1685
1633 var path = (req.url).path; 1686 var path = (req.url).path;
1634 var pathOffset = 0; 1687 var pathOffset = 0;
1635 var index; 1688 var index;
1636 var subPart; 1689 var subPart;
1637 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/")); 1690 unittest.expect(
1691 path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
1638 pathOffset += 1; 1692 pathOffset += 1;
1639 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ als("v1beta2/")); 1693 unittest.expect(path.substring(pathOffset, pathOffset + 8),
1694 unittest.equals("v1beta2/"));
1640 pathOffset += 8; 1695 pathOffset += 8;
1641 // NOTE: We cannot test reserved expansions due to the inability to reve rse the operation; 1696 // NOTE: We cannot test reserved expansions due to the inability to reve rse the operation;
1642 1697
1643 var query = (req.url).query; 1698 var query = (req.url).query;
1644 var queryOffset = 0; 1699 var queryOffset = 0;
1645 var queryMap = {}; 1700 var queryMap = {};
1646 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); 1701 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
1647 parseBool(n) { 1702 parseBool(n) {
1648 if (n == "true") return true; 1703 if (n == "true") return true;
1649 if (n == "false") return false; 1704 if (n == "false") return false;
1650 if (n == null) return null; 1705 if (n == null) return null;
1651 throw new core.ArgumentError("Invalid boolean: $n"); 1706 throw new core.ArgumentError("Invalid boolean: $n");
1652 } 1707 }
1708
1653 if (query.length > 0) { 1709 if (query.length > 0) {
1654 for (var part in query.split("&")) { 1710 for (var part in query.split("&")) {
1655 var keyvalue = part.split("="); 1711 var keyvalue = part.split("=");
1656 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1])); 1712 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]),
1713 core.Uri.decodeQueryComponent(keyvalue[1]));
1657 } 1714 }
1658 } 1715 }
1659 1716
1660
1661 var h = { 1717 var h = {
1662 "content-type" : "application/json; charset=utf-8", 1718 "content-type": "application/json; charset=utf-8",
1663 }; 1719 };
1664 var resp = convert.JSON.encode(buildPublishResponse()); 1720 var resp = convert.JSON.encode(buildPublishResponse());
1665 return new async.Future.value(stringResponse(200, h, resp)); 1721 return new async.Future.value(stringResponse(200, h, resp));
1666 }), true); 1722 }), true);
1667 res.publish(arg_request, arg_topic).then(unittest.expectAsync1(((api.Publi shResponse response) { 1723 res
1724 .publish(arg_request, arg_topic)
1725 .then(unittest.expectAsync1(((api.PublishResponse response) {
1668 checkPublishResponse(response); 1726 checkPublishResponse(response);
1669 }))); 1727 })));
1670 }); 1728 });
1671 1729
1672 unittest.test("method--setIamPolicy", () { 1730 unittest.test("method--setIamPolicy", () {
1673
1674 var mock = new HttpServerMock(); 1731 var mock = new HttpServerMock();
1675 api.ProjectsTopicsResourceApi res = new api.PubsubApi(mock).projects.topic s; 1732 api.ProjectsTopicsResourceApi res =
1733 new api.PubsubApi(mock).projects.topics;
1676 var arg_request = buildSetIamPolicyRequest(); 1734 var arg_request = buildSetIamPolicyRequest();
1677 var arg_resource = "foo"; 1735 var arg_resource = "foo";
1678 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { 1736 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
1679 var obj = new api.SetIamPolicyRequest.fromJson(json); 1737 var obj = new api.SetIamPolicyRequest.fromJson(json);
1680 checkSetIamPolicyRequest(obj); 1738 checkSetIamPolicyRequest(obj);
1681 1739
1682 var path = (req.url).path; 1740 var path = (req.url).path;
1683 var pathOffset = 0; 1741 var pathOffset = 0;
1684 var index; 1742 var index;
1685 var subPart; 1743 var subPart;
1686 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/")); 1744 unittest.expect(
1745 path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
1687 pathOffset += 1; 1746 pathOffset += 1;
1688 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ als("v1beta2/")); 1747 unittest.expect(path.substring(pathOffset, pathOffset + 8),
1748 unittest.equals("v1beta2/"));
1689 pathOffset += 8; 1749 pathOffset += 8;
1690 // NOTE: We cannot test reserved expansions due to the inability to reve rse the operation; 1750 // NOTE: We cannot test reserved expansions due to the inability to reve rse the operation;
1691 1751
1692 var query = (req.url).query; 1752 var query = (req.url).query;
1693 var queryOffset = 0; 1753 var queryOffset = 0;
1694 var queryMap = {}; 1754 var queryMap = {};
1695 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); 1755 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
1696 parseBool(n) { 1756 parseBool(n) {
1697 if (n == "true") return true; 1757 if (n == "true") return true;
1698 if (n == "false") return false; 1758 if (n == "false") return false;
1699 if (n == null) return null; 1759 if (n == null) return null;
1700 throw new core.ArgumentError("Invalid boolean: $n"); 1760 throw new core.ArgumentError("Invalid boolean: $n");
1701 } 1761 }
1762
1702 if (query.length > 0) { 1763 if (query.length > 0) {
1703 for (var part in query.split("&")) { 1764 for (var part in query.split("&")) {
1704 var keyvalue = part.split("="); 1765 var keyvalue = part.split("=");
1705 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1])); 1766 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]),
1767 core.Uri.decodeQueryComponent(keyvalue[1]));
1706 } 1768 }
1707 } 1769 }
1708 1770
1709
1710 var h = { 1771 var h = {
1711 "content-type" : "application/json; charset=utf-8", 1772 "content-type": "application/json; charset=utf-8",
1712 }; 1773 };
1713 var resp = convert.JSON.encode(buildPolicy()); 1774 var resp = convert.JSON.encode(buildPolicy());
1714 return new async.Future.value(stringResponse(200, h, resp)); 1775 return new async.Future.value(stringResponse(200, h, resp));
1715 }), true); 1776 }), true);
1716 res.setIamPolicy(arg_request, arg_resource).then(unittest.expectAsync1(((a pi.Policy response) { 1777 res
1778 .setIamPolicy(arg_request, arg_resource)
1779 .then(unittest.expectAsync1(((api.Policy response) {
1717 checkPolicy(response); 1780 checkPolicy(response);
1718 }))); 1781 })));
1719 }); 1782 });
1720 1783
1721 unittest.test("method--testIamPermissions", () { 1784 unittest.test("method--testIamPermissions", () {
1722
1723 var mock = new HttpServerMock(); 1785 var mock = new HttpServerMock();
1724 api.ProjectsTopicsResourceApi res = new api.PubsubApi(mock).projects.topic s; 1786 api.ProjectsTopicsResourceApi res =
1787 new api.PubsubApi(mock).projects.topics;
1725 var arg_request = buildTestIamPermissionsRequest(); 1788 var arg_request = buildTestIamPermissionsRequest();
1726 var arg_resource = "foo"; 1789 var arg_resource = "foo";
1727 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { 1790 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
1728 var obj = new api.TestIamPermissionsRequest.fromJson(json); 1791 var obj = new api.TestIamPermissionsRequest.fromJson(json);
1729 checkTestIamPermissionsRequest(obj); 1792 checkTestIamPermissionsRequest(obj);
1730 1793
1731 var path = (req.url).path; 1794 var path = (req.url).path;
1732 var pathOffset = 0; 1795 var pathOffset = 0;
1733 var index; 1796 var index;
1734 var subPart; 1797 var subPart;
1735 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/")); 1798 unittest.expect(
1799 path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
1736 pathOffset += 1; 1800 pathOffset += 1;
1737 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ als("v1beta2/")); 1801 unittest.expect(path.substring(pathOffset, pathOffset + 8),
1802 unittest.equals("v1beta2/"));
1738 pathOffset += 8; 1803 pathOffset += 8;
1739 // NOTE: We cannot test reserved expansions due to the inability to reve rse the operation; 1804 // NOTE: We cannot test reserved expansions due to the inability to reve rse the operation;
1740 1805
1741 var query = (req.url).query; 1806 var query = (req.url).query;
1742 var queryOffset = 0; 1807 var queryOffset = 0;
1743 var queryMap = {}; 1808 var queryMap = {};
1744 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); 1809 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
1745 parseBool(n) { 1810 parseBool(n) {
1746 if (n == "true") return true; 1811 if (n == "true") return true;
1747 if (n == "false") return false; 1812 if (n == "false") return false;
1748 if (n == null) return null; 1813 if (n == null) return null;
1749 throw new core.ArgumentError("Invalid boolean: $n"); 1814 throw new core.ArgumentError("Invalid boolean: $n");
1750 } 1815 }
1816
1751 if (query.length > 0) { 1817 if (query.length > 0) {
1752 for (var part in query.split("&")) { 1818 for (var part in query.split("&")) {
1753 var keyvalue = part.split("="); 1819 var keyvalue = part.split("=");
1754 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1])); 1820 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]),
1821 core.Uri.decodeQueryComponent(keyvalue[1]));
1755 } 1822 }
1756 } 1823 }
1757 1824
1758
1759 var h = { 1825 var h = {
1760 "content-type" : "application/json; charset=utf-8", 1826 "content-type": "application/json; charset=utf-8",
1761 }; 1827 };
1762 var resp = convert.JSON.encode(buildTestIamPermissionsResponse()); 1828 var resp = convert.JSON.encode(buildTestIamPermissionsResponse());
1763 return new async.Future.value(stringResponse(200, h, resp)); 1829 return new async.Future.value(stringResponse(200, h, resp));
1764 }), true); 1830 }), true);
1765 res.testIamPermissions(arg_request, arg_resource).then(unittest.expectAsyn c1(((api.TestIamPermissionsResponse response) { 1831 res.testIamPermissions(arg_request, arg_resource).then(
1832 unittest.expectAsync1(((api.TestIamPermissionsResponse response) {
1766 checkTestIamPermissionsResponse(response); 1833 checkTestIamPermissionsResponse(response);
1767 }))); 1834 })));
1768 }); 1835 });
1769
1770 }); 1836 });
1771 1837
1772
1773 unittest.group("resource-ProjectsTopicsSubscriptionsResourceApi", () { 1838 unittest.group("resource-ProjectsTopicsSubscriptionsResourceApi", () {
1774 unittest.test("method--list", () { 1839 unittest.test("method--list", () {
1775
1776 var mock = new HttpServerMock(); 1840 var mock = new HttpServerMock();
1777 api.ProjectsTopicsSubscriptionsResourceApi res = new api.PubsubApi(mock).p rojects.topics.subscriptions; 1841 api.ProjectsTopicsSubscriptionsResourceApi res =
1842 new api.PubsubApi(mock).projects.topics.subscriptions;
1778 var arg_topic = "foo"; 1843 var arg_topic = "foo";
1779 var arg_pageToken = "foo"; 1844 var arg_pageToken = "foo";
1780 var arg_pageSize = 42; 1845 var arg_pageSize = 42;
1781 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { 1846 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
1782 var path = (req.url).path; 1847 var path = (req.url).path;
1783 var pathOffset = 0; 1848 var pathOffset = 0;
1784 var index; 1849 var index;
1785 var subPart; 1850 var subPart;
1786 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/")); 1851 unittest.expect(
1852 path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
1787 pathOffset += 1; 1853 pathOffset += 1;
1788 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ als("v1beta2/")); 1854 unittest.expect(path.substring(pathOffset, pathOffset + 8),
1855 unittest.equals("v1beta2/"));
1789 pathOffset += 8; 1856 pathOffset += 8;
1790 // NOTE: We cannot test reserved expansions due to the inability to reve rse the operation; 1857 // NOTE: We cannot test reserved expansions due to the inability to reve rse the operation;
1791 1858
1792 var query = (req.url).query; 1859 var query = (req.url).query;
1793 var queryOffset = 0; 1860 var queryOffset = 0;
1794 var queryMap = {}; 1861 var queryMap = {};
1795 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); 1862 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
1796 parseBool(n) { 1863 parseBool(n) {
1797 if (n == "true") return true; 1864 if (n == "true") return true;
1798 if (n == "false") return false; 1865 if (n == "false") return false;
1799 if (n == null) return null; 1866 if (n == null) return null;
1800 throw new core.ArgumentError("Invalid boolean: $n"); 1867 throw new core.ArgumentError("Invalid boolean: $n");
1801 } 1868 }
1869
1802 if (query.length > 0) { 1870 if (query.length > 0) {
1803 for (var part in query.split("&")) { 1871 for (var part in query.split("&")) {
1804 var keyvalue = part.split("="); 1872 var keyvalue = part.split("=");
1805 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d ecodeQueryComponent(keyvalue[1])); 1873 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]),
1874 core.Uri.decodeQueryComponent(keyvalue[1]));
1806 } 1875 }
1807 } 1876 }
1808 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok en)); 1877 unittest.expect(
1809 unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equ als(arg_pageSize)); 1878 queryMap["pageToken"].first, unittest.equals(arg_pageToken));
1810 1879 unittest.expect(core.int.parse(queryMap["pageSize"].first),
1880 unittest.equals(arg_pageSize));
1811 1881
1812 var h = { 1882 var h = {
1813 "content-type" : "application/json; charset=utf-8", 1883 "content-type": "application/json; charset=utf-8",
1814 }; 1884 };
1815 var resp = convert.JSON.encode(buildListTopicSubscriptionsResponse()); 1885 var resp = convert.JSON.encode(buildListTopicSubscriptionsResponse());
1816 return new async.Future.value(stringResponse(200, h, resp)); 1886 return new async.Future.value(stringResponse(200, h, resp));
1817 }), true); 1887 }), true);
1818 res.list(arg_topic, pageToken: arg_pageToken, pageSize: arg_pageSize).then (unittest.expectAsync1(((api.ListTopicSubscriptionsResponse response) { 1888 res
1889 .list(arg_topic, pageToken: arg_pageToken, pageSize: arg_pageSize)
1890 .then(unittest
1891 .expectAsync1(((api.ListTopicSubscriptionsResponse response) {
1819 checkListTopicSubscriptionsResponse(response); 1892 checkListTopicSubscriptionsResponse(response);
1820 }))); 1893 })));
1821 }); 1894 });
1822
1823 }); 1895 });
1824
1825
1826 } 1896 }
1827
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698