| OLD | NEW |
| 1 library googleapis_beta.pubsub.v1beta1.test; | 1 library googleapis_beta.pubsub.v1beta1.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; |
| 11 import 'package:googleapis_beta/common/common.dart' as common; | |
| 12 import 'package:googleapis_beta/src/common_internal.dart' as common_internal; | |
| 13 import '../common/common_internal_test.dart' as common_test; | |
| 14 | 11 |
| 15 import 'package:googleapis_beta/pubsub/v1beta1.dart' as api; | 12 import 'package:googleapis_beta/pubsub/v1beta1.dart' as api; |
| 16 | 13 |
| 14 class HttpServerMock extends http.BaseClient { |
| 15 core.Function _callback; |
| 16 core.bool _expectJson; |
| 17 | 17 |
| 18 void register(core.Function callback, core.bool expectJson) { |
| 19 _callback = callback; |
| 20 _expectJson = expectJson; |
| 21 } |
| 18 | 22 |
| 19 buildUnnamed1769() { | 23 async.Future<http.StreamedResponse> send(http.BaseRequest request) { |
| 24 if (_expectJson) { |
| 25 return request.finalize() |
| 26 .transform(convert.UTF8.decoder) |
| 27 .join('') |
| 28 .then((core.String jsonString) { |
| 29 if (jsonString.isEmpty) { |
| 30 return _callback(request, null); |
| 31 } else { |
| 32 return _callback(request, convert.JSON.decode(jsonString)); |
| 33 } |
| 34 }); |
| 35 } else { |
| 36 var stream = request.finalize(); |
| 37 if (stream == null) { |
| 38 return _callback(request, []); |
| 39 } else { |
| 40 return stream.toBytes().then((data) { |
| 41 return _callback(request, data); |
| 42 }); |
| 43 } |
| 44 } |
| 45 } |
| 46 } |
| 47 |
| 48 http.StreamedResponse stringResponse( |
| 49 core.int status, core.Map headers, core.String body) { |
| 50 var stream = new async.Stream.fromIterable([convert.UTF8.encode(body)]); |
| 51 return new http.StreamedResponse(stream, status, headers: headers); |
| 52 } |
| 53 |
| 54 buildUnnamed1718() { |
| 20 var o = new core.List<core.String>(); | 55 var o = new core.List<core.String>(); |
| 21 o.add("foo"); | 56 o.add("foo"); |
| 22 o.add("foo"); | 57 o.add("foo"); |
| 23 return o; | 58 return o; |
| 24 } | 59 } |
| 25 | 60 |
| 26 checkUnnamed1769(core.List<core.String> o) { | 61 checkUnnamed1718(core.List<core.String> o) { |
| 27 unittest.expect(o, unittest.hasLength(2)); | 62 unittest.expect(o, unittest.hasLength(2)); |
| 28 unittest.expect(o[0], unittest.equals('foo')); | 63 unittest.expect(o[0], unittest.equals('foo')); |
| 29 unittest.expect(o[1], unittest.equals('foo')); | 64 unittest.expect(o[1], unittest.equals('foo')); |
| 30 } | 65 } |
| 31 | 66 |
| 32 core.int buildCounterAcknowledgeRequest = 0; | 67 core.int buildCounterAcknowledgeRequest = 0; |
| 33 buildAcknowledgeRequest() { | 68 buildAcknowledgeRequest() { |
| 34 var o = new api.AcknowledgeRequest(); | 69 var o = new api.AcknowledgeRequest(); |
| 35 buildCounterAcknowledgeRequest++; | 70 buildCounterAcknowledgeRequest++; |
| 36 if (buildCounterAcknowledgeRequest < 3) { | 71 if (buildCounterAcknowledgeRequest < 3) { |
| 37 o.ackId = buildUnnamed1769(); | 72 o.ackId = buildUnnamed1718(); |
| 38 o.subscription = "foo"; | 73 o.subscription = "foo"; |
| 39 } | 74 } |
| 40 buildCounterAcknowledgeRequest--; | 75 buildCounterAcknowledgeRequest--; |
| 41 return o; | 76 return o; |
| 42 } | 77 } |
| 43 | 78 |
| 44 checkAcknowledgeRequest(api.AcknowledgeRequest o) { | 79 checkAcknowledgeRequest(api.AcknowledgeRequest o) { |
| 45 buildCounterAcknowledgeRequest++; | 80 buildCounterAcknowledgeRequest++; |
| 46 if (buildCounterAcknowledgeRequest < 3) { | 81 if (buildCounterAcknowledgeRequest < 3) { |
| 47 checkUnnamed1769(o.ackId); | 82 checkUnnamed1718(o.ackId); |
| 48 unittest.expect(o.subscription, unittest.equals('foo')); | 83 unittest.expect(o.subscription, unittest.equals('foo')); |
| 49 } | 84 } |
| 50 buildCounterAcknowledgeRequest--; | 85 buildCounterAcknowledgeRequest--; |
| 51 } | 86 } |
| 52 | 87 |
| 53 core.int buildCounterLabel = 0; | 88 core.int buildCounterLabel = 0; |
| 54 buildLabel() { | 89 buildLabel() { |
| 55 var o = new api.Label(); | 90 var o = new api.Label(); |
| 56 buildCounterLabel++; | 91 buildCounterLabel++; |
| 57 if (buildCounterLabel < 3) { | 92 if (buildCounterLabel < 3) { |
| 58 o.key = "foo"; | 93 o.key = "foo"; |
| 59 o.numValue = "foo"; | 94 o.numValue = "foo"; |
| 60 o.strValue = "foo"; | 95 o.strValue = "foo"; |
| 61 } | 96 } |
| 62 buildCounterLabel--; | 97 buildCounterLabel--; |
| 63 return o; | 98 return o; |
| 64 } | 99 } |
| 65 | 100 |
| 66 checkLabel(api.Label o) { | 101 checkLabel(api.Label o) { |
| 67 buildCounterLabel++; | 102 buildCounterLabel++; |
| 68 if (buildCounterLabel < 3) { | 103 if (buildCounterLabel < 3) { |
| 69 unittest.expect(o.key, unittest.equals('foo')); | 104 unittest.expect(o.key, unittest.equals('foo')); |
| 70 unittest.expect(o.numValue, unittest.equals('foo')); | 105 unittest.expect(o.numValue, unittest.equals('foo')); |
| 71 unittest.expect(o.strValue, unittest.equals('foo')); | 106 unittest.expect(o.strValue, unittest.equals('foo')); |
| 72 } | 107 } |
| 73 buildCounterLabel--; | 108 buildCounterLabel--; |
| 74 } | 109 } |
| 75 | 110 |
| 76 buildUnnamed1770() { | 111 buildUnnamed1719() { |
| 77 var o = new core.List<api.Subscription>(); | 112 var o = new core.List<api.Subscription>(); |
| 78 o.add(buildSubscription()); | 113 o.add(buildSubscription()); |
| 79 o.add(buildSubscription()); | 114 o.add(buildSubscription()); |
| 80 return o; | 115 return o; |
| 81 } | 116 } |
| 82 | 117 |
| 83 checkUnnamed1770(core.List<api.Subscription> o) { | 118 checkUnnamed1719(core.List<api.Subscription> o) { |
| 84 unittest.expect(o, unittest.hasLength(2)); | 119 unittest.expect(o, unittest.hasLength(2)); |
| 85 checkSubscription(o[0]); | 120 checkSubscription(o[0]); |
| 86 checkSubscription(o[1]); | 121 checkSubscription(o[1]); |
| 87 } | 122 } |
| 88 | 123 |
| 89 core.int buildCounterListSubscriptionsResponse = 0; | 124 core.int buildCounterListSubscriptionsResponse = 0; |
| 90 buildListSubscriptionsResponse() { | 125 buildListSubscriptionsResponse() { |
| 91 var o = new api.ListSubscriptionsResponse(); | 126 var o = new api.ListSubscriptionsResponse(); |
| 92 buildCounterListSubscriptionsResponse++; | 127 buildCounterListSubscriptionsResponse++; |
| 93 if (buildCounterListSubscriptionsResponse < 3) { | 128 if (buildCounterListSubscriptionsResponse < 3) { |
| 94 o.nextPageToken = "foo"; | 129 o.nextPageToken = "foo"; |
| 95 o.subscription = buildUnnamed1770(); | 130 o.subscription = buildUnnamed1719(); |
| 96 } | 131 } |
| 97 buildCounterListSubscriptionsResponse--; | 132 buildCounterListSubscriptionsResponse--; |
| 98 return o; | 133 return o; |
| 99 } | 134 } |
| 100 | 135 |
| 101 checkListSubscriptionsResponse(api.ListSubscriptionsResponse o) { | 136 checkListSubscriptionsResponse(api.ListSubscriptionsResponse o) { |
| 102 buildCounterListSubscriptionsResponse++; | 137 buildCounterListSubscriptionsResponse++; |
| 103 if (buildCounterListSubscriptionsResponse < 3) { | 138 if (buildCounterListSubscriptionsResponse < 3) { |
| 104 unittest.expect(o.nextPageToken, unittest.equals('foo')); | 139 unittest.expect(o.nextPageToken, unittest.equals('foo')); |
| 105 checkUnnamed1770(o.subscription); | 140 checkUnnamed1719(o.subscription); |
| 106 } | 141 } |
| 107 buildCounterListSubscriptionsResponse--; | 142 buildCounterListSubscriptionsResponse--; |
| 108 } | 143 } |
| 109 | 144 |
| 110 buildUnnamed1771() { | 145 buildUnnamed1720() { |
| 111 var o = new core.List<api.Topic>(); | 146 var o = new core.List<api.Topic>(); |
| 112 o.add(buildTopic()); | 147 o.add(buildTopic()); |
| 113 o.add(buildTopic()); | 148 o.add(buildTopic()); |
| 114 return o; | 149 return o; |
| 115 } | 150 } |
| 116 | 151 |
| 117 checkUnnamed1771(core.List<api.Topic> o) { | 152 checkUnnamed1720(core.List<api.Topic> o) { |
| 118 unittest.expect(o, unittest.hasLength(2)); | 153 unittest.expect(o, unittest.hasLength(2)); |
| 119 checkTopic(o[0]); | 154 checkTopic(o[0]); |
| 120 checkTopic(o[1]); | 155 checkTopic(o[1]); |
| 121 } | 156 } |
| 122 | 157 |
| 123 core.int buildCounterListTopicsResponse = 0; | 158 core.int buildCounterListTopicsResponse = 0; |
| 124 buildListTopicsResponse() { | 159 buildListTopicsResponse() { |
| 125 var o = new api.ListTopicsResponse(); | 160 var o = new api.ListTopicsResponse(); |
| 126 buildCounterListTopicsResponse++; | 161 buildCounterListTopicsResponse++; |
| 127 if (buildCounterListTopicsResponse < 3) { | 162 if (buildCounterListTopicsResponse < 3) { |
| 128 o.nextPageToken = "foo"; | 163 o.nextPageToken = "foo"; |
| 129 o.topic = buildUnnamed1771(); | 164 o.topic = buildUnnamed1720(); |
| 130 } | 165 } |
| 131 buildCounterListTopicsResponse--; | 166 buildCounterListTopicsResponse--; |
| 132 return o; | 167 return o; |
| 133 } | 168 } |
| 134 | 169 |
| 135 checkListTopicsResponse(api.ListTopicsResponse o) { | 170 checkListTopicsResponse(api.ListTopicsResponse o) { |
| 136 buildCounterListTopicsResponse++; | 171 buildCounterListTopicsResponse++; |
| 137 if (buildCounterListTopicsResponse < 3) { | 172 if (buildCounterListTopicsResponse < 3) { |
| 138 unittest.expect(o.nextPageToken, unittest.equals('foo')); | 173 unittest.expect(o.nextPageToken, unittest.equals('foo')); |
| 139 checkUnnamed1771(o.topic); | 174 checkUnnamed1720(o.topic); |
| 140 } | 175 } |
| 141 buildCounterListTopicsResponse--; | 176 buildCounterListTopicsResponse--; |
| 142 } | 177 } |
| 143 | 178 |
| 144 core.int buildCounterModifyAckDeadlineRequest = 0; | 179 core.int buildCounterModifyAckDeadlineRequest = 0; |
| 145 buildModifyAckDeadlineRequest() { | 180 buildModifyAckDeadlineRequest() { |
| 146 var o = new api.ModifyAckDeadlineRequest(); | 181 var o = new api.ModifyAckDeadlineRequest(); |
| 147 buildCounterModifyAckDeadlineRequest++; | 182 buildCounterModifyAckDeadlineRequest++; |
| 148 if (buildCounterModifyAckDeadlineRequest < 3) { | 183 if (buildCounterModifyAckDeadlineRequest < 3) { |
| 149 o.ackDeadlineSeconds = 42; | 184 o.ackDeadlineSeconds = 42; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 178 | 213 |
| 179 checkModifyPushConfigRequest(api.ModifyPushConfigRequest o) { | 214 checkModifyPushConfigRequest(api.ModifyPushConfigRequest o) { |
| 180 buildCounterModifyPushConfigRequest++; | 215 buildCounterModifyPushConfigRequest++; |
| 181 if (buildCounterModifyPushConfigRequest < 3) { | 216 if (buildCounterModifyPushConfigRequest < 3) { |
| 182 checkPushConfig(o.pushConfig); | 217 checkPushConfig(o.pushConfig); |
| 183 unittest.expect(o.subscription, unittest.equals('foo')); | 218 unittest.expect(o.subscription, unittest.equals('foo')); |
| 184 } | 219 } |
| 185 buildCounterModifyPushConfigRequest--; | 220 buildCounterModifyPushConfigRequest--; |
| 186 } | 221 } |
| 187 | 222 |
| 188 buildUnnamed1772() { | 223 buildUnnamed1721() { |
| 189 var o = new core.List<api.PubsubMessage>(); | 224 var o = new core.List<api.PubsubMessage>(); |
| 190 o.add(buildPubsubMessage()); | 225 o.add(buildPubsubMessage()); |
| 191 o.add(buildPubsubMessage()); | 226 o.add(buildPubsubMessage()); |
| 192 return o; | 227 return o; |
| 193 } | 228 } |
| 194 | 229 |
| 195 checkUnnamed1772(core.List<api.PubsubMessage> o) { | 230 checkUnnamed1721(core.List<api.PubsubMessage> o) { |
| 196 unittest.expect(o, unittest.hasLength(2)); | 231 unittest.expect(o, unittest.hasLength(2)); |
| 197 checkPubsubMessage(o[0]); | 232 checkPubsubMessage(o[0]); |
| 198 checkPubsubMessage(o[1]); | 233 checkPubsubMessage(o[1]); |
| 199 } | 234 } |
| 200 | 235 |
| 201 core.int buildCounterPublishBatchRequest = 0; | 236 core.int buildCounterPublishBatchRequest = 0; |
| 202 buildPublishBatchRequest() { | 237 buildPublishBatchRequest() { |
| 203 var o = new api.PublishBatchRequest(); | 238 var o = new api.PublishBatchRequest(); |
| 204 buildCounterPublishBatchRequest++; | 239 buildCounterPublishBatchRequest++; |
| 205 if (buildCounterPublishBatchRequest < 3) { | 240 if (buildCounterPublishBatchRequest < 3) { |
| 206 o.messages = buildUnnamed1772(); | 241 o.messages = buildUnnamed1721(); |
| 207 o.topic = "foo"; | 242 o.topic = "foo"; |
| 208 } | 243 } |
| 209 buildCounterPublishBatchRequest--; | 244 buildCounterPublishBatchRequest--; |
| 210 return o; | 245 return o; |
| 211 } | 246 } |
| 212 | 247 |
| 213 checkPublishBatchRequest(api.PublishBatchRequest o) { | 248 checkPublishBatchRequest(api.PublishBatchRequest o) { |
| 214 buildCounterPublishBatchRequest++; | 249 buildCounterPublishBatchRequest++; |
| 215 if (buildCounterPublishBatchRequest < 3) { | 250 if (buildCounterPublishBatchRequest < 3) { |
| 216 checkUnnamed1772(o.messages); | 251 checkUnnamed1721(o.messages); |
| 217 unittest.expect(o.topic, unittest.equals('foo')); | 252 unittest.expect(o.topic, unittest.equals('foo')); |
| 218 } | 253 } |
| 219 buildCounterPublishBatchRequest--; | 254 buildCounterPublishBatchRequest--; |
| 220 } | 255 } |
| 221 | 256 |
| 222 buildUnnamed1773() { | 257 buildUnnamed1722() { |
| 223 var o = new core.List<core.String>(); | 258 var o = new core.List<core.String>(); |
| 224 o.add("foo"); | 259 o.add("foo"); |
| 225 o.add("foo"); | 260 o.add("foo"); |
| 226 return o; | 261 return o; |
| 227 } | 262 } |
| 228 | 263 |
| 229 checkUnnamed1773(core.List<core.String> o) { | 264 checkUnnamed1722(core.List<core.String> o) { |
| 230 unittest.expect(o, unittest.hasLength(2)); | 265 unittest.expect(o, unittest.hasLength(2)); |
| 231 unittest.expect(o[0], unittest.equals('foo')); | 266 unittest.expect(o[0], unittest.equals('foo')); |
| 232 unittest.expect(o[1], unittest.equals('foo')); | 267 unittest.expect(o[1], unittest.equals('foo')); |
| 233 } | 268 } |
| 234 | 269 |
| 235 core.int buildCounterPublishBatchResponse = 0; | 270 core.int buildCounterPublishBatchResponse = 0; |
| 236 buildPublishBatchResponse() { | 271 buildPublishBatchResponse() { |
| 237 var o = new api.PublishBatchResponse(); | 272 var o = new api.PublishBatchResponse(); |
| 238 buildCounterPublishBatchResponse++; | 273 buildCounterPublishBatchResponse++; |
| 239 if (buildCounterPublishBatchResponse < 3) { | 274 if (buildCounterPublishBatchResponse < 3) { |
| 240 o.messageIds = buildUnnamed1773(); | 275 o.messageIds = buildUnnamed1722(); |
| 241 } | 276 } |
| 242 buildCounterPublishBatchResponse--; | 277 buildCounterPublishBatchResponse--; |
| 243 return o; | 278 return o; |
| 244 } | 279 } |
| 245 | 280 |
| 246 checkPublishBatchResponse(api.PublishBatchResponse o) { | 281 checkPublishBatchResponse(api.PublishBatchResponse o) { |
| 247 buildCounterPublishBatchResponse++; | 282 buildCounterPublishBatchResponse++; |
| 248 if (buildCounterPublishBatchResponse < 3) { | 283 if (buildCounterPublishBatchResponse < 3) { |
| 249 checkUnnamed1773(o.messageIds); | 284 checkUnnamed1722(o.messageIds); |
| 250 } | 285 } |
| 251 buildCounterPublishBatchResponse--; | 286 buildCounterPublishBatchResponse--; |
| 252 } | 287 } |
| 253 | 288 |
| 254 core.int buildCounterPublishRequest = 0; | 289 core.int buildCounterPublishRequest = 0; |
| 255 buildPublishRequest() { | 290 buildPublishRequest() { |
| 256 var o = new api.PublishRequest(); | 291 var o = new api.PublishRequest(); |
| 257 buildCounterPublishRequest++; | 292 buildCounterPublishRequest++; |
| 258 if (buildCounterPublishRequest < 3) { | 293 if (buildCounterPublishRequest < 3) { |
| 259 o.message = buildPubsubMessage(); | 294 o.message = buildPubsubMessage(); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 290 buildCounterPubsubEvent++; | 325 buildCounterPubsubEvent++; |
| 291 if (buildCounterPubsubEvent < 3) { | 326 if (buildCounterPubsubEvent < 3) { |
| 292 unittest.expect(o.deleted, unittest.isTrue); | 327 unittest.expect(o.deleted, unittest.isTrue); |
| 293 checkPubsubMessage(o.message); | 328 checkPubsubMessage(o.message); |
| 294 unittest.expect(o.subscription, unittest.equals('foo')); | 329 unittest.expect(o.subscription, unittest.equals('foo')); |
| 295 unittest.expect(o.truncated, unittest.isTrue); | 330 unittest.expect(o.truncated, unittest.isTrue); |
| 296 } | 331 } |
| 297 buildCounterPubsubEvent--; | 332 buildCounterPubsubEvent--; |
| 298 } | 333 } |
| 299 | 334 |
| 300 buildUnnamed1774() { | 335 buildUnnamed1723() { |
| 301 var o = new core.List<api.Label>(); | 336 var o = new core.List<api.Label>(); |
| 302 o.add(buildLabel()); | 337 o.add(buildLabel()); |
| 303 o.add(buildLabel()); | 338 o.add(buildLabel()); |
| 304 return o; | 339 return o; |
| 305 } | 340 } |
| 306 | 341 |
| 307 checkUnnamed1774(core.List<api.Label> o) { | 342 checkUnnamed1723(core.List<api.Label> o) { |
| 308 unittest.expect(o, unittest.hasLength(2)); | 343 unittest.expect(o, unittest.hasLength(2)); |
| 309 checkLabel(o[0]); | 344 checkLabel(o[0]); |
| 310 checkLabel(o[1]); | 345 checkLabel(o[1]); |
| 311 } | 346 } |
| 312 | 347 |
| 313 core.int buildCounterPubsubMessage = 0; | 348 core.int buildCounterPubsubMessage = 0; |
| 314 buildPubsubMessage() { | 349 buildPubsubMessage() { |
| 315 var o = new api.PubsubMessage(); | 350 var o = new api.PubsubMessage(); |
| 316 buildCounterPubsubMessage++; | 351 buildCounterPubsubMessage++; |
| 317 if (buildCounterPubsubMessage < 3) { | 352 if (buildCounterPubsubMessage < 3) { |
| 318 o.data = "foo"; | 353 o.data = "foo"; |
| 319 o.label = buildUnnamed1774(); | 354 o.label = buildUnnamed1723(); |
| 320 o.messageId = "foo"; | 355 o.messageId = "foo"; |
| 321 } | 356 } |
| 322 buildCounterPubsubMessage--; | 357 buildCounterPubsubMessage--; |
| 323 return o; | 358 return o; |
| 324 } | 359 } |
| 325 | 360 |
| 326 checkPubsubMessage(api.PubsubMessage o) { | 361 checkPubsubMessage(api.PubsubMessage o) { |
| 327 buildCounterPubsubMessage++; | 362 buildCounterPubsubMessage++; |
| 328 if (buildCounterPubsubMessage < 3) { | 363 if (buildCounterPubsubMessage < 3) { |
| 329 unittest.expect(o.data, unittest.equals('foo')); | 364 unittest.expect(o.data, unittest.equals('foo')); |
| 330 checkUnnamed1774(o.label); | 365 checkUnnamed1723(o.label); |
| 331 unittest.expect(o.messageId, unittest.equals('foo')); | 366 unittest.expect(o.messageId, unittest.equals('foo')); |
| 332 } | 367 } |
| 333 buildCounterPubsubMessage--; | 368 buildCounterPubsubMessage--; |
| 334 } | 369 } |
| 335 | 370 |
| 336 core.int buildCounterPullBatchRequest = 0; | 371 core.int buildCounterPullBatchRequest = 0; |
| 337 buildPullBatchRequest() { | 372 buildPullBatchRequest() { |
| 338 var o = new api.PullBatchRequest(); | 373 var o = new api.PullBatchRequest(); |
| 339 buildCounterPullBatchRequest++; | 374 buildCounterPullBatchRequest++; |
| 340 if (buildCounterPullBatchRequest < 3) { | 375 if (buildCounterPullBatchRequest < 3) { |
| 341 o.maxEvents = 42; | 376 o.maxEvents = 42; |
| 342 o.returnImmediately = true; | 377 o.returnImmediately = true; |
| 343 o.subscription = "foo"; | 378 o.subscription = "foo"; |
| 344 } | 379 } |
| 345 buildCounterPullBatchRequest--; | 380 buildCounterPullBatchRequest--; |
| 346 return o; | 381 return o; |
| 347 } | 382 } |
| 348 | 383 |
| 349 checkPullBatchRequest(api.PullBatchRequest o) { | 384 checkPullBatchRequest(api.PullBatchRequest o) { |
| 350 buildCounterPullBatchRequest++; | 385 buildCounterPullBatchRequest++; |
| 351 if (buildCounterPullBatchRequest < 3) { | 386 if (buildCounterPullBatchRequest < 3) { |
| 352 unittest.expect(o.maxEvents, unittest.equals(42)); | 387 unittest.expect(o.maxEvents, unittest.equals(42)); |
| 353 unittest.expect(o.returnImmediately, unittest.isTrue); | 388 unittest.expect(o.returnImmediately, unittest.isTrue); |
| 354 unittest.expect(o.subscription, unittest.equals('foo')); | 389 unittest.expect(o.subscription, unittest.equals('foo')); |
| 355 } | 390 } |
| 356 buildCounterPullBatchRequest--; | 391 buildCounterPullBatchRequest--; |
| 357 } | 392 } |
| 358 | 393 |
| 359 buildUnnamed1775() { | 394 buildUnnamed1724() { |
| 360 var o = new core.List<api.PullResponse>(); | 395 var o = new core.List<api.PullResponse>(); |
| 361 o.add(buildPullResponse()); | 396 o.add(buildPullResponse()); |
| 362 o.add(buildPullResponse()); | 397 o.add(buildPullResponse()); |
| 363 return o; | 398 return o; |
| 364 } | 399 } |
| 365 | 400 |
| 366 checkUnnamed1775(core.List<api.PullResponse> o) { | 401 checkUnnamed1724(core.List<api.PullResponse> o) { |
| 367 unittest.expect(o, unittest.hasLength(2)); | 402 unittest.expect(o, unittest.hasLength(2)); |
| 368 checkPullResponse(o[0]); | 403 checkPullResponse(o[0]); |
| 369 checkPullResponse(o[1]); | 404 checkPullResponse(o[1]); |
| 370 } | 405 } |
| 371 | 406 |
| 372 core.int buildCounterPullBatchResponse = 0; | 407 core.int buildCounterPullBatchResponse = 0; |
| 373 buildPullBatchResponse() { | 408 buildPullBatchResponse() { |
| 374 var o = new api.PullBatchResponse(); | 409 var o = new api.PullBatchResponse(); |
| 375 buildCounterPullBatchResponse++; | 410 buildCounterPullBatchResponse++; |
| 376 if (buildCounterPullBatchResponse < 3) { | 411 if (buildCounterPullBatchResponse < 3) { |
| 377 o.pullResponses = buildUnnamed1775(); | 412 o.pullResponses = buildUnnamed1724(); |
| 378 } | 413 } |
| 379 buildCounterPullBatchResponse--; | 414 buildCounterPullBatchResponse--; |
| 380 return o; | 415 return o; |
| 381 } | 416 } |
| 382 | 417 |
| 383 checkPullBatchResponse(api.PullBatchResponse o) { | 418 checkPullBatchResponse(api.PullBatchResponse o) { |
| 384 buildCounterPullBatchResponse++; | 419 buildCounterPullBatchResponse++; |
| 385 if (buildCounterPullBatchResponse < 3) { | 420 if (buildCounterPullBatchResponse < 3) { |
| 386 checkUnnamed1775(o.pullResponses); | 421 checkUnnamed1724(o.pullResponses); |
| 387 } | 422 } |
| 388 buildCounterPullBatchResponse--; | 423 buildCounterPullBatchResponse--; |
| 389 } | 424 } |
| 390 | 425 |
| 391 core.int buildCounterPullRequest = 0; | 426 core.int buildCounterPullRequest = 0; |
| 392 buildPullRequest() { | 427 buildPullRequest() { |
| 393 var o = new api.PullRequest(); | 428 var o = new api.PullRequest(); |
| 394 buildCounterPullRequest++; | 429 buildCounterPullRequest++; |
| 395 if (buildCounterPullRequest < 3) { | 430 if (buildCounterPullRequest < 3) { |
| 396 o.returnImmediately = true; | 431 o.returnImmediately = true; |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 653 var o = buildTopic(); | 688 var o = buildTopic(); |
| 654 var od = new api.Topic.fromJson(o.toJson()); | 689 var od = new api.Topic.fromJson(o.toJson()); |
| 655 checkTopic(od); | 690 checkTopic(od); |
| 656 }); | 691 }); |
| 657 }); | 692 }); |
| 658 | 693 |
| 659 | 694 |
| 660 unittest.group("resource-SubscriptionsResourceApi", () { | 695 unittest.group("resource-SubscriptionsResourceApi", () { |
| 661 unittest.test("method--acknowledge", () { | 696 unittest.test("method--acknowledge", () { |
| 662 | 697 |
| 663 var mock = new common_test.HttpServerMock(); | 698 var mock = new HttpServerMock(); |
| 664 api.SubscriptionsResourceApi res = new api.PubsubApi(mock).subscriptions; | 699 api.SubscriptionsResourceApi res = new api.PubsubApi(mock).subscriptions; |
| 665 var arg_request = buildAcknowledgeRequest(); | 700 var arg_request = buildAcknowledgeRequest(); |
| 666 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 701 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 667 var obj = new api.AcknowledgeRequest.fromJson(json); | 702 var obj = new api.AcknowledgeRequest.fromJson(json); |
| 668 checkAcknowledgeRequest(obj); | 703 checkAcknowledgeRequest(obj); |
| 669 | 704 |
| 670 var path = (req.url).path; | 705 var path = (req.url).path; |
| 671 var pathOffset = 0; | 706 var pathOffset = 0; |
| 672 var index; | 707 var index; |
| 673 var subPart; | 708 var subPart; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 693 var keyvalue = part.split("="); | 728 var keyvalue = part.split("="); |
| 694 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 729 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 695 } | 730 } |
| 696 } | 731 } |
| 697 | 732 |
| 698 | 733 |
| 699 var h = { | 734 var h = { |
| 700 "content-type" : "application/json; charset=utf-8", | 735 "content-type" : "application/json; charset=utf-8", |
| 701 }; | 736 }; |
| 702 var resp = ""; | 737 var resp = ""; |
| 703 return new async.Future.value(common_test.stringResponse(200, h, resp)); | 738 return new async.Future.value(stringResponse(200, h, resp)); |
| 704 }), true); | 739 }), true); |
| 705 res.acknowledge(arg_request).then(unittest.expectAsync((_) {})); | 740 res.acknowledge(arg_request).then(unittest.expectAsync((_) {})); |
| 706 }); | 741 }); |
| 707 | 742 |
| 708 unittest.test("method--create", () { | 743 unittest.test("method--create", () { |
| 709 | 744 |
| 710 var mock = new common_test.HttpServerMock(); | 745 var mock = new HttpServerMock(); |
| 711 api.SubscriptionsResourceApi res = new api.PubsubApi(mock).subscriptions; | 746 api.SubscriptionsResourceApi res = new api.PubsubApi(mock).subscriptions; |
| 712 var arg_request = buildSubscription(); | 747 var arg_request = buildSubscription(); |
| 713 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 748 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 714 var obj = new api.Subscription.fromJson(json); | 749 var obj = new api.Subscription.fromJson(json); |
| 715 checkSubscription(obj); | 750 checkSubscription(obj); |
| 716 | 751 |
| 717 var path = (req.url).path; | 752 var path = (req.url).path; |
| 718 var pathOffset = 0; | 753 var pathOffset = 0; |
| 719 var index; | 754 var index; |
| 720 var subPart; | 755 var subPart; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 740 var keyvalue = part.split("="); | 775 var keyvalue = part.split("="); |
| 741 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 776 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 742 } | 777 } |
| 743 } | 778 } |
| 744 | 779 |
| 745 | 780 |
| 746 var h = { | 781 var h = { |
| 747 "content-type" : "application/json; charset=utf-8", | 782 "content-type" : "application/json; charset=utf-8", |
| 748 }; | 783 }; |
| 749 var resp = convert.JSON.encode(buildSubscription()); | 784 var resp = convert.JSON.encode(buildSubscription()); |
| 750 return new async.Future.value(common_test.stringResponse(200, h, resp)); | 785 return new async.Future.value(stringResponse(200, h, resp)); |
| 751 }), true); | 786 }), true); |
| 752 res.create(arg_request).then(unittest.expectAsync(((api.Subscription respo
nse) { | 787 res.create(arg_request).then(unittest.expectAsync(((api.Subscription respo
nse) { |
| 753 checkSubscription(response); | 788 checkSubscription(response); |
| 754 }))); | 789 }))); |
| 755 }); | 790 }); |
| 756 | 791 |
| 757 unittest.test("method--delete", () { | 792 unittest.test("method--delete", () { |
| 758 | 793 |
| 759 var mock = new common_test.HttpServerMock(); | 794 var mock = new HttpServerMock(); |
| 760 api.SubscriptionsResourceApi res = new api.PubsubApi(mock).subscriptions; | 795 api.SubscriptionsResourceApi res = new api.PubsubApi(mock).subscriptions; |
| 761 var arg_subscription = "foo"; | 796 var arg_subscription = "foo"; |
| 762 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 797 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 763 var path = (req.url).path; | 798 var path = (req.url).path; |
| 764 var pathOffset = 0; | 799 var pathOffset = 0; |
| 765 var index; | 800 var index; |
| 766 var subPart; | 801 var subPart; |
| 767 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 802 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 768 pathOffset += 1; | 803 pathOffset += 1; |
| 769 unittest.expect(path.substring(pathOffset, pathOffset + 15), unittest.eq
uals("pubsub/v1beta1/")); | 804 unittest.expect(path.substring(pathOffset, pathOffset + 15), unittest.eq
uals("pubsub/v1beta1/")); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 787 var keyvalue = part.split("="); | 822 var keyvalue = part.split("="); |
| 788 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 823 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 789 } | 824 } |
| 790 } | 825 } |
| 791 | 826 |
| 792 | 827 |
| 793 var h = { | 828 var h = { |
| 794 "content-type" : "application/json; charset=utf-8", | 829 "content-type" : "application/json; charset=utf-8", |
| 795 }; | 830 }; |
| 796 var resp = ""; | 831 var resp = ""; |
| 797 return new async.Future.value(common_test.stringResponse(200, h, resp)); | 832 return new async.Future.value(stringResponse(200, h, resp)); |
| 798 }), true); | 833 }), true); |
| 799 res.delete(arg_subscription).then(unittest.expectAsync((_) {})); | 834 res.delete(arg_subscription).then(unittest.expectAsync((_) {})); |
| 800 }); | 835 }); |
| 801 | 836 |
| 802 unittest.test("method--get", () { | 837 unittest.test("method--get", () { |
| 803 | 838 |
| 804 var mock = new common_test.HttpServerMock(); | 839 var mock = new HttpServerMock(); |
| 805 api.SubscriptionsResourceApi res = new api.PubsubApi(mock).subscriptions; | 840 api.SubscriptionsResourceApi res = new api.PubsubApi(mock).subscriptions; |
| 806 var arg_subscription = "foo"; | 841 var arg_subscription = "foo"; |
| 807 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 842 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 808 var path = (req.url).path; | 843 var path = (req.url).path; |
| 809 var pathOffset = 0; | 844 var pathOffset = 0; |
| 810 var index; | 845 var index; |
| 811 var subPart; | 846 var subPart; |
| 812 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 847 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 813 pathOffset += 1; | 848 pathOffset += 1; |
| 814 unittest.expect(path.substring(pathOffset, pathOffset + 15), unittest.eq
uals("pubsub/v1beta1/")); | 849 unittest.expect(path.substring(pathOffset, pathOffset + 15), unittest.eq
uals("pubsub/v1beta1/")); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 832 var keyvalue = part.split("="); | 867 var keyvalue = part.split("="); |
| 833 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 868 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 834 } | 869 } |
| 835 } | 870 } |
| 836 | 871 |
| 837 | 872 |
| 838 var h = { | 873 var h = { |
| 839 "content-type" : "application/json; charset=utf-8", | 874 "content-type" : "application/json; charset=utf-8", |
| 840 }; | 875 }; |
| 841 var resp = convert.JSON.encode(buildSubscription()); | 876 var resp = convert.JSON.encode(buildSubscription()); |
| 842 return new async.Future.value(common_test.stringResponse(200, h, resp)); | 877 return new async.Future.value(stringResponse(200, h, resp)); |
| 843 }), true); | 878 }), true); |
| 844 res.get(arg_subscription).then(unittest.expectAsync(((api.Subscription res
ponse) { | 879 res.get(arg_subscription).then(unittest.expectAsync(((api.Subscription res
ponse) { |
| 845 checkSubscription(response); | 880 checkSubscription(response); |
| 846 }))); | 881 }))); |
| 847 }); | 882 }); |
| 848 | 883 |
| 849 unittest.test("method--list", () { | 884 unittest.test("method--list", () { |
| 850 | 885 |
| 851 var mock = new common_test.HttpServerMock(); | 886 var mock = new HttpServerMock(); |
| 852 api.SubscriptionsResourceApi res = new api.PubsubApi(mock).subscriptions; | 887 api.SubscriptionsResourceApi res = new api.PubsubApi(mock).subscriptions; |
| 853 var arg_maxResults = 42; | 888 var arg_maxResults = 42; |
| 854 var arg_pageToken = "foo"; | 889 var arg_pageToken = "foo"; |
| 855 var arg_query = "foo"; | 890 var arg_query = "foo"; |
| 856 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 891 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 857 var path = (req.url).path; | 892 var path = (req.url).path; |
| 858 var pathOffset = 0; | 893 var pathOffset = 0; |
| 859 var index; | 894 var index; |
| 860 var subPart; | 895 var subPart; |
| 861 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 896 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 883 } | 918 } |
| 884 unittest.expect(core.int.parse(queryMap["maxResults"].first), unittest.e
quals(arg_maxResults)); | 919 unittest.expect(core.int.parse(queryMap["maxResults"].first), unittest.e
quals(arg_maxResults)); |
| 885 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); | 920 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); |
| 886 unittest.expect(queryMap["query"].first, unittest.equals(arg_query)); | 921 unittest.expect(queryMap["query"].first, unittest.equals(arg_query)); |
| 887 | 922 |
| 888 | 923 |
| 889 var h = { | 924 var h = { |
| 890 "content-type" : "application/json; charset=utf-8", | 925 "content-type" : "application/json; charset=utf-8", |
| 891 }; | 926 }; |
| 892 var resp = convert.JSON.encode(buildListSubscriptionsResponse()); | 927 var resp = convert.JSON.encode(buildListSubscriptionsResponse()); |
| 893 return new async.Future.value(common_test.stringResponse(200, h, resp)); | 928 return new async.Future.value(stringResponse(200, h, resp)); |
| 894 }), true); | 929 }), true); |
| 895 res.list(maxResults: arg_maxResults, pageToken: arg_pageToken, query: arg_
query).then(unittest.expectAsync(((api.ListSubscriptionsResponse response) { | 930 res.list(maxResults: arg_maxResults, pageToken: arg_pageToken, query: arg_
query).then(unittest.expectAsync(((api.ListSubscriptionsResponse response) { |
| 896 checkListSubscriptionsResponse(response); | 931 checkListSubscriptionsResponse(response); |
| 897 }))); | 932 }))); |
| 898 }); | 933 }); |
| 899 | 934 |
| 900 unittest.test("method--modifyAckDeadline", () { | 935 unittest.test("method--modifyAckDeadline", () { |
| 901 | 936 |
| 902 var mock = new common_test.HttpServerMock(); | 937 var mock = new HttpServerMock(); |
| 903 api.SubscriptionsResourceApi res = new api.PubsubApi(mock).subscriptions; | 938 api.SubscriptionsResourceApi res = new api.PubsubApi(mock).subscriptions; |
| 904 var arg_request = buildModifyAckDeadlineRequest(); | 939 var arg_request = buildModifyAckDeadlineRequest(); |
| 905 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 940 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 906 var obj = new api.ModifyAckDeadlineRequest.fromJson(json); | 941 var obj = new api.ModifyAckDeadlineRequest.fromJson(json); |
| 907 checkModifyAckDeadlineRequest(obj); | 942 checkModifyAckDeadlineRequest(obj); |
| 908 | 943 |
| 909 var path = (req.url).path; | 944 var path = (req.url).path; |
| 910 var pathOffset = 0; | 945 var pathOffset = 0; |
| 911 var index; | 946 var index; |
| 912 var subPart; | 947 var subPart; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 932 var keyvalue = part.split("="); | 967 var keyvalue = part.split("="); |
| 933 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 968 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 934 } | 969 } |
| 935 } | 970 } |
| 936 | 971 |
| 937 | 972 |
| 938 var h = { | 973 var h = { |
| 939 "content-type" : "application/json; charset=utf-8", | 974 "content-type" : "application/json; charset=utf-8", |
| 940 }; | 975 }; |
| 941 var resp = ""; | 976 var resp = ""; |
| 942 return new async.Future.value(common_test.stringResponse(200, h, resp)); | 977 return new async.Future.value(stringResponse(200, h, resp)); |
| 943 }), true); | 978 }), true); |
| 944 res.modifyAckDeadline(arg_request).then(unittest.expectAsync((_) {})); | 979 res.modifyAckDeadline(arg_request).then(unittest.expectAsync((_) {})); |
| 945 }); | 980 }); |
| 946 | 981 |
| 947 unittest.test("method--modifyPushConfig", () { | 982 unittest.test("method--modifyPushConfig", () { |
| 948 | 983 |
| 949 var mock = new common_test.HttpServerMock(); | 984 var mock = new HttpServerMock(); |
| 950 api.SubscriptionsResourceApi res = new api.PubsubApi(mock).subscriptions; | 985 api.SubscriptionsResourceApi res = new api.PubsubApi(mock).subscriptions; |
| 951 var arg_request = buildModifyPushConfigRequest(); | 986 var arg_request = buildModifyPushConfigRequest(); |
| 952 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 987 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 953 var obj = new api.ModifyPushConfigRequest.fromJson(json); | 988 var obj = new api.ModifyPushConfigRequest.fromJson(json); |
| 954 checkModifyPushConfigRequest(obj); | 989 checkModifyPushConfigRequest(obj); |
| 955 | 990 |
| 956 var path = (req.url).path; | 991 var path = (req.url).path; |
| 957 var pathOffset = 0; | 992 var pathOffset = 0; |
| 958 var index; | 993 var index; |
| 959 var subPart; | 994 var subPart; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 979 var keyvalue = part.split("="); | 1014 var keyvalue = part.split("="); |
| 980 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1015 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 981 } | 1016 } |
| 982 } | 1017 } |
| 983 | 1018 |
| 984 | 1019 |
| 985 var h = { | 1020 var h = { |
| 986 "content-type" : "application/json; charset=utf-8", | 1021 "content-type" : "application/json; charset=utf-8", |
| 987 }; | 1022 }; |
| 988 var resp = ""; | 1023 var resp = ""; |
| 989 return new async.Future.value(common_test.stringResponse(200, h, resp)); | 1024 return new async.Future.value(stringResponse(200, h, resp)); |
| 990 }), true); | 1025 }), true); |
| 991 res.modifyPushConfig(arg_request).then(unittest.expectAsync((_) {})); | 1026 res.modifyPushConfig(arg_request).then(unittest.expectAsync((_) {})); |
| 992 }); | 1027 }); |
| 993 | 1028 |
| 994 unittest.test("method--pull", () { | 1029 unittest.test("method--pull", () { |
| 995 | 1030 |
| 996 var mock = new common_test.HttpServerMock(); | 1031 var mock = new HttpServerMock(); |
| 997 api.SubscriptionsResourceApi res = new api.PubsubApi(mock).subscriptions; | 1032 api.SubscriptionsResourceApi res = new api.PubsubApi(mock).subscriptions; |
| 998 var arg_request = buildPullRequest(); | 1033 var arg_request = buildPullRequest(); |
| 999 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 1034 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1000 var obj = new api.PullRequest.fromJson(json); | 1035 var obj = new api.PullRequest.fromJson(json); |
| 1001 checkPullRequest(obj); | 1036 checkPullRequest(obj); |
| 1002 | 1037 |
| 1003 var path = (req.url).path; | 1038 var path = (req.url).path; |
| 1004 var pathOffset = 0; | 1039 var pathOffset = 0; |
| 1005 var index; | 1040 var index; |
| 1006 var subPart; | 1041 var subPart; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1026 var keyvalue = part.split("="); | 1061 var keyvalue = part.split("="); |
| 1027 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1062 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1028 } | 1063 } |
| 1029 } | 1064 } |
| 1030 | 1065 |
| 1031 | 1066 |
| 1032 var h = { | 1067 var h = { |
| 1033 "content-type" : "application/json; charset=utf-8", | 1068 "content-type" : "application/json; charset=utf-8", |
| 1034 }; | 1069 }; |
| 1035 var resp = convert.JSON.encode(buildPullResponse()); | 1070 var resp = convert.JSON.encode(buildPullResponse()); |
| 1036 return new async.Future.value(common_test.stringResponse(200, h, resp)); | 1071 return new async.Future.value(stringResponse(200, h, resp)); |
| 1037 }), true); | 1072 }), true); |
| 1038 res.pull(arg_request).then(unittest.expectAsync(((api.PullResponse respons
e) { | 1073 res.pull(arg_request).then(unittest.expectAsync(((api.PullResponse respons
e) { |
| 1039 checkPullResponse(response); | 1074 checkPullResponse(response); |
| 1040 }))); | 1075 }))); |
| 1041 }); | 1076 }); |
| 1042 | 1077 |
| 1043 unittest.test("method--pullBatch", () { | 1078 unittest.test("method--pullBatch", () { |
| 1044 | 1079 |
| 1045 var mock = new common_test.HttpServerMock(); | 1080 var mock = new HttpServerMock(); |
| 1046 api.SubscriptionsResourceApi res = new api.PubsubApi(mock).subscriptions; | 1081 api.SubscriptionsResourceApi res = new api.PubsubApi(mock).subscriptions; |
| 1047 var arg_request = buildPullBatchRequest(); | 1082 var arg_request = buildPullBatchRequest(); |
| 1048 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 1083 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1049 var obj = new api.PullBatchRequest.fromJson(json); | 1084 var obj = new api.PullBatchRequest.fromJson(json); |
| 1050 checkPullBatchRequest(obj); | 1085 checkPullBatchRequest(obj); |
| 1051 | 1086 |
| 1052 var path = (req.url).path; | 1087 var path = (req.url).path; |
| 1053 var pathOffset = 0; | 1088 var pathOffset = 0; |
| 1054 var index; | 1089 var index; |
| 1055 var subPart; | 1090 var subPart; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1075 var keyvalue = part.split("="); | 1110 var keyvalue = part.split("="); |
| 1076 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1111 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1077 } | 1112 } |
| 1078 } | 1113 } |
| 1079 | 1114 |
| 1080 | 1115 |
| 1081 var h = { | 1116 var h = { |
| 1082 "content-type" : "application/json; charset=utf-8", | 1117 "content-type" : "application/json; charset=utf-8", |
| 1083 }; | 1118 }; |
| 1084 var resp = convert.JSON.encode(buildPullBatchResponse()); | 1119 var resp = convert.JSON.encode(buildPullBatchResponse()); |
| 1085 return new async.Future.value(common_test.stringResponse(200, h, resp)); | 1120 return new async.Future.value(stringResponse(200, h, resp)); |
| 1086 }), true); | 1121 }), true); |
| 1087 res.pullBatch(arg_request).then(unittest.expectAsync(((api.PullBatchRespon
se response) { | 1122 res.pullBatch(arg_request).then(unittest.expectAsync(((api.PullBatchRespon
se response) { |
| 1088 checkPullBatchResponse(response); | 1123 checkPullBatchResponse(response); |
| 1089 }))); | 1124 }))); |
| 1090 }); | 1125 }); |
| 1091 | 1126 |
| 1092 }); | 1127 }); |
| 1093 | 1128 |
| 1094 | 1129 |
| 1095 unittest.group("resource-TopicsResourceApi", () { | 1130 unittest.group("resource-TopicsResourceApi", () { |
| 1096 unittest.test("method--create", () { | 1131 unittest.test("method--create", () { |
| 1097 | 1132 |
| 1098 var mock = new common_test.HttpServerMock(); | 1133 var mock = new HttpServerMock(); |
| 1099 api.TopicsResourceApi res = new api.PubsubApi(mock).topics; | 1134 api.TopicsResourceApi res = new api.PubsubApi(mock).topics; |
| 1100 var arg_request = buildTopic(); | 1135 var arg_request = buildTopic(); |
| 1101 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 1136 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1102 var obj = new api.Topic.fromJson(json); | 1137 var obj = new api.Topic.fromJson(json); |
| 1103 checkTopic(obj); | 1138 checkTopic(obj); |
| 1104 | 1139 |
| 1105 var path = (req.url).path; | 1140 var path = (req.url).path; |
| 1106 var pathOffset = 0; | 1141 var pathOffset = 0; |
| 1107 var index; | 1142 var index; |
| 1108 var subPart; | 1143 var subPart; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1128 var keyvalue = part.split("="); | 1163 var keyvalue = part.split("="); |
| 1129 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1164 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1130 } | 1165 } |
| 1131 } | 1166 } |
| 1132 | 1167 |
| 1133 | 1168 |
| 1134 var h = { | 1169 var h = { |
| 1135 "content-type" : "application/json; charset=utf-8", | 1170 "content-type" : "application/json; charset=utf-8", |
| 1136 }; | 1171 }; |
| 1137 var resp = convert.JSON.encode(buildTopic()); | 1172 var resp = convert.JSON.encode(buildTopic()); |
| 1138 return new async.Future.value(common_test.stringResponse(200, h, resp)); | 1173 return new async.Future.value(stringResponse(200, h, resp)); |
| 1139 }), true); | 1174 }), true); |
| 1140 res.create(arg_request).then(unittest.expectAsync(((api.Topic response) { | 1175 res.create(arg_request).then(unittest.expectAsync(((api.Topic response) { |
| 1141 checkTopic(response); | 1176 checkTopic(response); |
| 1142 }))); | 1177 }))); |
| 1143 }); | 1178 }); |
| 1144 | 1179 |
| 1145 unittest.test("method--delete", () { | 1180 unittest.test("method--delete", () { |
| 1146 | 1181 |
| 1147 var mock = new common_test.HttpServerMock(); | 1182 var mock = new HttpServerMock(); |
| 1148 api.TopicsResourceApi res = new api.PubsubApi(mock).topics; | 1183 api.TopicsResourceApi res = new api.PubsubApi(mock).topics; |
| 1149 var arg_topic = "foo"; | 1184 var arg_topic = "foo"; |
| 1150 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 1185 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1151 var path = (req.url).path; | 1186 var path = (req.url).path; |
| 1152 var pathOffset = 0; | 1187 var pathOffset = 0; |
| 1153 var index; | 1188 var index; |
| 1154 var subPart; | 1189 var subPart; |
| 1155 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1190 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 1156 pathOffset += 1; | 1191 pathOffset += 1; |
| 1157 unittest.expect(path.substring(pathOffset, pathOffset + 15), unittest.eq
uals("pubsub/v1beta1/")); | 1192 unittest.expect(path.substring(pathOffset, pathOffset + 15), unittest.eq
uals("pubsub/v1beta1/")); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 1175 var keyvalue = part.split("="); | 1210 var keyvalue = part.split("="); |
| 1176 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1211 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1177 } | 1212 } |
| 1178 } | 1213 } |
| 1179 | 1214 |
| 1180 | 1215 |
| 1181 var h = { | 1216 var h = { |
| 1182 "content-type" : "application/json; charset=utf-8", | 1217 "content-type" : "application/json; charset=utf-8", |
| 1183 }; | 1218 }; |
| 1184 var resp = ""; | 1219 var resp = ""; |
| 1185 return new async.Future.value(common_test.stringResponse(200, h, resp)); | 1220 return new async.Future.value(stringResponse(200, h, resp)); |
| 1186 }), true); | 1221 }), true); |
| 1187 res.delete(arg_topic).then(unittest.expectAsync((_) {})); | 1222 res.delete(arg_topic).then(unittest.expectAsync((_) {})); |
| 1188 }); | 1223 }); |
| 1189 | 1224 |
| 1190 unittest.test("method--get", () { | 1225 unittest.test("method--get", () { |
| 1191 | 1226 |
| 1192 var mock = new common_test.HttpServerMock(); | 1227 var mock = new HttpServerMock(); |
| 1193 api.TopicsResourceApi res = new api.PubsubApi(mock).topics; | 1228 api.TopicsResourceApi res = new api.PubsubApi(mock).topics; |
| 1194 var arg_topic = "foo"; | 1229 var arg_topic = "foo"; |
| 1195 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 1230 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1196 var path = (req.url).path; | 1231 var path = (req.url).path; |
| 1197 var pathOffset = 0; | 1232 var pathOffset = 0; |
| 1198 var index; | 1233 var index; |
| 1199 var subPart; | 1234 var subPart; |
| 1200 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1235 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 1201 pathOffset += 1; | 1236 pathOffset += 1; |
| 1202 unittest.expect(path.substring(pathOffset, pathOffset + 15), unittest.eq
uals("pubsub/v1beta1/")); | 1237 unittest.expect(path.substring(pathOffset, pathOffset + 15), unittest.eq
uals("pubsub/v1beta1/")); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 1220 var keyvalue = part.split("="); | 1255 var keyvalue = part.split("="); |
| 1221 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1256 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1222 } | 1257 } |
| 1223 } | 1258 } |
| 1224 | 1259 |
| 1225 | 1260 |
| 1226 var h = { | 1261 var h = { |
| 1227 "content-type" : "application/json; charset=utf-8", | 1262 "content-type" : "application/json; charset=utf-8", |
| 1228 }; | 1263 }; |
| 1229 var resp = convert.JSON.encode(buildTopic()); | 1264 var resp = convert.JSON.encode(buildTopic()); |
| 1230 return new async.Future.value(common_test.stringResponse(200, h, resp)); | 1265 return new async.Future.value(stringResponse(200, h, resp)); |
| 1231 }), true); | 1266 }), true); |
| 1232 res.get(arg_topic).then(unittest.expectAsync(((api.Topic response) { | 1267 res.get(arg_topic).then(unittest.expectAsync(((api.Topic response) { |
| 1233 checkTopic(response); | 1268 checkTopic(response); |
| 1234 }))); | 1269 }))); |
| 1235 }); | 1270 }); |
| 1236 | 1271 |
| 1237 unittest.test("method--list", () { | 1272 unittest.test("method--list", () { |
| 1238 | 1273 |
| 1239 var mock = new common_test.HttpServerMock(); | 1274 var mock = new HttpServerMock(); |
| 1240 api.TopicsResourceApi res = new api.PubsubApi(mock).topics; | 1275 api.TopicsResourceApi res = new api.PubsubApi(mock).topics; |
| 1241 var arg_maxResults = 42; | 1276 var arg_maxResults = 42; |
| 1242 var arg_pageToken = "foo"; | 1277 var arg_pageToken = "foo"; |
| 1243 var arg_query = "foo"; | 1278 var arg_query = "foo"; |
| 1244 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 1279 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1245 var path = (req.url).path; | 1280 var path = (req.url).path; |
| 1246 var pathOffset = 0; | 1281 var pathOffset = 0; |
| 1247 var index; | 1282 var index; |
| 1248 var subPart; | 1283 var subPart; |
| 1249 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1284 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1271 } | 1306 } |
| 1272 unittest.expect(core.int.parse(queryMap["maxResults"].first), unittest.e
quals(arg_maxResults)); | 1307 unittest.expect(core.int.parse(queryMap["maxResults"].first), unittest.e
quals(arg_maxResults)); |
| 1273 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); | 1308 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); |
| 1274 unittest.expect(queryMap["query"].first, unittest.equals(arg_query)); | 1309 unittest.expect(queryMap["query"].first, unittest.equals(arg_query)); |
| 1275 | 1310 |
| 1276 | 1311 |
| 1277 var h = { | 1312 var h = { |
| 1278 "content-type" : "application/json; charset=utf-8", | 1313 "content-type" : "application/json; charset=utf-8", |
| 1279 }; | 1314 }; |
| 1280 var resp = convert.JSON.encode(buildListTopicsResponse()); | 1315 var resp = convert.JSON.encode(buildListTopicsResponse()); |
| 1281 return new async.Future.value(common_test.stringResponse(200, h, resp)); | 1316 return new async.Future.value(stringResponse(200, h, resp)); |
| 1282 }), true); | 1317 }), true); |
| 1283 res.list(maxResults: arg_maxResults, pageToken: arg_pageToken, query: arg_
query).then(unittest.expectAsync(((api.ListTopicsResponse response) { | 1318 res.list(maxResults: arg_maxResults, pageToken: arg_pageToken, query: arg_
query).then(unittest.expectAsync(((api.ListTopicsResponse response) { |
| 1284 checkListTopicsResponse(response); | 1319 checkListTopicsResponse(response); |
| 1285 }))); | 1320 }))); |
| 1286 }); | 1321 }); |
| 1287 | 1322 |
| 1288 unittest.test("method--publish", () { | 1323 unittest.test("method--publish", () { |
| 1289 | 1324 |
| 1290 var mock = new common_test.HttpServerMock(); | 1325 var mock = new HttpServerMock(); |
| 1291 api.TopicsResourceApi res = new api.PubsubApi(mock).topics; | 1326 api.TopicsResourceApi res = new api.PubsubApi(mock).topics; |
| 1292 var arg_request = buildPublishRequest(); | 1327 var arg_request = buildPublishRequest(); |
| 1293 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 1328 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1294 var obj = new api.PublishRequest.fromJson(json); | 1329 var obj = new api.PublishRequest.fromJson(json); |
| 1295 checkPublishRequest(obj); | 1330 checkPublishRequest(obj); |
| 1296 | 1331 |
| 1297 var path = (req.url).path; | 1332 var path = (req.url).path; |
| 1298 var pathOffset = 0; | 1333 var pathOffset = 0; |
| 1299 var index; | 1334 var index; |
| 1300 var subPart; | 1335 var subPart; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1320 var keyvalue = part.split("="); | 1355 var keyvalue = part.split("="); |
| 1321 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1356 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1322 } | 1357 } |
| 1323 } | 1358 } |
| 1324 | 1359 |
| 1325 | 1360 |
| 1326 var h = { | 1361 var h = { |
| 1327 "content-type" : "application/json; charset=utf-8", | 1362 "content-type" : "application/json; charset=utf-8", |
| 1328 }; | 1363 }; |
| 1329 var resp = ""; | 1364 var resp = ""; |
| 1330 return new async.Future.value(common_test.stringResponse(200, h, resp)); | 1365 return new async.Future.value(stringResponse(200, h, resp)); |
| 1331 }), true); | 1366 }), true); |
| 1332 res.publish(arg_request).then(unittest.expectAsync((_) {})); | 1367 res.publish(arg_request).then(unittest.expectAsync((_) {})); |
| 1333 }); | 1368 }); |
| 1334 | 1369 |
| 1335 unittest.test("method--publishBatch", () { | 1370 unittest.test("method--publishBatch", () { |
| 1336 | 1371 |
| 1337 var mock = new common_test.HttpServerMock(); | 1372 var mock = new HttpServerMock(); |
| 1338 api.TopicsResourceApi res = new api.PubsubApi(mock).topics; | 1373 api.TopicsResourceApi res = new api.PubsubApi(mock).topics; |
| 1339 var arg_request = buildPublishBatchRequest(); | 1374 var arg_request = buildPublishBatchRequest(); |
| 1340 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 1375 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1341 var obj = new api.PublishBatchRequest.fromJson(json); | 1376 var obj = new api.PublishBatchRequest.fromJson(json); |
| 1342 checkPublishBatchRequest(obj); | 1377 checkPublishBatchRequest(obj); |
| 1343 | 1378 |
| 1344 var path = (req.url).path; | 1379 var path = (req.url).path; |
| 1345 var pathOffset = 0; | 1380 var pathOffset = 0; |
| 1346 var index; | 1381 var index; |
| 1347 var subPart; | 1382 var subPart; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1367 var keyvalue = part.split("="); | 1402 var keyvalue = part.split("="); |
| 1368 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1403 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1369 } | 1404 } |
| 1370 } | 1405 } |
| 1371 | 1406 |
| 1372 | 1407 |
| 1373 var h = { | 1408 var h = { |
| 1374 "content-type" : "application/json; charset=utf-8", | 1409 "content-type" : "application/json; charset=utf-8", |
| 1375 }; | 1410 }; |
| 1376 var resp = convert.JSON.encode(buildPublishBatchResponse()); | 1411 var resp = convert.JSON.encode(buildPublishBatchResponse()); |
| 1377 return new async.Future.value(common_test.stringResponse(200, h, resp)); | 1412 return new async.Future.value(stringResponse(200, h, resp)); |
| 1378 }), true); | 1413 }), true); |
| 1379 res.publishBatch(arg_request).then(unittest.expectAsync(((api.PublishBatch
Response response) { | 1414 res.publishBatch(arg_request).then(unittest.expectAsync(((api.PublishBatch
Response response) { |
| 1380 checkPublishBatchResponse(response); | 1415 checkPublishBatchResponse(response); |
| 1381 }))); | 1416 }))); |
| 1382 }); | 1417 }); |
| 1383 | 1418 |
| 1384 }); | 1419 }); |
| 1385 | 1420 |
| 1386 | 1421 |
| 1387 } | 1422 } |
| 1388 | 1423 |
| OLD | NEW |