OLD | NEW |
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; | 4 import "dart:collection" as collection; |
5 import "dart:async" as async; | 5 import "dart:async" as async; |
6 import "dart:convert" as convert; | 6 import "dart:convert" as convert; |
7 | 7 |
8 import 'package:http/http.dart' as http; | 8 import 'package:http/http.dart' as http; |
9 import 'package:http/testing.dart' as http_testing; | 9 import 'package:http/testing.dart' as http_testing; |
10 import 'package:unittest/unittest.dart' as unittest; | 10 import 'package:unittest/unittest.dart' as unittest; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 } | 44 } |
45 } | 45 } |
46 } | 46 } |
47 | 47 |
48 http.StreamedResponse stringResponse( | 48 http.StreamedResponse stringResponse( |
49 core.int status, core.Map headers, core.String body) { | 49 core.int status, core.Map headers, core.String body) { |
50 var stream = new async.Stream.fromIterable([convert.UTF8.encode(body)]); | 50 var stream = new async.Stream.fromIterable([convert.UTF8.encode(body)]); |
51 return new http.StreamedResponse(stream, status, headers: headers); | 51 return new http.StreamedResponse(stream, status, headers: headers); |
52 } | 52 } |
53 | 53 |
54 buildUnnamed3566() { | 54 buildUnnamed3658() { |
55 var o = new core.List<core.String>(); | 55 var o = new core.List<core.String>(); |
56 o.add("foo"); | 56 o.add("foo"); |
57 o.add("foo"); | 57 o.add("foo"); |
58 return o; | 58 return o; |
59 } | 59 } |
60 | 60 |
61 checkUnnamed3566(core.List<core.String> o) { | 61 checkUnnamed3658(core.List<core.String> o) { |
62 unittest.expect(o, unittest.hasLength(2)); | 62 unittest.expect(o, unittest.hasLength(2)); |
63 unittest.expect(o[0], unittest.equals('foo')); | 63 unittest.expect(o[0], unittest.equals('foo')); |
64 unittest.expect(o[1], unittest.equals('foo')); | 64 unittest.expect(o[1], unittest.equals('foo')); |
65 } | 65 } |
66 | 66 |
67 core.int buildCounterAcknowledgeRequest = 0; | 67 core.int buildCounterAcknowledgeRequest = 0; |
68 buildAcknowledgeRequest() { | 68 buildAcknowledgeRequest() { |
69 var o = new api.AcknowledgeRequest(); | 69 var o = new api.AcknowledgeRequest(); |
70 buildCounterAcknowledgeRequest++; | 70 buildCounterAcknowledgeRequest++; |
71 if (buildCounterAcknowledgeRequest < 3) { | 71 if (buildCounterAcknowledgeRequest < 3) { |
72 o.ackIds = buildUnnamed3566(); | 72 o.ackIds = buildUnnamed3658(); |
73 } | 73 } |
74 buildCounterAcknowledgeRequest--; | 74 buildCounterAcknowledgeRequest--; |
75 return o; | 75 return o; |
76 } | 76 } |
77 | 77 |
78 checkAcknowledgeRequest(api.AcknowledgeRequest o) { | 78 checkAcknowledgeRequest(api.AcknowledgeRequest o) { |
79 buildCounterAcknowledgeRequest++; | 79 buildCounterAcknowledgeRequest++; |
80 if (buildCounterAcknowledgeRequest < 3) { | 80 if (buildCounterAcknowledgeRequest < 3) { |
81 checkUnnamed3566(o.ackIds); | 81 checkUnnamed3658(o.ackIds); |
82 } | 82 } |
83 buildCounterAcknowledgeRequest--; | 83 buildCounterAcknowledgeRequest--; |
84 } | 84 } |
85 | 85 |
86 buildUnnamed3567() { | 86 buildUnnamed3659() { |
87 var o = new core.List<core.String>(); | 87 var o = new core.List<core.String>(); |
88 o.add("foo"); | 88 o.add("foo"); |
89 o.add("foo"); | 89 o.add("foo"); |
90 return o; | 90 return o; |
91 } | 91 } |
92 | 92 |
93 checkUnnamed3567(core.List<core.String> o) { | 93 checkUnnamed3659(core.List<core.String> o) { |
94 unittest.expect(o, unittest.hasLength(2)); | 94 unittest.expect(o, unittest.hasLength(2)); |
95 unittest.expect(o[0], unittest.equals('foo')); | 95 unittest.expect(o[0], unittest.equals('foo')); |
96 unittest.expect(o[1], unittest.equals('foo')); | 96 unittest.expect(o[1], unittest.equals('foo')); |
97 } | 97 } |
98 | 98 |
99 core.int buildCounterBinding = 0; | 99 core.int buildCounterBinding = 0; |
100 buildBinding() { | 100 buildBinding() { |
101 var o = new api.Binding(); | 101 var o = new api.Binding(); |
102 buildCounterBinding++; | 102 buildCounterBinding++; |
103 if (buildCounterBinding < 3) { | 103 if (buildCounterBinding < 3) { |
104 o.members = buildUnnamed3567(); | 104 o.members = buildUnnamed3659(); |
105 o.role = "foo"; | 105 o.role = "foo"; |
106 } | 106 } |
107 buildCounterBinding--; | 107 buildCounterBinding--; |
108 return o; | 108 return o; |
109 } | 109 } |
110 | 110 |
111 checkBinding(api.Binding o) { | 111 checkBinding(api.Binding o) { |
112 buildCounterBinding++; | 112 buildCounterBinding++; |
113 if (buildCounterBinding < 3) { | 113 if (buildCounterBinding < 3) { |
114 checkUnnamed3567(o.members); | 114 checkUnnamed3659(o.members); |
115 unittest.expect(o.role, unittest.equals('foo')); | 115 unittest.expect(o.role, unittest.equals('foo')); |
116 } | 116 } |
117 buildCounterBinding--; | 117 buildCounterBinding--; |
118 } | 118 } |
119 | 119 |
120 core.int buildCounterEmpty = 0; | 120 core.int buildCounterEmpty = 0; |
121 buildEmpty() { | 121 buildEmpty() { |
122 var o = new api.Empty(); | 122 var o = new api.Empty(); |
123 buildCounterEmpty++; | 123 buildCounterEmpty++; |
124 if (buildCounterEmpty < 3) { | 124 if (buildCounterEmpty < 3) { |
125 } | 125 } |
126 buildCounterEmpty--; | 126 buildCounterEmpty--; |
127 return o; | 127 return o; |
128 } | 128 } |
129 | 129 |
130 checkEmpty(api.Empty o) { | 130 checkEmpty(api.Empty o) { |
131 buildCounterEmpty++; | 131 buildCounterEmpty++; |
132 if (buildCounterEmpty < 3) { | 132 if (buildCounterEmpty < 3) { |
133 } | 133 } |
134 buildCounterEmpty--; | 134 buildCounterEmpty--; |
135 } | 135 } |
136 | 136 |
137 buildUnnamed3568() { | 137 buildUnnamed3660() { |
138 var o = new core.List<api.Subscription>(); | 138 var o = new core.List<api.Subscription>(); |
139 o.add(buildSubscription()); | 139 o.add(buildSubscription()); |
140 o.add(buildSubscription()); | 140 o.add(buildSubscription()); |
141 return o; | 141 return o; |
142 } | 142 } |
143 | 143 |
144 checkUnnamed3568(core.List<api.Subscription> o) { | 144 checkUnnamed3660(core.List<api.Subscription> o) { |
145 unittest.expect(o, unittest.hasLength(2)); | 145 unittest.expect(o, unittest.hasLength(2)); |
146 checkSubscription(o[0]); | 146 checkSubscription(o[0]); |
147 checkSubscription(o[1]); | 147 checkSubscription(o[1]); |
148 } | 148 } |
149 | 149 |
150 core.int buildCounterListSubscriptionsResponse = 0; | 150 core.int buildCounterListSubscriptionsResponse = 0; |
151 buildListSubscriptionsResponse() { | 151 buildListSubscriptionsResponse() { |
152 var o = new api.ListSubscriptionsResponse(); | 152 var o = new api.ListSubscriptionsResponse(); |
153 buildCounterListSubscriptionsResponse++; | 153 buildCounterListSubscriptionsResponse++; |
154 if (buildCounterListSubscriptionsResponse < 3) { | 154 if (buildCounterListSubscriptionsResponse < 3) { |
155 o.nextPageToken = "foo"; | 155 o.nextPageToken = "foo"; |
156 o.subscriptions = buildUnnamed3568(); | 156 o.subscriptions = buildUnnamed3660(); |
157 } | 157 } |
158 buildCounterListSubscriptionsResponse--; | 158 buildCounterListSubscriptionsResponse--; |
159 return o; | 159 return o; |
160 } | 160 } |
161 | 161 |
162 checkListSubscriptionsResponse(api.ListSubscriptionsResponse o) { | 162 checkListSubscriptionsResponse(api.ListSubscriptionsResponse o) { |
163 buildCounterListSubscriptionsResponse++; | 163 buildCounterListSubscriptionsResponse++; |
164 if (buildCounterListSubscriptionsResponse < 3) { | 164 if (buildCounterListSubscriptionsResponse < 3) { |
165 unittest.expect(o.nextPageToken, unittest.equals('foo')); | 165 unittest.expect(o.nextPageToken, unittest.equals('foo')); |
166 checkUnnamed3568(o.subscriptions); | 166 checkUnnamed3660(o.subscriptions); |
167 } | 167 } |
168 buildCounterListSubscriptionsResponse--; | 168 buildCounterListSubscriptionsResponse--; |
169 } | 169 } |
170 | 170 |
171 buildUnnamed3569() { | 171 buildUnnamed3661() { |
172 var o = new core.List<core.String>(); | 172 var o = new core.List<core.String>(); |
173 o.add("foo"); | 173 o.add("foo"); |
174 o.add("foo"); | 174 o.add("foo"); |
175 return o; | 175 return o; |
176 } | 176 } |
177 | 177 |
178 checkUnnamed3569(core.List<core.String> o) { | 178 checkUnnamed3661(core.List<core.String> o) { |
179 unittest.expect(o, unittest.hasLength(2)); | 179 unittest.expect(o, unittest.hasLength(2)); |
180 unittest.expect(o[0], unittest.equals('foo')); | 180 unittest.expect(o[0], unittest.equals('foo')); |
181 unittest.expect(o[1], unittest.equals('foo')); | 181 unittest.expect(o[1], unittest.equals('foo')); |
182 } | 182 } |
183 | 183 |
184 core.int buildCounterListTopicSubscriptionsResponse = 0; | 184 core.int buildCounterListTopicSubscriptionsResponse = 0; |
185 buildListTopicSubscriptionsResponse() { | 185 buildListTopicSubscriptionsResponse() { |
186 var o = new api.ListTopicSubscriptionsResponse(); | 186 var o = new api.ListTopicSubscriptionsResponse(); |
187 buildCounterListTopicSubscriptionsResponse++; | 187 buildCounterListTopicSubscriptionsResponse++; |
188 if (buildCounterListTopicSubscriptionsResponse < 3) { | 188 if (buildCounterListTopicSubscriptionsResponse < 3) { |
189 o.nextPageToken = "foo"; | 189 o.nextPageToken = "foo"; |
190 o.subscriptions = buildUnnamed3569(); | 190 o.subscriptions = buildUnnamed3661(); |
191 } | 191 } |
192 buildCounterListTopicSubscriptionsResponse--; | 192 buildCounterListTopicSubscriptionsResponse--; |
193 return o; | 193 return o; |
194 } | 194 } |
195 | 195 |
196 checkListTopicSubscriptionsResponse(api.ListTopicSubscriptionsResponse o) { | 196 checkListTopicSubscriptionsResponse(api.ListTopicSubscriptionsResponse o) { |
197 buildCounterListTopicSubscriptionsResponse++; | 197 buildCounterListTopicSubscriptionsResponse++; |
198 if (buildCounterListTopicSubscriptionsResponse < 3) { | 198 if (buildCounterListTopicSubscriptionsResponse < 3) { |
199 unittest.expect(o.nextPageToken, unittest.equals('foo')); | 199 unittest.expect(o.nextPageToken, unittest.equals('foo')); |
200 checkUnnamed3569(o.subscriptions); | 200 checkUnnamed3661(o.subscriptions); |
201 } | 201 } |
202 buildCounterListTopicSubscriptionsResponse--; | 202 buildCounterListTopicSubscriptionsResponse--; |
203 } | 203 } |
204 | 204 |
205 buildUnnamed3570() { | 205 buildUnnamed3662() { |
206 var o = new core.List<api.Topic>(); | 206 var o = new core.List<api.Topic>(); |
207 o.add(buildTopic()); | 207 o.add(buildTopic()); |
208 o.add(buildTopic()); | 208 o.add(buildTopic()); |
209 return o; | 209 return o; |
210 } | 210 } |
211 | 211 |
212 checkUnnamed3570(core.List<api.Topic> o) { | 212 checkUnnamed3662(core.List<api.Topic> o) { |
213 unittest.expect(o, unittest.hasLength(2)); | 213 unittest.expect(o, unittest.hasLength(2)); |
214 checkTopic(o[0]); | 214 checkTopic(o[0]); |
215 checkTopic(o[1]); | 215 checkTopic(o[1]); |
216 } | 216 } |
217 | 217 |
218 core.int buildCounterListTopicsResponse = 0; | 218 core.int buildCounterListTopicsResponse = 0; |
219 buildListTopicsResponse() { | 219 buildListTopicsResponse() { |
220 var o = new api.ListTopicsResponse(); | 220 var o = new api.ListTopicsResponse(); |
221 buildCounterListTopicsResponse++; | 221 buildCounterListTopicsResponse++; |
222 if (buildCounterListTopicsResponse < 3) { | 222 if (buildCounterListTopicsResponse < 3) { |
223 o.nextPageToken = "foo"; | 223 o.nextPageToken = "foo"; |
224 o.topics = buildUnnamed3570(); | 224 o.topics = buildUnnamed3662(); |
225 } | 225 } |
226 buildCounterListTopicsResponse--; | 226 buildCounterListTopicsResponse--; |
227 return o; | 227 return o; |
228 } | 228 } |
229 | 229 |
230 checkListTopicsResponse(api.ListTopicsResponse o) { | 230 checkListTopicsResponse(api.ListTopicsResponse o) { |
231 buildCounterListTopicsResponse++; | 231 buildCounterListTopicsResponse++; |
232 if (buildCounterListTopicsResponse < 3) { | 232 if (buildCounterListTopicsResponse < 3) { |
233 unittest.expect(o.nextPageToken, unittest.equals('foo')); | 233 unittest.expect(o.nextPageToken, unittest.equals('foo')); |
234 checkUnnamed3570(o.topics); | 234 checkUnnamed3662(o.topics); |
235 } | 235 } |
236 buildCounterListTopicsResponse--; | 236 buildCounterListTopicsResponse--; |
237 } | 237 } |
238 | 238 |
239 buildUnnamed3571() { | 239 buildUnnamed3663() { |
240 var o = new core.List<core.String>(); | 240 var o = new core.List<core.String>(); |
241 o.add("foo"); | 241 o.add("foo"); |
242 o.add("foo"); | 242 o.add("foo"); |
243 return o; | 243 return o; |
244 } | 244 } |
245 | 245 |
246 checkUnnamed3571(core.List<core.String> o) { | 246 checkUnnamed3663(core.List<core.String> o) { |
247 unittest.expect(o, unittest.hasLength(2)); | 247 unittest.expect(o, unittest.hasLength(2)); |
248 unittest.expect(o[0], unittest.equals('foo')); | 248 unittest.expect(o[0], unittest.equals('foo')); |
249 unittest.expect(o[1], unittest.equals('foo')); | 249 unittest.expect(o[1], unittest.equals('foo')); |
250 } | 250 } |
251 | 251 |
252 core.int buildCounterModifyAckDeadlineRequest = 0; | 252 core.int buildCounterModifyAckDeadlineRequest = 0; |
253 buildModifyAckDeadlineRequest() { | 253 buildModifyAckDeadlineRequest() { |
254 var o = new api.ModifyAckDeadlineRequest(); | 254 var o = new api.ModifyAckDeadlineRequest(); |
255 buildCounterModifyAckDeadlineRequest++; | 255 buildCounterModifyAckDeadlineRequest++; |
256 if (buildCounterModifyAckDeadlineRequest < 3) { | 256 if (buildCounterModifyAckDeadlineRequest < 3) { |
257 o.ackDeadlineSeconds = 42; | 257 o.ackDeadlineSeconds = 42; |
258 o.ackId = "foo"; | 258 o.ackId = "foo"; |
259 o.ackIds = buildUnnamed3571(); | 259 o.ackIds = buildUnnamed3663(); |
260 } | 260 } |
261 buildCounterModifyAckDeadlineRequest--; | 261 buildCounterModifyAckDeadlineRequest--; |
262 return o; | 262 return o; |
263 } | 263 } |
264 | 264 |
265 checkModifyAckDeadlineRequest(api.ModifyAckDeadlineRequest o) { | 265 checkModifyAckDeadlineRequest(api.ModifyAckDeadlineRequest o) { |
266 buildCounterModifyAckDeadlineRequest++; | 266 buildCounterModifyAckDeadlineRequest++; |
267 if (buildCounterModifyAckDeadlineRequest < 3) { | 267 if (buildCounterModifyAckDeadlineRequest < 3) { |
268 unittest.expect(o.ackDeadlineSeconds, unittest.equals(42)); | 268 unittest.expect(o.ackDeadlineSeconds, unittest.equals(42)); |
269 unittest.expect(o.ackId, unittest.equals('foo')); | 269 unittest.expect(o.ackId, unittest.equals('foo')); |
270 checkUnnamed3571(o.ackIds); | 270 checkUnnamed3663(o.ackIds); |
271 } | 271 } |
272 buildCounterModifyAckDeadlineRequest--; | 272 buildCounterModifyAckDeadlineRequest--; |
273 } | 273 } |
274 | 274 |
275 core.int buildCounterModifyPushConfigRequest = 0; | 275 core.int buildCounterModifyPushConfigRequest = 0; |
276 buildModifyPushConfigRequest() { | 276 buildModifyPushConfigRequest() { |
277 var o = new api.ModifyPushConfigRequest(); | 277 var o = new api.ModifyPushConfigRequest(); |
278 buildCounterModifyPushConfigRequest++; | 278 buildCounterModifyPushConfigRequest++; |
279 if (buildCounterModifyPushConfigRequest < 3) { | 279 if (buildCounterModifyPushConfigRequest < 3) { |
280 o.pushConfig = buildPushConfig(); | 280 o.pushConfig = buildPushConfig(); |
281 } | 281 } |
282 buildCounterModifyPushConfigRequest--; | 282 buildCounterModifyPushConfigRequest--; |
283 return o; | 283 return o; |
284 } | 284 } |
285 | 285 |
286 checkModifyPushConfigRequest(api.ModifyPushConfigRequest o) { | 286 checkModifyPushConfigRequest(api.ModifyPushConfigRequest o) { |
287 buildCounterModifyPushConfigRequest++; | 287 buildCounterModifyPushConfigRequest++; |
288 if (buildCounterModifyPushConfigRequest < 3) { | 288 if (buildCounterModifyPushConfigRequest < 3) { |
289 checkPushConfig(o.pushConfig); | 289 checkPushConfig(o.pushConfig); |
290 } | 290 } |
291 buildCounterModifyPushConfigRequest--; | 291 buildCounterModifyPushConfigRequest--; |
292 } | 292 } |
293 | 293 |
294 buildUnnamed3572() { | 294 buildUnnamed3664() { |
295 var o = new core.List<api.Binding>(); | 295 var o = new core.List<api.Binding>(); |
296 o.add(buildBinding()); | 296 o.add(buildBinding()); |
297 o.add(buildBinding()); | 297 o.add(buildBinding()); |
298 return o; | 298 return o; |
299 } | 299 } |
300 | 300 |
301 checkUnnamed3572(core.List<api.Binding> o) { | 301 checkUnnamed3664(core.List<api.Binding> o) { |
302 unittest.expect(o, unittest.hasLength(2)); | 302 unittest.expect(o, unittest.hasLength(2)); |
303 checkBinding(o[0]); | 303 checkBinding(o[0]); |
304 checkBinding(o[1]); | 304 checkBinding(o[1]); |
305 } | 305 } |
306 | 306 |
307 core.int buildCounterPolicy = 0; | 307 core.int buildCounterPolicy = 0; |
308 buildPolicy() { | 308 buildPolicy() { |
309 var o = new api.Policy(); | 309 var o = new api.Policy(); |
310 buildCounterPolicy++; | 310 buildCounterPolicy++; |
311 if (buildCounterPolicy < 3) { | 311 if (buildCounterPolicy < 3) { |
312 o.bindings = buildUnnamed3572(); | 312 o.bindings = buildUnnamed3664(); |
313 o.etag = "foo"; | 313 o.etag = "foo"; |
314 o.version = 42; | 314 o.version = 42; |
315 } | 315 } |
316 buildCounterPolicy--; | 316 buildCounterPolicy--; |
317 return o; | 317 return o; |
318 } | 318 } |
319 | 319 |
320 checkPolicy(api.Policy o) { | 320 checkPolicy(api.Policy o) { |
321 buildCounterPolicy++; | 321 buildCounterPolicy++; |
322 if (buildCounterPolicy < 3) { | 322 if (buildCounterPolicy < 3) { |
323 checkUnnamed3572(o.bindings); | 323 checkUnnamed3664(o.bindings); |
324 unittest.expect(o.etag, unittest.equals('foo')); | 324 unittest.expect(o.etag, unittest.equals('foo')); |
325 unittest.expect(o.version, unittest.equals(42)); | 325 unittest.expect(o.version, unittest.equals(42)); |
326 } | 326 } |
327 buildCounterPolicy--; | 327 buildCounterPolicy--; |
328 } | 328 } |
329 | 329 |
330 buildUnnamed3573() { | 330 buildUnnamed3665() { |
331 var o = new core.List<api.PubsubMessage>(); | 331 var o = new core.List<api.PubsubMessage>(); |
332 o.add(buildPubsubMessage()); | 332 o.add(buildPubsubMessage()); |
333 o.add(buildPubsubMessage()); | 333 o.add(buildPubsubMessage()); |
334 return o; | 334 return o; |
335 } | 335 } |
336 | 336 |
337 checkUnnamed3573(core.List<api.PubsubMessage> o) { | 337 checkUnnamed3665(core.List<api.PubsubMessage> o) { |
338 unittest.expect(o, unittest.hasLength(2)); | 338 unittest.expect(o, unittest.hasLength(2)); |
339 checkPubsubMessage(o[0]); | 339 checkPubsubMessage(o[0]); |
340 checkPubsubMessage(o[1]); | 340 checkPubsubMessage(o[1]); |
341 } | 341 } |
342 | 342 |
343 core.int buildCounterPublishRequest = 0; | 343 core.int buildCounterPublishRequest = 0; |
344 buildPublishRequest() { | 344 buildPublishRequest() { |
345 var o = new api.PublishRequest(); | 345 var o = new api.PublishRequest(); |
346 buildCounterPublishRequest++; | 346 buildCounterPublishRequest++; |
347 if (buildCounterPublishRequest < 3) { | 347 if (buildCounterPublishRequest < 3) { |
348 o.messages = buildUnnamed3573(); | 348 o.messages = buildUnnamed3665(); |
349 } | 349 } |
350 buildCounterPublishRequest--; | 350 buildCounterPublishRequest--; |
351 return o; | 351 return o; |
352 } | 352 } |
353 | 353 |
354 checkPublishRequest(api.PublishRequest o) { | 354 checkPublishRequest(api.PublishRequest o) { |
355 buildCounterPublishRequest++; | 355 buildCounterPublishRequest++; |
356 if (buildCounterPublishRequest < 3) { | 356 if (buildCounterPublishRequest < 3) { |
357 checkUnnamed3573(o.messages); | 357 checkUnnamed3665(o.messages); |
358 } | 358 } |
359 buildCounterPublishRequest--; | 359 buildCounterPublishRequest--; |
360 } | 360 } |
361 | 361 |
362 buildUnnamed3574() { | 362 buildUnnamed3666() { |
363 var o = new core.List<core.String>(); | 363 var o = new core.List<core.String>(); |
364 o.add("foo"); | 364 o.add("foo"); |
365 o.add("foo"); | 365 o.add("foo"); |
366 return o; | 366 return o; |
367 } | 367 } |
368 | 368 |
369 checkUnnamed3574(core.List<core.String> o) { | 369 checkUnnamed3666(core.List<core.String> o) { |
370 unittest.expect(o, unittest.hasLength(2)); | 370 unittest.expect(o, unittest.hasLength(2)); |
371 unittest.expect(o[0], unittest.equals('foo')); | 371 unittest.expect(o[0], unittest.equals('foo')); |
372 unittest.expect(o[1], unittest.equals('foo')); | 372 unittest.expect(o[1], unittest.equals('foo')); |
373 } | 373 } |
374 | 374 |
375 core.int buildCounterPublishResponse = 0; | 375 core.int buildCounterPublishResponse = 0; |
376 buildPublishResponse() { | 376 buildPublishResponse() { |
377 var o = new api.PublishResponse(); | 377 var o = new api.PublishResponse(); |
378 buildCounterPublishResponse++; | 378 buildCounterPublishResponse++; |
379 if (buildCounterPublishResponse < 3) { | 379 if (buildCounterPublishResponse < 3) { |
380 o.messageIds = buildUnnamed3574(); | 380 o.messageIds = buildUnnamed3666(); |
381 } | 381 } |
382 buildCounterPublishResponse--; | 382 buildCounterPublishResponse--; |
383 return o; | 383 return o; |
384 } | 384 } |
385 | 385 |
386 checkPublishResponse(api.PublishResponse o) { | 386 checkPublishResponse(api.PublishResponse o) { |
387 buildCounterPublishResponse++; | 387 buildCounterPublishResponse++; |
388 if (buildCounterPublishResponse < 3) { | 388 if (buildCounterPublishResponse < 3) { |
389 checkUnnamed3574(o.messageIds); | 389 checkUnnamed3666(o.messageIds); |
390 } | 390 } |
391 buildCounterPublishResponse--; | 391 buildCounterPublishResponse--; |
392 } | 392 } |
393 | 393 |
394 buildUnnamed3575() { | 394 buildUnnamed3667() { |
395 var o = new core.Map<core.String, core.String>(); | 395 var o = new core.Map<core.String, core.String>(); |
396 o["x"] = "foo"; | 396 o["x"] = "foo"; |
397 o["y"] = "foo"; | 397 o["y"] = "foo"; |
398 return o; | 398 return o; |
399 } | 399 } |
400 | 400 |
401 checkUnnamed3575(core.Map<core.String, core.String> o) { | 401 checkUnnamed3667(core.Map<core.String, core.String> o) { |
402 unittest.expect(o, unittest.hasLength(2)); | 402 unittest.expect(o, unittest.hasLength(2)); |
403 unittest.expect(o["x"], unittest.equals('foo')); | 403 unittest.expect(o["x"], unittest.equals('foo')); |
404 unittest.expect(o["y"], unittest.equals('foo')); | 404 unittest.expect(o["y"], unittest.equals('foo')); |
405 } | 405 } |
406 | 406 |
407 core.int buildCounterPubsubMessage = 0; | 407 core.int buildCounterPubsubMessage = 0; |
408 buildPubsubMessage() { | 408 buildPubsubMessage() { |
409 var o = new api.PubsubMessage(); | 409 var o = new api.PubsubMessage(); |
410 buildCounterPubsubMessage++; | 410 buildCounterPubsubMessage++; |
411 if (buildCounterPubsubMessage < 3) { | 411 if (buildCounterPubsubMessage < 3) { |
412 o.attributes = buildUnnamed3575(); | 412 o.attributes = buildUnnamed3667(); |
413 o.data = "foo"; | 413 o.data = "foo"; |
414 o.messageId = "foo"; | 414 o.messageId = "foo"; |
415 o.publishTime = "foo"; | 415 o.publishTime = "foo"; |
416 } | 416 } |
417 buildCounterPubsubMessage--; | 417 buildCounterPubsubMessage--; |
418 return o; | 418 return o; |
419 } | 419 } |
420 | 420 |
421 checkPubsubMessage(api.PubsubMessage o) { | 421 checkPubsubMessage(api.PubsubMessage o) { |
422 buildCounterPubsubMessage++; | 422 buildCounterPubsubMessage++; |
423 if (buildCounterPubsubMessage < 3) { | 423 if (buildCounterPubsubMessage < 3) { |
424 checkUnnamed3575(o.attributes); | 424 checkUnnamed3667(o.attributes); |
425 unittest.expect(o.data, unittest.equals('foo')); | 425 unittest.expect(o.data, unittest.equals('foo')); |
426 unittest.expect(o.messageId, unittest.equals('foo')); | 426 unittest.expect(o.messageId, unittest.equals('foo')); |
427 unittest.expect(o.publishTime, unittest.equals('foo')); | 427 unittest.expect(o.publishTime, unittest.equals('foo')); |
428 } | 428 } |
429 buildCounterPubsubMessage--; | 429 buildCounterPubsubMessage--; |
430 } | 430 } |
431 | 431 |
432 core.int buildCounterPullRequest = 0; | 432 core.int buildCounterPullRequest = 0; |
433 buildPullRequest() { | 433 buildPullRequest() { |
434 var o = new api.PullRequest(); | 434 var o = new api.PullRequest(); |
435 buildCounterPullRequest++; | 435 buildCounterPullRequest++; |
436 if (buildCounterPullRequest < 3) { | 436 if (buildCounterPullRequest < 3) { |
437 o.maxMessages = 42; | 437 o.maxMessages = 42; |
438 o.returnImmediately = true; | 438 o.returnImmediately = true; |
439 } | 439 } |
440 buildCounterPullRequest--; | 440 buildCounterPullRequest--; |
441 return o; | 441 return o; |
442 } | 442 } |
443 | 443 |
444 checkPullRequest(api.PullRequest o) { | 444 checkPullRequest(api.PullRequest o) { |
445 buildCounterPullRequest++; | 445 buildCounterPullRequest++; |
446 if (buildCounterPullRequest < 3) { | 446 if (buildCounterPullRequest < 3) { |
447 unittest.expect(o.maxMessages, unittest.equals(42)); | 447 unittest.expect(o.maxMessages, unittest.equals(42)); |
448 unittest.expect(o.returnImmediately, unittest.isTrue); | 448 unittest.expect(o.returnImmediately, unittest.isTrue); |
449 } | 449 } |
450 buildCounterPullRequest--; | 450 buildCounterPullRequest--; |
451 } | 451 } |
452 | 452 |
453 buildUnnamed3576() { | 453 buildUnnamed3668() { |
454 var o = new core.List<api.ReceivedMessage>(); | 454 var o = new core.List<api.ReceivedMessage>(); |
455 o.add(buildReceivedMessage()); | 455 o.add(buildReceivedMessage()); |
456 o.add(buildReceivedMessage()); | 456 o.add(buildReceivedMessage()); |
457 return o; | 457 return o; |
458 } | 458 } |
459 | 459 |
460 checkUnnamed3576(core.List<api.ReceivedMessage> o) { | 460 checkUnnamed3668(core.List<api.ReceivedMessage> o) { |
461 unittest.expect(o, unittest.hasLength(2)); | 461 unittest.expect(o, unittest.hasLength(2)); |
462 checkReceivedMessage(o[0]); | 462 checkReceivedMessage(o[0]); |
463 checkReceivedMessage(o[1]); | 463 checkReceivedMessage(o[1]); |
464 } | 464 } |
465 | 465 |
466 core.int buildCounterPullResponse = 0; | 466 core.int buildCounterPullResponse = 0; |
467 buildPullResponse() { | 467 buildPullResponse() { |
468 var o = new api.PullResponse(); | 468 var o = new api.PullResponse(); |
469 buildCounterPullResponse++; | 469 buildCounterPullResponse++; |
470 if (buildCounterPullResponse < 3) { | 470 if (buildCounterPullResponse < 3) { |
471 o.receivedMessages = buildUnnamed3576(); | 471 o.receivedMessages = buildUnnamed3668(); |
472 } | 472 } |
473 buildCounterPullResponse--; | 473 buildCounterPullResponse--; |
474 return o; | 474 return o; |
475 } | 475 } |
476 | 476 |
477 checkPullResponse(api.PullResponse o) { | 477 checkPullResponse(api.PullResponse o) { |
478 buildCounterPullResponse++; | 478 buildCounterPullResponse++; |
479 if (buildCounterPullResponse < 3) { | 479 if (buildCounterPullResponse < 3) { |
480 checkUnnamed3576(o.receivedMessages); | 480 checkUnnamed3668(o.receivedMessages); |
481 } | 481 } |
482 buildCounterPullResponse--; | 482 buildCounterPullResponse--; |
483 } | 483 } |
484 | 484 |
485 buildUnnamed3577() { | 485 buildUnnamed3669() { |
486 var o = new core.Map<core.String, core.String>(); | 486 var o = new core.Map<core.String, core.String>(); |
487 o["x"] = "foo"; | 487 o["x"] = "foo"; |
488 o["y"] = "foo"; | 488 o["y"] = "foo"; |
489 return o; | 489 return o; |
490 } | 490 } |
491 | 491 |
492 checkUnnamed3577(core.Map<core.String, core.String> o) { | 492 checkUnnamed3669(core.Map<core.String, core.String> o) { |
493 unittest.expect(o, unittest.hasLength(2)); | 493 unittest.expect(o, unittest.hasLength(2)); |
494 unittest.expect(o["x"], unittest.equals('foo')); | 494 unittest.expect(o["x"], unittest.equals('foo')); |
495 unittest.expect(o["y"], unittest.equals('foo')); | 495 unittest.expect(o["y"], unittest.equals('foo')); |
496 } | 496 } |
497 | 497 |
498 core.int buildCounterPushConfig = 0; | 498 core.int buildCounterPushConfig = 0; |
499 buildPushConfig() { | 499 buildPushConfig() { |
500 var o = new api.PushConfig(); | 500 var o = new api.PushConfig(); |
501 buildCounterPushConfig++; | 501 buildCounterPushConfig++; |
502 if (buildCounterPushConfig < 3) { | 502 if (buildCounterPushConfig < 3) { |
503 o.attributes = buildUnnamed3577(); | 503 o.attributes = buildUnnamed3669(); |
504 o.pushEndpoint = "foo"; | 504 o.pushEndpoint = "foo"; |
505 } | 505 } |
506 buildCounterPushConfig--; | 506 buildCounterPushConfig--; |
507 return o; | 507 return o; |
508 } | 508 } |
509 | 509 |
510 checkPushConfig(api.PushConfig o) { | 510 checkPushConfig(api.PushConfig o) { |
511 buildCounterPushConfig++; | 511 buildCounterPushConfig++; |
512 if (buildCounterPushConfig < 3) { | 512 if (buildCounterPushConfig < 3) { |
513 checkUnnamed3577(o.attributes); | 513 checkUnnamed3669(o.attributes); |
514 unittest.expect(o.pushEndpoint, unittest.equals('foo')); | 514 unittest.expect(o.pushEndpoint, unittest.equals('foo')); |
515 } | 515 } |
516 buildCounterPushConfig--; | 516 buildCounterPushConfig--; |
517 } | 517 } |
518 | 518 |
519 core.int buildCounterReceivedMessage = 0; | 519 core.int buildCounterReceivedMessage = 0; |
520 buildReceivedMessage() { | 520 buildReceivedMessage() { |
521 var o = new api.ReceivedMessage(); | 521 var o = new api.ReceivedMessage(); |
522 buildCounterReceivedMessage++; | 522 buildCounterReceivedMessage++; |
523 if (buildCounterReceivedMessage < 3) { | 523 if (buildCounterReceivedMessage < 3) { |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
574 buildCounterSubscription++; | 574 buildCounterSubscription++; |
575 if (buildCounterSubscription < 3) { | 575 if (buildCounterSubscription < 3) { |
576 unittest.expect(o.ackDeadlineSeconds, unittest.equals(42)); | 576 unittest.expect(o.ackDeadlineSeconds, unittest.equals(42)); |
577 unittest.expect(o.name, unittest.equals('foo')); | 577 unittest.expect(o.name, unittest.equals('foo')); |
578 checkPushConfig(o.pushConfig); | 578 checkPushConfig(o.pushConfig); |
579 unittest.expect(o.topic, unittest.equals('foo')); | 579 unittest.expect(o.topic, unittest.equals('foo')); |
580 } | 580 } |
581 buildCounterSubscription--; | 581 buildCounterSubscription--; |
582 } | 582 } |
583 | 583 |
584 buildUnnamed3578() { | 584 buildUnnamed3670() { |
585 var o = new core.List<core.String>(); | 585 var o = new core.List<core.String>(); |
586 o.add("foo"); | 586 o.add("foo"); |
587 o.add("foo"); | 587 o.add("foo"); |
588 return o; | 588 return o; |
589 } | 589 } |
590 | 590 |
591 checkUnnamed3578(core.List<core.String> o) { | 591 checkUnnamed3670(core.List<core.String> o) { |
592 unittest.expect(o, unittest.hasLength(2)); | 592 unittest.expect(o, unittest.hasLength(2)); |
593 unittest.expect(o[0], unittest.equals('foo')); | 593 unittest.expect(o[0], unittest.equals('foo')); |
594 unittest.expect(o[1], unittest.equals('foo')); | 594 unittest.expect(o[1], unittest.equals('foo')); |
595 } | 595 } |
596 | 596 |
597 core.int buildCounterTestIamPermissionsRequest = 0; | 597 core.int buildCounterTestIamPermissionsRequest = 0; |
598 buildTestIamPermissionsRequest() { | 598 buildTestIamPermissionsRequest() { |
599 var o = new api.TestIamPermissionsRequest(); | 599 var o = new api.TestIamPermissionsRequest(); |
600 buildCounterTestIamPermissionsRequest++; | 600 buildCounterTestIamPermissionsRequest++; |
601 if (buildCounterTestIamPermissionsRequest < 3) { | 601 if (buildCounterTestIamPermissionsRequest < 3) { |
602 o.permissions = buildUnnamed3578(); | 602 o.permissions = buildUnnamed3670(); |
603 } | 603 } |
604 buildCounterTestIamPermissionsRequest--; | 604 buildCounterTestIamPermissionsRequest--; |
605 return o; | 605 return o; |
606 } | 606 } |
607 | 607 |
608 checkTestIamPermissionsRequest(api.TestIamPermissionsRequest o) { | 608 checkTestIamPermissionsRequest(api.TestIamPermissionsRequest o) { |
609 buildCounterTestIamPermissionsRequest++; | 609 buildCounterTestIamPermissionsRequest++; |
610 if (buildCounterTestIamPermissionsRequest < 3) { | 610 if (buildCounterTestIamPermissionsRequest < 3) { |
611 checkUnnamed3578(o.permissions); | 611 checkUnnamed3670(o.permissions); |
612 } | 612 } |
613 buildCounterTestIamPermissionsRequest--; | 613 buildCounterTestIamPermissionsRequest--; |
614 } | 614 } |
615 | 615 |
616 buildUnnamed3579() { | 616 buildUnnamed3671() { |
617 var o = new core.List<core.String>(); | 617 var o = new core.List<core.String>(); |
618 o.add("foo"); | 618 o.add("foo"); |
619 o.add("foo"); | 619 o.add("foo"); |
620 return o; | 620 return o; |
621 } | 621 } |
622 | 622 |
623 checkUnnamed3579(core.List<core.String> o) { | 623 checkUnnamed3671(core.List<core.String> o) { |
624 unittest.expect(o, unittest.hasLength(2)); | 624 unittest.expect(o, unittest.hasLength(2)); |
625 unittest.expect(o[0], unittest.equals('foo')); | 625 unittest.expect(o[0], unittest.equals('foo')); |
626 unittest.expect(o[1], unittest.equals('foo')); | 626 unittest.expect(o[1], unittest.equals('foo')); |
627 } | 627 } |
628 | 628 |
629 core.int buildCounterTestIamPermissionsResponse = 0; | 629 core.int buildCounterTestIamPermissionsResponse = 0; |
630 buildTestIamPermissionsResponse() { | 630 buildTestIamPermissionsResponse() { |
631 var o = new api.TestIamPermissionsResponse(); | 631 var o = new api.TestIamPermissionsResponse(); |
632 buildCounterTestIamPermissionsResponse++; | 632 buildCounterTestIamPermissionsResponse++; |
633 if (buildCounterTestIamPermissionsResponse < 3) { | 633 if (buildCounterTestIamPermissionsResponse < 3) { |
634 o.permissions = buildUnnamed3579(); | 634 o.permissions = buildUnnamed3671(); |
635 } | 635 } |
636 buildCounterTestIamPermissionsResponse--; | 636 buildCounterTestIamPermissionsResponse--; |
637 return o; | 637 return o; |
638 } | 638 } |
639 | 639 |
640 checkTestIamPermissionsResponse(api.TestIamPermissionsResponse o) { | 640 checkTestIamPermissionsResponse(api.TestIamPermissionsResponse o) { |
641 buildCounterTestIamPermissionsResponse++; | 641 buildCounterTestIamPermissionsResponse++; |
642 if (buildCounterTestIamPermissionsResponse < 3) { | 642 if (buildCounterTestIamPermissionsResponse < 3) { |
643 checkUnnamed3579(o.permissions); | 643 checkUnnamed3671(o.permissions); |
644 } | 644 } |
645 buildCounterTestIamPermissionsResponse--; | 645 buildCounterTestIamPermissionsResponse--; |
646 } | 646 } |
647 | 647 |
648 core.int buildCounterTopic = 0; | 648 core.int buildCounterTopic = 0; |
649 buildTopic() { | 649 buildTopic() { |
650 var o = new api.Topic(); | 650 var o = new api.Topic(); |
651 buildCounterTopic++; | 651 buildCounterTopic++; |
652 if (buildCounterTopic < 3) { | 652 if (buildCounterTopic < 3) { |
653 o.name = "foo"; | 653 o.name = "foo"; |
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1087 res.getIamPolicy(arg_resource).then(unittest.expectAsync(((api.Policy resp
onse) { | 1087 res.getIamPolicy(arg_resource).then(unittest.expectAsync(((api.Policy resp
onse) { |
1088 checkPolicy(response); | 1088 checkPolicy(response); |
1089 }))); | 1089 }))); |
1090 }); | 1090 }); |
1091 | 1091 |
1092 unittest.test("method--list", () { | 1092 unittest.test("method--list", () { |
1093 | 1093 |
1094 var mock = new HttpServerMock(); | 1094 var mock = new HttpServerMock(); |
1095 api.ProjectsSubscriptionsResourceApi res = new api.PubsubApi(mock).project
s.subscriptions; | 1095 api.ProjectsSubscriptionsResourceApi res = new api.PubsubApi(mock).project
s.subscriptions; |
1096 var arg_project = "foo"; | 1096 var arg_project = "foo"; |
| 1097 var arg_pageToken = "foo"; |
1097 var arg_pageSize = 42; | 1098 var arg_pageSize = 42; |
1098 var arg_pageToken = "foo"; | |
1099 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 1099 mock.register(unittest.expectAsync((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(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
1105 pathOffset += 1; | 1105 pathOffset += 1; |
1106 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("v1beta2/")); | 1106 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("v1beta2/")); |
1107 pathOffset += 8; | 1107 pathOffset += 8; |
1108 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 1108 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
1109 | 1109 |
1110 var query = (req.url).query; | 1110 var query = (req.url).query; |
1111 var queryOffset = 0; | 1111 var queryOffset = 0; |
1112 var queryMap = {}; | 1112 var queryMap = {}; |
1113 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1113 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
1114 parseBool(n) { | 1114 parseBool(n) { |
1115 if (n == "true") return true; | 1115 if (n == "true") return true; |
1116 if (n == "false") return false; | 1116 if (n == "false") return false; |
1117 if (n == null) return null; | 1117 if (n == null) return null; |
1118 throw new core.ArgumentError("Invalid boolean: $n"); | 1118 throw new core.ArgumentError("Invalid boolean: $n"); |
1119 } | 1119 } |
1120 if (query.length > 0) { | 1120 if (query.length > 0) { |
1121 for (var part in query.split("&")) { | 1121 for (var part in query.split("&")) { |
1122 var keyvalue = part.split("="); | 1122 var keyvalue = part.split("="); |
1123 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1123 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
1124 } | 1124 } |
1125 } | 1125 } |
| 1126 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); |
1126 unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equ
als(arg_pageSize)); | 1127 unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equ
als(arg_pageSize)); |
1127 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); | |
1128 | 1128 |
1129 | 1129 |
1130 var h = { | 1130 var h = { |
1131 "content-type" : "application/json; charset=utf-8", | 1131 "content-type" : "application/json; charset=utf-8", |
1132 }; | 1132 }; |
1133 var resp = convert.JSON.encode(buildListSubscriptionsResponse()); | 1133 var resp = convert.JSON.encode(buildListSubscriptionsResponse()); |
1134 return new async.Future.value(stringResponse(200, h, resp)); | 1134 return new async.Future.value(stringResponse(200, h, resp)); |
1135 }), true); | 1135 }), true); |
1136 res.list(arg_project, pageSize: arg_pageSize, pageToken: arg_pageToken).th
en(unittest.expectAsync(((api.ListSubscriptionsResponse response) { | 1136 res.list(arg_project, pageToken: arg_pageToken, pageSize: arg_pageSize).th
en(unittest.expectAsync(((api.ListSubscriptionsResponse response) { |
1137 checkListSubscriptionsResponse(response); | 1137 checkListSubscriptionsResponse(response); |
1138 }))); | 1138 }))); |
1139 }); | 1139 }); |
1140 | 1140 |
1141 unittest.test("method--modifyAckDeadline", () { | 1141 unittest.test("method--modifyAckDeadline", () { |
1142 | 1142 |
1143 var mock = new HttpServerMock(); | 1143 var mock = new HttpServerMock(); |
1144 api.ProjectsSubscriptionsResourceApi res = new api.PubsubApi(mock).project
s.subscriptions; | 1144 api.ProjectsSubscriptionsResourceApi res = new api.PubsubApi(mock).project
s.subscriptions; |
1145 var arg_request = buildModifyAckDeadlineRequest(); | 1145 var arg_request = buildModifyAckDeadlineRequest(); |
1146 var arg_subscription = "foo"; | 1146 var arg_subscription = "foo"; |
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1569 res.getIamPolicy(arg_resource).then(unittest.expectAsync(((api.Policy resp
onse) { | 1569 res.getIamPolicy(arg_resource).then(unittest.expectAsync(((api.Policy resp
onse) { |
1570 checkPolicy(response); | 1570 checkPolicy(response); |
1571 }))); | 1571 }))); |
1572 }); | 1572 }); |
1573 | 1573 |
1574 unittest.test("method--list", () { | 1574 unittest.test("method--list", () { |
1575 | 1575 |
1576 var mock = new HttpServerMock(); | 1576 var mock = new HttpServerMock(); |
1577 api.ProjectsTopicsResourceApi res = new api.PubsubApi(mock).projects.topic
s; | 1577 api.ProjectsTopicsResourceApi res = new api.PubsubApi(mock).projects.topic
s; |
1578 var arg_project = "foo"; | 1578 var arg_project = "foo"; |
| 1579 var arg_pageToken = "foo"; |
1579 var arg_pageSize = 42; | 1580 var arg_pageSize = 42; |
1580 var arg_pageToken = "foo"; | |
1581 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 1581 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
1582 var path = (req.url).path; | 1582 var path = (req.url).path; |
1583 var pathOffset = 0; | 1583 var pathOffset = 0; |
1584 var index; | 1584 var index; |
1585 var subPart; | 1585 var subPart; |
1586 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1586 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
1587 pathOffset += 1; | 1587 pathOffset += 1; |
1588 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("v1beta2/")); | 1588 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("v1beta2/")); |
1589 pathOffset += 8; | 1589 pathOffset += 8; |
1590 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 1590 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
1591 | 1591 |
1592 var query = (req.url).query; | 1592 var query = (req.url).query; |
1593 var queryOffset = 0; | 1593 var queryOffset = 0; |
1594 var queryMap = {}; | 1594 var queryMap = {}; |
1595 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1595 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
1596 parseBool(n) { | 1596 parseBool(n) { |
1597 if (n == "true") return true; | 1597 if (n == "true") return true; |
1598 if (n == "false") return false; | 1598 if (n == "false") return false; |
1599 if (n == null) return null; | 1599 if (n == null) return null; |
1600 throw new core.ArgumentError("Invalid boolean: $n"); | 1600 throw new core.ArgumentError("Invalid boolean: $n"); |
1601 } | 1601 } |
1602 if (query.length > 0) { | 1602 if (query.length > 0) { |
1603 for (var part in query.split("&")) { | 1603 for (var part in query.split("&")) { |
1604 var keyvalue = part.split("="); | 1604 var keyvalue = part.split("="); |
1605 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1605 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
1606 } | 1606 } |
1607 } | 1607 } |
| 1608 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); |
1608 unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equ
als(arg_pageSize)); | 1609 unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equ
als(arg_pageSize)); |
1609 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); | |
1610 | 1610 |
1611 | 1611 |
1612 var h = { | 1612 var h = { |
1613 "content-type" : "application/json; charset=utf-8", | 1613 "content-type" : "application/json; charset=utf-8", |
1614 }; | 1614 }; |
1615 var resp = convert.JSON.encode(buildListTopicsResponse()); | 1615 var resp = convert.JSON.encode(buildListTopicsResponse()); |
1616 return new async.Future.value(stringResponse(200, h, resp)); | 1616 return new async.Future.value(stringResponse(200, h, resp)); |
1617 }), true); | 1617 }), true); |
1618 res.list(arg_project, pageSize: arg_pageSize, pageToken: arg_pageToken).th
en(unittest.expectAsync(((api.ListTopicsResponse response) { | 1618 res.list(arg_project, pageToken: arg_pageToken, pageSize: arg_pageSize).th
en(unittest.expectAsync(((api.ListTopicsResponse response) { |
1619 checkListTopicsResponse(response); | 1619 checkListTopicsResponse(response); |
1620 }))); | 1620 }))); |
1621 }); | 1621 }); |
1622 | 1622 |
1623 unittest.test("method--publish", () { | 1623 unittest.test("method--publish", () { |
1624 | 1624 |
1625 var mock = new HttpServerMock(); | 1625 var mock = new HttpServerMock(); |
1626 api.ProjectsTopicsResourceApi res = new api.PubsubApi(mock).projects.topic
s; | 1626 api.ProjectsTopicsResourceApi res = new api.PubsubApi(mock).projects.topic
s; |
1627 var arg_request = buildPublishRequest(); | 1627 var arg_request = buildPublishRequest(); |
1628 var arg_topic = "foo"; | 1628 var arg_topic = "foo"; |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1769 | 1769 |
1770 }); | 1770 }); |
1771 | 1771 |
1772 | 1772 |
1773 unittest.group("resource-ProjectsTopicsSubscriptionsResourceApi", () { | 1773 unittest.group("resource-ProjectsTopicsSubscriptionsResourceApi", () { |
1774 unittest.test("method--list", () { | 1774 unittest.test("method--list", () { |
1775 | 1775 |
1776 var mock = new HttpServerMock(); | 1776 var mock = new HttpServerMock(); |
1777 api.ProjectsTopicsSubscriptionsResourceApi res = new api.PubsubApi(mock).p
rojects.topics.subscriptions; | 1777 api.ProjectsTopicsSubscriptionsResourceApi res = new api.PubsubApi(mock).p
rojects.topics.subscriptions; |
1778 var arg_topic = "foo"; | 1778 var arg_topic = "foo"; |
| 1779 var arg_pageToken = "foo"; |
1779 var arg_pageSize = 42; | 1780 var arg_pageSize = 42; |
1780 var arg_pageToken = "foo"; | |
1781 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 1781 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
1782 var path = (req.url).path; | 1782 var path = (req.url).path; |
1783 var pathOffset = 0; | 1783 var pathOffset = 0; |
1784 var index; | 1784 var index; |
1785 var subPart; | 1785 var subPart; |
1786 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1786 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
1787 pathOffset += 1; | 1787 pathOffset += 1; |
1788 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("v1beta2/")); | 1788 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("v1beta2/")); |
1789 pathOffset += 8; | 1789 pathOffset += 8; |
1790 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; | 1790 // NOTE: We cannot test reserved expansions due to the inability to reve
rse the operation; |
1791 | 1791 |
1792 var query = (req.url).query; | 1792 var query = (req.url).query; |
1793 var queryOffset = 0; | 1793 var queryOffset = 0; |
1794 var queryMap = {}; | 1794 var queryMap = {}; |
1795 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1795 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
1796 parseBool(n) { | 1796 parseBool(n) { |
1797 if (n == "true") return true; | 1797 if (n == "true") return true; |
1798 if (n == "false") return false; | 1798 if (n == "false") return false; |
1799 if (n == null) return null; | 1799 if (n == null) return null; |
1800 throw new core.ArgumentError("Invalid boolean: $n"); | 1800 throw new core.ArgumentError("Invalid boolean: $n"); |
1801 } | 1801 } |
1802 if (query.length > 0) { | 1802 if (query.length > 0) { |
1803 for (var part in query.split("&")) { | 1803 for (var part in query.split("&")) { |
1804 var keyvalue = part.split("="); | 1804 var keyvalue = part.split("="); |
1805 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1805 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
1806 } | 1806 } |
1807 } | 1807 } |
| 1808 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); |
1808 unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equ
als(arg_pageSize)); | 1809 unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equ
als(arg_pageSize)); |
1809 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); | |
1810 | 1810 |
1811 | 1811 |
1812 var h = { | 1812 var h = { |
1813 "content-type" : "application/json; charset=utf-8", | 1813 "content-type" : "application/json; charset=utf-8", |
1814 }; | 1814 }; |
1815 var resp = convert.JSON.encode(buildListTopicSubscriptionsResponse()); | 1815 var resp = convert.JSON.encode(buildListTopicSubscriptionsResponse()); |
1816 return new async.Future.value(stringResponse(200, h, resp)); | 1816 return new async.Future.value(stringResponse(200, h, resp)); |
1817 }), true); | 1817 }), true); |
1818 res.list(arg_topic, pageSize: arg_pageSize, pageToken: arg_pageToken).then
(unittest.expectAsync(((api.ListTopicSubscriptionsResponse response) { | 1818 res.list(arg_topic, pageToken: arg_pageToken, pageSize: arg_pageSize).then
(unittest.expectAsync(((api.ListTopicSubscriptionsResponse response) { |
1819 checkListTopicSubscriptionsResponse(response); | 1819 checkListTopicSubscriptionsResponse(response); |
1820 }))); | 1820 }))); |
1821 }); | 1821 }); |
1822 | 1822 |
1823 }); | 1823 }); |
1824 | 1824 |
1825 | 1825 |
1826 } | 1826 } |
1827 | 1827 |
OLD | NEW |