| 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; |
| 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/v1beta2.dart' as api; | 12 import 'package:googleapis_beta/pubsub/v1beta2.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 buildUnnamed1633() { | 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 buildUnnamed1725() { |
| 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 checkUnnamed1633(core.List<core.String> o) { | 61 checkUnnamed1725(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.ackIds = buildUnnamed1633(); | 72 o.ackIds = buildUnnamed1725(); |
| 38 } | 73 } |
| 39 buildCounterAcknowledgeRequest--; | 74 buildCounterAcknowledgeRequest--; |
| 40 return o; | 75 return o; |
| 41 } | 76 } |
| 42 | 77 |
| 43 checkAcknowledgeRequest(api.AcknowledgeRequest o) { | 78 checkAcknowledgeRequest(api.AcknowledgeRequest o) { |
| 44 buildCounterAcknowledgeRequest++; | 79 buildCounterAcknowledgeRequest++; |
| 45 if (buildCounterAcknowledgeRequest < 3) { | 80 if (buildCounterAcknowledgeRequest < 3) { |
| 46 checkUnnamed1633(o.ackIds); | 81 checkUnnamed1725(o.ackIds); |
| 47 } | 82 } |
| 48 buildCounterAcknowledgeRequest--; | 83 buildCounterAcknowledgeRequest--; |
| 49 } | 84 } |
| 50 | 85 |
| 51 core.int buildCounterEmpty = 0; | 86 core.int buildCounterEmpty = 0; |
| 52 buildEmpty() { | 87 buildEmpty() { |
| 53 var o = new api.Empty(); | 88 var o = new api.Empty(); |
| 54 buildCounterEmpty++; | 89 buildCounterEmpty++; |
| 55 if (buildCounterEmpty < 3) { | 90 if (buildCounterEmpty < 3) { |
| 56 } | 91 } |
| 57 buildCounterEmpty--; | 92 buildCounterEmpty--; |
| 58 return o; | 93 return o; |
| 59 } | 94 } |
| 60 | 95 |
| 61 checkEmpty(api.Empty o) { | 96 checkEmpty(api.Empty o) { |
| 62 buildCounterEmpty++; | 97 buildCounterEmpty++; |
| 63 if (buildCounterEmpty < 3) { | 98 if (buildCounterEmpty < 3) { |
| 64 } | 99 } |
| 65 buildCounterEmpty--; | 100 buildCounterEmpty--; |
| 66 } | 101 } |
| 67 | 102 |
| 68 buildUnnamed1634() { | 103 buildUnnamed1726() { |
| 69 var o = new core.List<api.Subscription>(); | 104 var o = new core.List<api.Subscription>(); |
| 70 o.add(buildSubscription()); | 105 o.add(buildSubscription()); |
| 71 o.add(buildSubscription()); | 106 o.add(buildSubscription()); |
| 72 return o; | 107 return o; |
| 73 } | 108 } |
| 74 | 109 |
| 75 checkUnnamed1634(core.List<api.Subscription> o) { | 110 checkUnnamed1726(core.List<api.Subscription> o) { |
| 76 unittest.expect(o, unittest.hasLength(2)); | 111 unittest.expect(o, unittest.hasLength(2)); |
| 77 checkSubscription(o[0]); | 112 checkSubscription(o[0]); |
| 78 checkSubscription(o[1]); | 113 checkSubscription(o[1]); |
| 79 } | 114 } |
| 80 | 115 |
| 81 core.int buildCounterListSubscriptionsResponse = 0; | 116 core.int buildCounterListSubscriptionsResponse = 0; |
| 82 buildListSubscriptionsResponse() { | 117 buildListSubscriptionsResponse() { |
| 83 var o = new api.ListSubscriptionsResponse(); | 118 var o = new api.ListSubscriptionsResponse(); |
| 84 buildCounterListSubscriptionsResponse++; | 119 buildCounterListSubscriptionsResponse++; |
| 85 if (buildCounterListSubscriptionsResponse < 3) { | 120 if (buildCounterListSubscriptionsResponse < 3) { |
| 86 o.nextPageToken = "foo"; | 121 o.nextPageToken = "foo"; |
| 87 o.subscriptions = buildUnnamed1634(); | 122 o.subscriptions = buildUnnamed1726(); |
| 88 } | 123 } |
| 89 buildCounterListSubscriptionsResponse--; | 124 buildCounterListSubscriptionsResponse--; |
| 90 return o; | 125 return o; |
| 91 } | 126 } |
| 92 | 127 |
| 93 checkListSubscriptionsResponse(api.ListSubscriptionsResponse o) { | 128 checkListSubscriptionsResponse(api.ListSubscriptionsResponse o) { |
| 94 buildCounterListSubscriptionsResponse++; | 129 buildCounterListSubscriptionsResponse++; |
| 95 if (buildCounterListSubscriptionsResponse < 3) { | 130 if (buildCounterListSubscriptionsResponse < 3) { |
| 96 unittest.expect(o.nextPageToken, unittest.equals('foo')); | 131 unittest.expect(o.nextPageToken, unittest.equals('foo')); |
| 97 checkUnnamed1634(o.subscriptions); | 132 checkUnnamed1726(o.subscriptions); |
| 98 } | 133 } |
| 99 buildCounterListSubscriptionsResponse--; | 134 buildCounterListSubscriptionsResponse--; |
| 100 } | 135 } |
| 101 | 136 |
| 102 buildUnnamed1635() { | 137 buildUnnamed1727() { |
| 103 var o = new core.List<core.String>(); | 138 var o = new core.List<core.String>(); |
| 104 o.add("foo"); | 139 o.add("foo"); |
| 105 o.add("foo"); | 140 o.add("foo"); |
| 106 return o; | 141 return o; |
| 107 } | 142 } |
| 108 | 143 |
| 109 checkUnnamed1635(core.List<core.String> o) { | 144 checkUnnamed1727(core.List<core.String> o) { |
| 110 unittest.expect(o, unittest.hasLength(2)); | 145 unittest.expect(o, unittest.hasLength(2)); |
| 111 unittest.expect(o[0], unittest.equals('foo')); | 146 unittest.expect(o[0], unittest.equals('foo')); |
| 112 unittest.expect(o[1], unittest.equals('foo')); | 147 unittest.expect(o[1], unittest.equals('foo')); |
| 113 } | 148 } |
| 114 | 149 |
| 115 core.int buildCounterListTopicSubscriptionsResponse = 0; | 150 core.int buildCounterListTopicSubscriptionsResponse = 0; |
| 116 buildListTopicSubscriptionsResponse() { | 151 buildListTopicSubscriptionsResponse() { |
| 117 var o = new api.ListTopicSubscriptionsResponse(); | 152 var o = new api.ListTopicSubscriptionsResponse(); |
| 118 buildCounterListTopicSubscriptionsResponse++; | 153 buildCounterListTopicSubscriptionsResponse++; |
| 119 if (buildCounterListTopicSubscriptionsResponse < 3) { | 154 if (buildCounterListTopicSubscriptionsResponse < 3) { |
| 120 o.nextPageToken = "foo"; | 155 o.nextPageToken = "foo"; |
| 121 o.subscriptions = buildUnnamed1635(); | 156 o.subscriptions = buildUnnamed1727(); |
| 122 } | 157 } |
| 123 buildCounterListTopicSubscriptionsResponse--; | 158 buildCounterListTopicSubscriptionsResponse--; |
| 124 return o; | 159 return o; |
| 125 } | 160 } |
| 126 | 161 |
| 127 checkListTopicSubscriptionsResponse(api.ListTopicSubscriptionsResponse o) { | 162 checkListTopicSubscriptionsResponse(api.ListTopicSubscriptionsResponse o) { |
| 128 buildCounterListTopicSubscriptionsResponse++; | 163 buildCounterListTopicSubscriptionsResponse++; |
| 129 if (buildCounterListTopicSubscriptionsResponse < 3) { | 164 if (buildCounterListTopicSubscriptionsResponse < 3) { |
| 130 unittest.expect(o.nextPageToken, unittest.equals('foo')); | 165 unittest.expect(o.nextPageToken, unittest.equals('foo')); |
| 131 checkUnnamed1635(o.subscriptions); | 166 checkUnnamed1727(o.subscriptions); |
| 132 } | 167 } |
| 133 buildCounterListTopicSubscriptionsResponse--; | 168 buildCounterListTopicSubscriptionsResponse--; |
| 134 } | 169 } |
| 135 | 170 |
| 136 buildUnnamed1636() { | 171 buildUnnamed1728() { |
| 137 var o = new core.List<api.Topic>(); | 172 var o = new core.List<api.Topic>(); |
| 138 o.add(buildTopic()); | 173 o.add(buildTopic()); |
| 139 o.add(buildTopic()); | 174 o.add(buildTopic()); |
| 140 return o; | 175 return o; |
| 141 } | 176 } |
| 142 | 177 |
| 143 checkUnnamed1636(core.List<api.Topic> o) { | 178 checkUnnamed1728(core.List<api.Topic> o) { |
| 144 unittest.expect(o, unittest.hasLength(2)); | 179 unittest.expect(o, unittest.hasLength(2)); |
| 145 checkTopic(o[0]); | 180 checkTopic(o[0]); |
| 146 checkTopic(o[1]); | 181 checkTopic(o[1]); |
| 147 } | 182 } |
| 148 | 183 |
| 149 core.int buildCounterListTopicsResponse = 0; | 184 core.int buildCounterListTopicsResponse = 0; |
| 150 buildListTopicsResponse() { | 185 buildListTopicsResponse() { |
| 151 var o = new api.ListTopicsResponse(); | 186 var o = new api.ListTopicsResponse(); |
| 152 buildCounterListTopicsResponse++; | 187 buildCounterListTopicsResponse++; |
| 153 if (buildCounterListTopicsResponse < 3) { | 188 if (buildCounterListTopicsResponse < 3) { |
| 154 o.nextPageToken = "foo"; | 189 o.nextPageToken = "foo"; |
| 155 o.topics = buildUnnamed1636(); | 190 o.topics = buildUnnamed1728(); |
| 156 } | 191 } |
| 157 buildCounterListTopicsResponse--; | 192 buildCounterListTopicsResponse--; |
| 158 return o; | 193 return o; |
| 159 } | 194 } |
| 160 | 195 |
| 161 checkListTopicsResponse(api.ListTopicsResponse o) { | 196 checkListTopicsResponse(api.ListTopicsResponse o) { |
| 162 buildCounterListTopicsResponse++; | 197 buildCounterListTopicsResponse++; |
| 163 if (buildCounterListTopicsResponse < 3) { | 198 if (buildCounterListTopicsResponse < 3) { |
| 164 unittest.expect(o.nextPageToken, unittest.equals('foo')); | 199 unittest.expect(o.nextPageToken, unittest.equals('foo')); |
| 165 checkUnnamed1636(o.topics); | 200 checkUnnamed1728(o.topics); |
| 166 } | 201 } |
| 167 buildCounterListTopicsResponse--; | 202 buildCounterListTopicsResponse--; |
| 168 } | 203 } |
| 169 | 204 |
| 170 core.int buildCounterModifyAckDeadlineRequest = 0; | 205 core.int buildCounterModifyAckDeadlineRequest = 0; |
| 171 buildModifyAckDeadlineRequest() { | 206 buildModifyAckDeadlineRequest() { |
| 172 var o = new api.ModifyAckDeadlineRequest(); | 207 var o = new api.ModifyAckDeadlineRequest(); |
| 173 buildCounterModifyAckDeadlineRequest++; | 208 buildCounterModifyAckDeadlineRequest++; |
| 174 if (buildCounterModifyAckDeadlineRequest < 3) { | 209 if (buildCounterModifyAckDeadlineRequest < 3) { |
| 175 o.ackDeadlineSeconds = 42; | 210 o.ackDeadlineSeconds = 42; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 200 } | 235 } |
| 201 | 236 |
| 202 checkModifyPushConfigRequest(api.ModifyPushConfigRequest o) { | 237 checkModifyPushConfigRequest(api.ModifyPushConfigRequest o) { |
| 203 buildCounterModifyPushConfigRequest++; | 238 buildCounterModifyPushConfigRequest++; |
| 204 if (buildCounterModifyPushConfigRequest < 3) { | 239 if (buildCounterModifyPushConfigRequest < 3) { |
| 205 checkPushConfig(o.pushConfig); | 240 checkPushConfig(o.pushConfig); |
| 206 } | 241 } |
| 207 buildCounterModifyPushConfigRequest--; | 242 buildCounterModifyPushConfigRequest--; |
| 208 } | 243 } |
| 209 | 244 |
| 210 buildUnnamed1637() { | 245 buildUnnamed1729() { |
| 211 var o = new core.List<api.PubsubMessage>(); | 246 var o = new core.List<api.PubsubMessage>(); |
| 212 o.add(buildPubsubMessage()); | 247 o.add(buildPubsubMessage()); |
| 213 o.add(buildPubsubMessage()); | 248 o.add(buildPubsubMessage()); |
| 214 return o; | 249 return o; |
| 215 } | 250 } |
| 216 | 251 |
| 217 checkUnnamed1637(core.List<api.PubsubMessage> o) { | 252 checkUnnamed1729(core.List<api.PubsubMessage> o) { |
| 218 unittest.expect(o, unittest.hasLength(2)); | 253 unittest.expect(o, unittest.hasLength(2)); |
| 219 checkPubsubMessage(o[0]); | 254 checkPubsubMessage(o[0]); |
| 220 checkPubsubMessage(o[1]); | 255 checkPubsubMessage(o[1]); |
| 221 } | 256 } |
| 222 | 257 |
| 223 core.int buildCounterPublishRequest = 0; | 258 core.int buildCounterPublishRequest = 0; |
| 224 buildPublishRequest() { | 259 buildPublishRequest() { |
| 225 var o = new api.PublishRequest(); | 260 var o = new api.PublishRequest(); |
| 226 buildCounterPublishRequest++; | 261 buildCounterPublishRequest++; |
| 227 if (buildCounterPublishRequest < 3) { | 262 if (buildCounterPublishRequest < 3) { |
| 228 o.messages = buildUnnamed1637(); | 263 o.messages = buildUnnamed1729(); |
| 229 } | 264 } |
| 230 buildCounterPublishRequest--; | 265 buildCounterPublishRequest--; |
| 231 return o; | 266 return o; |
| 232 } | 267 } |
| 233 | 268 |
| 234 checkPublishRequest(api.PublishRequest o) { | 269 checkPublishRequest(api.PublishRequest o) { |
| 235 buildCounterPublishRequest++; | 270 buildCounterPublishRequest++; |
| 236 if (buildCounterPublishRequest < 3) { | 271 if (buildCounterPublishRequest < 3) { |
| 237 checkUnnamed1637(o.messages); | 272 checkUnnamed1729(o.messages); |
| 238 } | 273 } |
| 239 buildCounterPublishRequest--; | 274 buildCounterPublishRequest--; |
| 240 } | 275 } |
| 241 | 276 |
| 242 buildUnnamed1638() { | 277 buildUnnamed1730() { |
| 243 var o = new core.List<core.String>(); | 278 var o = new core.List<core.String>(); |
| 244 o.add("foo"); | 279 o.add("foo"); |
| 245 o.add("foo"); | 280 o.add("foo"); |
| 246 return o; | 281 return o; |
| 247 } | 282 } |
| 248 | 283 |
| 249 checkUnnamed1638(core.List<core.String> o) { | 284 checkUnnamed1730(core.List<core.String> o) { |
| 250 unittest.expect(o, unittest.hasLength(2)); | 285 unittest.expect(o, unittest.hasLength(2)); |
| 251 unittest.expect(o[0], unittest.equals('foo')); | 286 unittest.expect(o[0], unittest.equals('foo')); |
| 252 unittest.expect(o[1], unittest.equals('foo')); | 287 unittest.expect(o[1], unittest.equals('foo')); |
| 253 } | 288 } |
| 254 | 289 |
| 255 core.int buildCounterPublishResponse = 0; | 290 core.int buildCounterPublishResponse = 0; |
| 256 buildPublishResponse() { | 291 buildPublishResponse() { |
| 257 var o = new api.PublishResponse(); | 292 var o = new api.PublishResponse(); |
| 258 buildCounterPublishResponse++; | 293 buildCounterPublishResponse++; |
| 259 if (buildCounterPublishResponse < 3) { | 294 if (buildCounterPublishResponse < 3) { |
| 260 o.messageIds = buildUnnamed1638(); | 295 o.messageIds = buildUnnamed1730(); |
| 261 } | 296 } |
| 262 buildCounterPublishResponse--; | 297 buildCounterPublishResponse--; |
| 263 return o; | 298 return o; |
| 264 } | 299 } |
| 265 | 300 |
| 266 checkPublishResponse(api.PublishResponse o) { | 301 checkPublishResponse(api.PublishResponse o) { |
| 267 buildCounterPublishResponse++; | 302 buildCounterPublishResponse++; |
| 268 if (buildCounterPublishResponse < 3) { | 303 if (buildCounterPublishResponse < 3) { |
| 269 checkUnnamed1638(o.messageIds); | 304 checkUnnamed1730(o.messageIds); |
| 270 } | 305 } |
| 271 buildCounterPublishResponse--; | 306 buildCounterPublishResponse--; |
| 272 } | 307 } |
| 273 | 308 |
| 274 buildUnnamed1639() { | 309 buildUnnamed1731() { |
| 275 var o = new core.Map<core.String, core.String>(); | 310 var o = new core.Map<core.String, core.String>(); |
| 276 o["x"] = "foo"; | 311 o["x"] = "foo"; |
| 277 o["y"] = "foo"; | 312 o["y"] = "foo"; |
| 278 return o; | 313 return o; |
| 279 } | 314 } |
| 280 | 315 |
| 281 checkUnnamed1639(core.Map<core.String, core.String> o) { | 316 checkUnnamed1731(core.Map<core.String, core.String> o) { |
| 282 unittest.expect(o, unittest.hasLength(2)); | 317 unittest.expect(o, unittest.hasLength(2)); |
| 283 unittest.expect(o["x"], unittest.equals('foo')); | 318 unittest.expect(o["x"], unittest.equals('foo')); |
| 284 unittest.expect(o["y"], unittest.equals('foo')); | 319 unittest.expect(o["y"], unittest.equals('foo')); |
| 285 } | 320 } |
| 286 | 321 |
| 287 core.int buildCounterPubsubMessage = 0; | 322 core.int buildCounterPubsubMessage = 0; |
| 288 buildPubsubMessage() { | 323 buildPubsubMessage() { |
| 289 var o = new api.PubsubMessage(); | 324 var o = new api.PubsubMessage(); |
| 290 buildCounterPubsubMessage++; | 325 buildCounterPubsubMessage++; |
| 291 if (buildCounterPubsubMessage < 3) { | 326 if (buildCounterPubsubMessage < 3) { |
| 292 o.attributes = buildUnnamed1639(); | 327 o.attributes = buildUnnamed1731(); |
| 293 o.data = "foo"; | 328 o.data = "foo"; |
| 294 o.messageId = "foo"; | 329 o.messageId = "foo"; |
| 295 } | 330 } |
| 296 buildCounterPubsubMessage--; | 331 buildCounterPubsubMessage--; |
| 297 return o; | 332 return o; |
| 298 } | 333 } |
| 299 | 334 |
| 300 checkPubsubMessage(api.PubsubMessage o) { | 335 checkPubsubMessage(api.PubsubMessage o) { |
| 301 buildCounterPubsubMessage++; | 336 buildCounterPubsubMessage++; |
| 302 if (buildCounterPubsubMessage < 3) { | 337 if (buildCounterPubsubMessage < 3) { |
| 303 checkUnnamed1639(o.attributes); | 338 checkUnnamed1731(o.attributes); |
| 304 unittest.expect(o.data, unittest.equals('foo')); | 339 unittest.expect(o.data, unittest.equals('foo')); |
| 305 unittest.expect(o.messageId, unittest.equals('foo')); | 340 unittest.expect(o.messageId, unittest.equals('foo')); |
| 306 } | 341 } |
| 307 buildCounterPubsubMessage--; | 342 buildCounterPubsubMessage--; |
| 308 } | 343 } |
| 309 | 344 |
| 310 core.int buildCounterPullRequest = 0; | 345 core.int buildCounterPullRequest = 0; |
| 311 buildPullRequest() { | 346 buildPullRequest() { |
| 312 var o = new api.PullRequest(); | 347 var o = new api.PullRequest(); |
| 313 buildCounterPullRequest++; | 348 buildCounterPullRequest++; |
| 314 if (buildCounterPullRequest < 3) { | 349 if (buildCounterPullRequest < 3) { |
| 315 o.maxMessages = 42; | 350 o.maxMessages = 42; |
| 316 o.returnImmediately = true; | 351 o.returnImmediately = true; |
| 317 } | 352 } |
| 318 buildCounterPullRequest--; | 353 buildCounterPullRequest--; |
| 319 return o; | 354 return o; |
| 320 } | 355 } |
| 321 | 356 |
| 322 checkPullRequest(api.PullRequest o) { | 357 checkPullRequest(api.PullRequest o) { |
| 323 buildCounterPullRequest++; | 358 buildCounterPullRequest++; |
| 324 if (buildCounterPullRequest < 3) { | 359 if (buildCounterPullRequest < 3) { |
| 325 unittest.expect(o.maxMessages, unittest.equals(42)); | 360 unittest.expect(o.maxMessages, unittest.equals(42)); |
| 326 unittest.expect(o.returnImmediately, unittest.isTrue); | 361 unittest.expect(o.returnImmediately, unittest.isTrue); |
| 327 } | 362 } |
| 328 buildCounterPullRequest--; | 363 buildCounterPullRequest--; |
| 329 } | 364 } |
| 330 | 365 |
| 331 buildUnnamed1640() { | 366 buildUnnamed1732() { |
| 332 var o = new core.List<api.ReceivedMessage>(); | 367 var o = new core.List<api.ReceivedMessage>(); |
| 333 o.add(buildReceivedMessage()); | 368 o.add(buildReceivedMessage()); |
| 334 o.add(buildReceivedMessage()); | 369 o.add(buildReceivedMessage()); |
| 335 return o; | 370 return o; |
| 336 } | 371 } |
| 337 | 372 |
| 338 checkUnnamed1640(core.List<api.ReceivedMessage> o) { | 373 checkUnnamed1732(core.List<api.ReceivedMessage> o) { |
| 339 unittest.expect(o, unittest.hasLength(2)); | 374 unittest.expect(o, unittest.hasLength(2)); |
| 340 checkReceivedMessage(o[0]); | 375 checkReceivedMessage(o[0]); |
| 341 checkReceivedMessage(o[1]); | 376 checkReceivedMessage(o[1]); |
| 342 } | 377 } |
| 343 | 378 |
| 344 core.int buildCounterPullResponse = 0; | 379 core.int buildCounterPullResponse = 0; |
| 345 buildPullResponse() { | 380 buildPullResponse() { |
| 346 var o = new api.PullResponse(); | 381 var o = new api.PullResponse(); |
| 347 buildCounterPullResponse++; | 382 buildCounterPullResponse++; |
| 348 if (buildCounterPullResponse < 3) { | 383 if (buildCounterPullResponse < 3) { |
| 349 o.receivedMessages = buildUnnamed1640(); | 384 o.receivedMessages = buildUnnamed1732(); |
| 350 } | 385 } |
| 351 buildCounterPullResponse--; | 386 buildCounterPullResponse--; |
| 352 return o; | 387 return o; |
| 353 } | 388 } |
| 354 | 389 |
| 355 checkPullResponse(api.PullResponse o) { | 390 checkPullResponse(api.PullResponse o) { |
| 356 buildCounterPullResponse++; | 391 buildCounterPullResponse++; |
| 357 if (buildCounterPullResponse < 3) { | 392 if (buildCounterPullResponse < 3) { |
| 358 checkUnnamed1640(o.receivedMessages); | 393 checkUnnamed1732(o.receivedMessages); |
| 359 } | 394 } |
| 360 buildCounterPullResponse--; | 395 buildCounterPullResponse--; |
| 361 } | 396 } |
| 362 | 397 |
| 363 buildUnnamed1641() { | 398 buildUnnamed1733() { |
| 364 var o = new core.Map<core.String, core.String>(); | 399 var o = new core.Map<core.String, core.String>(); |
| 365 o["x"] = "foo"; | 400 o["x"] = "foo"; |
| 366 o["y"] = "foo"; | 401 o["y"] = "foo"; |
| 367 return o; | 402 return o; |
| 368 } | 403 } |
| 369 | 404 |
| 370 checkUnnamed1641(core.Map<core.String, core.String> o) { | 405 checkUnnamed1733(core.Map<core.String, core.String> o) { |
| 371 unittest.expect(o, unittest.hasLength(2)); | 406 unittest.expect(o, unittest.hasLength(2)); |
| 372 unittest.expect(o["x"], unittest.equals('foo')); | 407 unittest.expect(o["x"], unittest.equals('foo')); |
| 373 unittest.expect(o["y"], unittest.equals('foo')); | 408 unittest.expect(o["y"], unittest.equals('foo')); |
| 374 } | 409 } |
| 375 | 410 |
| 376 core.int buildCounterPushConfig = 0; | 411 core.int buildCounterPushConfig = 0; |
| 377 buildPushConfig() { | 412 buildPushConfig() { |
| 378 var o = new api.PushConfig(); | 413 var o = new api.PushConfig(); |
| 379 buildCounterPushConfig++; | 414 buildCounterPushConfig++; |
| 380 if (buildCounterPushConfig < 3) { | 415 if (buildCounterPushConfig < 3) { |
| 381 o.attributes = buildUnnamed1641(); | 416 o.attributes = buildUnnamed1733(); |
| 382 o.pushEndpoint = "foo"; | 417 o.pushEndpoint = "foo"; |
| 383 } | 418 } |
| 384 buildCounterPushConfig--; | 419 buildCounterPushConfig--; |
| 385 return o; | 420 return o; |
| 386 } | 421 } |
| 387 | 422 |
| 388 checkPushConfig(api.PushConfig o) { | 423 checkPushConfig(api.PushConfig o) { |
| 389 buildCounterPushConfig++; | 424 buildCounterPushConfig++; |
| 390 if (buildCounterPushConfig < 3) { | 425 if (buildCounterPushConfig < 3) { |
| 391 checkUnnamed1641(o.attributes); | 426 checkUnnamed1733(o.attributes); |
| 392 unittest.expect(o.pushEndpoint, unittest.equals('foo')); | 427 unittest.expect(o.pushEndpoint, unittest.equals('foo')); |
| 393 } | 428 } |
| 394 buildCounterPushConfig--; | 429 buildCounterPushConfig--; |
| 395 } | 430 } |
| 396 | 431 |
| 397 core.int buildCounterReceivedMessage = 0; | 432 core.int buildCounterReceivedMessage = 0; |
| 398 buildReceivedMessage() { | 433 buildReceivedMessage() { |
| 399 var o = new api.ReceivedMessage(); | 434 var o = new api.ReceivedMessage(); |
| 400 buildCounterReceivedMessage++; | 435 buildCounterReceivedMessage++; |
| 401 if (buildCounterReceivedMessage < 3) { | 436 if (buildCounterReceivedMessage < 3) { |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 601 var o = buildTopic(); | 636 var o = buildTopic(); |
| 602 var od = new api.Topic.fromJson(o.toJson()); | 637 var od = new api.Topic.fromJson(o.toJson()); |
| 603 checkTopic(od); | 638 checkTopic(od); |
| 604 }); | 639 }); |
| 605 }); | 640 }); |
| 606 | 641 |
| 607 | 642 |
| 608 unittest.group("resource-ProjectsSubscriptionsResourceApi", () { | 643 unittest.group("resource-ProjectsSubscriptionsResourceApi", () { |
| 609 unittest.test("method--acknowledge", () { | 644 unittest.test("method--acknowledge", () { |
| 610 | 645 |
| 611 var mock = new common_test.HttpServerMock(); | 646 var mock = new HttpServerMock(); |
| 612 api.ProjectsSubscriptionsResourceApi res = new api.PubsubApi(mock).project
s.subscriptions; | 647 api.ProjectsSubscriptionsResourceApi res = new api.PubsubApi(mock).project
s.subscriptions; |
| 613 var arg_request = buildAcknowledgeRequest(); | 648 var arg_request = buildAcknowledgeRequest(); |
| 614 var arg_subscription = "foo"; | 649 var arg_subscription = "foo"; |
| 615 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 650 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 616 var obj = new api.AcknowledgeRequest.fromJson(json); | 651 var obj = new api.AcknowledgeRequest.fromJson(json); |
| 617 checkAcknowledgeRequest(obj); | 652 checkAcknowledgeRequest(obj); |
| 618 | 653 |
| 619 var path = (req.url).path; | 654 var path = (req.url).path; |
| 620 var pathOffset = 0; | 655 var pathOffset = 0; |
| 621 var index; | 656 var index; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 638 var keyvalue = part.split("="); | 673 var keyvalue = part.split("="); |
| 639 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 674 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 640 } | 675 } |
| 641 } | 676 } |
| 642 | 677 |
| 643 | 678 |
| 644 var h = { | 679 var h = { |
| 645 "content-type" : "application/json; charset=utf-8", | 680 "content-type" : "application/json; charset=utf-8", |
| 646 }; | 681 }; |
| 647 var resp = convert.JSON.encode(buildEmpty()); | 682 var resp = convert.JSON.encode(buildEmpty()); |
| 648 return new async.Future.value(common_test.stringResponse(200, h, resp)); | 683 return new async.Future.value(stringResponse(200, h, resp)); |
| 649 }), true); | 684 }), true); |
| 650 res.acknowledge(arg_request, arg_subscription).then(unittest.expectAsync((
(api.Empty response) { | 685 res.acknowledge(arg_request, arg_subscription).then(unittest.expectAsync((
(api.Empty response) { |
| 651 checkEmpty(response); | 686 checkEmpty(response); |
| 652 }))); | 687 }))); |
| 653 }); | 688 }); |
| 654 | 689 |
| 655 unittest.test("method--create", () { | 690 unittest.test("method--create", () { |
| 656 | 691 |
| 657 var mock = new common_test.HttpServerMock(); | 692 var mock = new HttpServerMock(); |
| 658 api.ProjectsSubscriptionsResourceApi res = new api.PubsubApi(mock).project
s.subscriptions; | 693 api.ProjectsSubscriptionsResourceApi res = new api.PubsubApi(mock).project
s.subscriptions; |
| 659 var arg_request = buildSubscription(); | 694 var arg_request = buildSubscription(); |
| 660 var arg_name = "foo"; | 695 var arg_name = "foo"; |
| 661 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 696 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 662 var obj = new api.Subscription.fromJson(json); | 697 var obj = new api.Subscription.fromJson(json); |
| 663 checkSubscription(obj); | 698 checkSubscription(obj); |
| 664 | 699 |
| 665 var path = (req.url).path; | 700 var path = (req.url).path; |
| 666 var pathOffset = 0; | 701 var pathOffset = 0; |
| 667 var index; | 702 var index; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 684 var keyvalue = part.split("="); | 719 var keyvalue = part.split("="); |
| 685 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 720 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 686 } | 721 } |
| 687 } | 722 } |
| 688 | 723 |
| 689 | 724 |
| 690 var h = { | 725 var h = { |
| 691 "content-type" : "application/json; charset=utf-8", | 726 "content-type" : "application/json; charset=utf-8", |
| 692 }; | 727 }; |
| 693 var resp = convert.JSON.encode(buildSubscription()); | 728 var resp = convert.JSON.encode(buildSubscription()); |
| 694 return new async.Future.value(common_test.stringResponse(200, h, resp)); | 729 return new async.Future.value(stringResponse(200, h, resp)); |
| 695 }), true); | 730 }), true); |
| 696 res.create(arg_request, arg_name).then(unittest.expectAsync(((api.Subscrip
tion response) { | 731 res.create(arg_request, arg_name).then(unittest.expectAsync(((api.Subscrip
tion response) { |
| 697 checkSubscription(response); | 732 checkSubscription(response); |
| 698 }))); | 733 }))); |
| 699 }); | 734 }); |
| 700 | 735 |
| 701 unittest.test("method--delete", () { | 736 unittest.test("method--delete", () { |
| 702 | 737 |
| 703 var mock = new common_test.HttpServerMock(); | 738 var mock = new HttpServerMock(); |
| 704 api.ProjectsSubscriptionsResourceApi res = new api.PubsubApi(mock).project
s.subscriptions; | 739 api.ProjectsSubscriptionsResourceApi res = new api.PubsubApi(mock).project
s.subscriptions; |
| 705 var arg_subscription = "foo"; | 740 var arg_subscription = "foo"; |
| 706 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 741 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 707 var path = (req.url).path; | 742 var path = (req.url).path; |
| 708 var pathOffset = 0; | 743 var pathOffset = 0; |
| 709 var index; | 744 var index; |
| 710 var subPart; | 745 var subPart; |
| 711 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 746 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 712 pathOffset += 1; | 747 pathOffset += 1; |
| 713 | 748 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 726 var keyvalue = part.split("="); | 761 var keyvalue = part.split("="); |
| 727 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 762 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 728 } | 763 } |
| 729 } | 764 } |
| 730 | 765 |
| 731 | 766 |
| 732 var h = { | 767 var h = { |
| 733 "content-type" : "application/json; charset=utf-8", | 768 "content-type" : "application/json; charset=utf-8", |
| 734 }; | 769 }; |
| 735 var resp = convert.JSON.encode(buildEmpty()); | 770 var resp = convert.JSON.encode(buildEmpty()); |
| 736 return new async.Future.value(common_test.stringResponse(200, h, resp)); | 771 return new async.Future.value(stringResponse(200, h, resp)); |
| 737 }), true); | 772 }), true); |
| 738 res.delete(arg_subscription).then(unittest.expectAsync(((api.Empty respons
e) { | 773 res.delete(arg_subscription).then(unittest.expectAsync(((api.Empty respons
e) { |
| 739 checkEmpty(response); | 774 checkEmpty(response); |
| 740 }))); | 775 }))); |
| 741 }); | 776 }); |
| 742 | 777 |
| 743 unittest.test("method--get", () { | 778 unittest.test("method--get", () { |
| 744 | 779 |
| 745 var mock = new common_test.HttpServerMock(); | 780 var mock = new HttpServerMock(); |
| 746 api.ProjectsSubscriptionsResourceApi res = new api.PubsubApi(mock).project
s.subscriptions; | 781 api.ProjectsSubscriptionsResourceApi res = new api.PubsubApi(mock).project
s.subscriptions; |
| 747 var arg_subscription = "foo"; | 782 var arg_subscription = "foo"; |
| 748 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 783 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 749 var path = (req.url).path; | 784 var path = (req.url).path; |
| 750 var pathOffset = 0; | 785 var pathOffset = 0; |
| 751 var index; | 786 var index; |
| 752 var subPart; | 787 var subPart; |
| 753 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 788 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 754 pathOffset += 1; | 789 pathOffset += 1; |
| 755 | 790 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 768 var keyvalue = part.split("="); | 803 var keyvalue = part.split("="); |
| 769 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 804 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 770 } | 805 } |
| 771 } | 806 } |
| 772 | 807 |
| 773 | 808 |
| 774 var h = { | 809 var h = { |
| 775 "content-type" : "application/json; charset=utf-8", | 810 "content-type" : "application/json; charset=utf-8", |
| 776 }; | 811 }; |
| 777 var resp = convert.JSON.encode(buildSubscription()); | 812 var resp = convert.JSON.encode(buildSubscription()); |
| 778 return new async.Future.value(common_test.stringResponse(200, h, resp)); | 813 return new async.Future.value(stringResponse(200, h, resp)); |
| 779 }), true); | 814 }), true); |
| 780 res.get(arg_subscription).then(unittest.expectAsync(((api.Subscription res
ponse) { | 815 res.get(arg_subscription).then(unittest.expectAsync(((api.Subscription res
ponse) { |
| 781 checkSubscription(response); | 816 checkSubscription(response); |
| 782 }))); | 817 }))); |
| 783 }); | 818 }); |
| 784 | 819 |
| 785 unittest.test("method--list", () { | 820 unittest.test("method--list", () { |
| 786 | 821 |
| 787 var mock = new common_test.HttpServerMock(); | 822 var mock = new HttpServerMock(); |
| 788 api.ProjectsSubscriptionsResourceApi res = new api.PubsubApi(mock).project
s.subscriptions; | 823 api.ProjectsSubscriptionsResourceApi res = new api.PubsubApi(mock).project
s.subscriptions; |
| 789 var arg_project = "foo"; | 824 var arg_project = "foo"; |
| 790 var arg_pageSize = 42; | 825 var arg_pageSize = 42; |
| 791 var arg_pageToken = "foo"; | 826 var arg_pageToken = "foo"; |
| 792 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 827 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 793 var path = (req.url).path; | 828 var path = (req.url).path; |
| 794 var pathOffset = 0; | 829 var pathOffset = 0; |
| 795 var index; | 830 var index; |
| 796 var subPart; | 831 var subPart; |
| 797 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 832 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 814 } | 849 } |
| 815 } | 850 } |
| 816 unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equ
als(arg_pageSize)); | 851 unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equ
als(arg_pageSize)); |
| 817 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); | 852 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); |
| 818 | 853 |
| 819 | 854 |
| 820 var h = { | 855 var h = { |
| 821 "content-type" : "application/json; charset=utf-8", | 856 "content-type" : "application/json; charset=utf-8", |
| 822 }; | 857 }; |
| 823 var resp = convert.JSON.encode(buildListSubscriptionsResponse()); | 858 var resp = convert.JSON.encode(buildListSubscriptionsResponse()); |
| 824 return new async.Future.value(common_test.stringResponse(200, h, resp)); | 859 return new async.Future.value(stringResponse(200, h, resp)); |
| 825 }), true); | 860 }), true); |
| 826 res.list(arg_project, pageSize: arg_pageSize, pageToken: arg_pageToken).th
en(unittest.expectAsync(((api.ListSubscriptionsResponse response) { | 861 res.list(arg_project, pageSize: arg_pageSize, pageToken: arg_pageToken).th
en(unittest.expectAsync(((api.ListSubscriptionsResponse response) { |
| 827 checkListSubscriptionsResponse(response); | 862 checkListSubscriptionsResponse(response); |
| 828 }))); | 863 }))); |
| 829 }); | 864 }); |
| 830 | 865 |
| 831 unittest.test("method--modifyAckDeadline", () { | 866 unittest.test("method--modifyAckDeadline", () { |
| 832 | 867 |
| 833 var mock = new common_test.HttpServerMock(); | 868 var mock = new HttpServerMock(); |
| 834 api.ProjectsSubscriptionsResourceApi res = new api.PubsubApi(mock).project
s.subscriptions; | 869 api.ProjectsSubscriptionsResourceApi res = new api.PubsubApi(mock).project
s.subscriptions; |
| 835 var arg_request = buildModifyAckDeadlineRequest(); | 870 var arg_request = buildModifyAckDeadlineRequest(); |
| 836 var arg_subscription = "foo"; | 871 var arg_subscription = "foo"; |
| 837 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 872 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 838 var obj = new api.ModifyAckDeadlineRequest.fromJson(json); | 873 var obj = new api.ModifyAckDeadlineRequest.fromJson(json); |
| 839 checkModifyAckDeadlineRequest(obj); | 874 checkModifyAckDeadlineRequest(obj); |
| 840 | 875 |
| 841 var path = (req.url).path; | 876 var path = (req.url).path; |
| 842 var pathOffset = 0; | 877 var pathOffset = 0; |
| 843 var index; | 878 var index; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 860 var keyvalue = part.split("="); | 895 var keyvalue = part.split("="); |
| 861 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 896 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 862 } | 897 } |
| 863 } | 898 } |
| 864 | 899 |
| 865 | 900 |
| 866 var h = { | 901 var h = { |
| 867 "content-type" : "application/json; charset=utf-8", | 902 "content-type" : "application/json; charset=utf-8", |
| 868 }; | 903 }; |
| 869 var resp = convert.JSON.encode(buildEmpty()); | 904 var resp = convert.JSON.encode(buildEmpty()); |
| 870 return new async.Future.value(common_test.stringResponse(200, h, resp)); | 905 return new async.Future.value(stringResponse(200, h, resp)); |
| 871 }), true); | 906 }), true); |
| 872 res.modifyAckDeadline(arg_request, arg_subscription).then(unittest.expectA
sync(((api.Empty response) { | 907 res.modifyAckDeadline(arg_request, arg_subscription).then(unittest.expectA
sync(((api.Empty response) { |
| 873 checkEmpty(response); | 908 checkEmpty(response); |
| 874 }))); | 909 }))); |
| 875 }); | 910 }); |
| 876 | 911 |
| 877 unittest.test("method--modifyPushConfig", () { | 912 unittest.test("method--modifyPushConfig", () { |
| 878 | 913 |
| 879 var mock = new common_test.HttpServerMock(); | 914 var mock = new HttpServerMock(); |
| 880 api.ProjectsSubscriptionsResourceApi res = new api.PubsubApi(mock).project
s.subscriptions; | 915 api.ProjectsSubscriptionsResourceApi res = new api.PubsubApi(mock).project
s.subscriptions; |
| 881 var arg_request = buildModifyPushConfigRequest(); | 916 var arg_request = buildModifyPushConfigRequest(); |
| 882 var arg_subscription = "foo"; | 917 var arg_subscription = "foo"; |
| 883 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 918 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 884 var obj = new api.ModifyPushConfigRequest.fromJson(json); | 919 var obj = new api.ModifyPushConfigRequest.fromJson(json); |
| 885 checkModifyPushConfigRequest(obj); | 920 checkModifyPushConfigRequest(obj); |
| 886 | 921 |
| 887 var path = (req.url).path; | 922 var path = (req.url).path; |
| 888 var pathOffset = 0; | 923 var pathOffset = 0; |
| 889 var index; | 924 var index; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 906 var keyvalue = part.split("="); | 941 var keyvalue = part.split("="); |
| 907 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 942 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 908 } | 943 } |
| 909 } | 944 } |
| 910 | 945 |
| 911 | 946 |
| 912 var h = { | 947 var h = { |
| 913 "content-type" : "application/json; charset=utf-8", | 948 "content-type" : "application/json; charset=utf-8", |
| 914 }; | 949 }; |
| 915 var resp = convert.JSON.encode(buildEmpty()); | 950 var resp = convert.JSON.encode(buildEmpty()); |
| 916 return new async.Future.value(common_test.stringResponse(200, h, resp)); | 951 return new async.Future.value(stringResponse(200, h, resp)); |
| 917 }), true); | 952 }), true); |
| 918 res.modifyPushConfig(arg_request, arg_subscription).then(unittest.expectAs
ync(((api.Empty response) { | 953 res.modifyPushConfig(arg_request, arg_subscription).then(unittest.expectAs
ync(((api.Empty response) { |
| 919 checkEmpty(response); | 954 checkEmpty(response); |
| 920 }))); | 955 }))); |
| 921 }); | 956 }); |
| 922 | 957 |
| 923 unittest.test("method--pull", () { | 958 unittest.test("method--pull", () { |
| 924 | 959 |
| 925 var mock = new common_test.HttpServerMock(); | 960 var mock = new HttpServerMock(); |
| 926 api.ProjectsSubscriptionsResourceApi res = new api.PubsubApi(mock).project
s.subscriptions; | 961 api.ProjectsSubscriptionsResourceApi res = new api.PubsubApi(mock).project
s.subscriptions; |
| 927 var arg_request = buildPullRequest(); | 962 var arg_request = buildPullRequest(); |
| 928 var arg_subscription = "foo"; | 963 var arg_subscription = "foo"; |
| 929 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 964 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 930 var obj = new api.PullRequest.fromJson(json); | 965 var obj = new api.PullRequest.fromJson(json); |
| 931 checkPullRequest(obj); | 966 checkPullRequest(obj); |
| 932 | 967 |
| 933 var path = (req.url).path; | 968 var path = (req.url).path; |
| 934 var pathOffset = 0; | 969 var pathOffset = 0; |
| 935 var index; | 970 var index; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 952 var keyvalue = part.split("="); | 987 var keyvalue = part.split("="); |
| 953 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 988 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 954 } | 989 } |
| 955 } | 990 } |
| 956 | 991 |
| 957 | 992 |
| 958 var h = { | 993 var h = { |
| 959 "content-type" : "application/json; charset=utf-8", | 994 "content-type" : "application/json; charset=utf-8", |
| 960 }; | 995 }; |
| 961 var resp = convert.JSON.encode(buildPullResponse()); | 996 var resp = convert.JSON.encode(buildPullResponse()); |
| 962 return new async.Future.value(common_test.stringResponse(200, h, resp)); | 997 return new async.Future.value(stringResponse(200, h, resp)); |
| 963 }), true); | 998 }), true); |
| 964 res.pull(arg_request, arg_subscription).then(unittest.expectAsync(((api.Pu
llResponse response) { | 999 res.pull(arg_request, arg_subscription).then(unittest.expectAsync(((api.Pu
llResponse response) { |
| 965 checkPullResponse(response); | 1000 checkPullResponse(response); |
| 966 }))); | 1001 }))); |
| 967 }); | 1002 }); |
| 968 | 1003 |
| 969 }); | 1004 }); |
| 970 | 1005 |
| 971 | 1006 |
| 972 unittest.group("resource-ProjectsTopicsResourceApi", () { | 1007 unittest.group("resource-ProjectsTopicsResourceApi", () { |
| 973 unittest.test("method--create", () { | 1008 unittest.test("method--create", () { |
| 974 | 1009 |
| 975 var mock = new common_test.HttpServerMock(); | 1010 var mock = new HttpServerMock(); |
| 976 api.ProjectsTopicsResourceApi res = new api.PubsubApi(mock).projects.topic
s; | 1011 api.ProjectsTopicsResourceApi res = new api.PubsubApi(mock).projects.topic
s; |
| 977 var arg_request = buildTopic(); | 1012 var arg_request = buildTopic(); |
| 978 var arg_name = "foo"; | 1013 var arg_name = "foo"; |
| 979 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 1014 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 980 var obj = new api.Topic.fromJson(json); | 1015 var obj = new api.Topic.fromJson(json); |
| 981 checkTopic(obj); | 1016 checkTopic(obj); |
| 982 | 1017 |
| 983 var path = (req.url).path; | 1018 var path = (req.url).path; |
| 984 var pathOffset = 0; | 1019 var pathOffset = 0; |
| 985 var index; | 1020 var index; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1002 var keyvalue = part.split("="); | 1037 var keyvalue = part.split("="); |
| 1003 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1038 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1004 } | 1039 } |
| 1005 } | 1040 } |
| 1006 | 1041 |
| 1007 | 1042 |
| 1008 var h = { | 1043 var h = { |
| 1009 "content-type" : "application/json; charset=utf-8", | 1044 "content-type" : "application/json; charset=utf-8", |
| 1010 }; | 1045 }; |
| 1011 var resp = convert.JSON.encode(buildTopic()); | 1046 var resp = convert.JSON.encode(buildTopic()); |
| 1012 return new async.Future.value(common_test.stringResponse(200, h, resp)); | 1047 return new async.Future.value(stringResponse(200, h, resp)); |
| 1013 }), true); | 1048 }), true); |
| 1014 res.create(arg_request, arg_name).then(unittest.expectAsync(((api.Topic re
sponse) { | 1049 res.create(arg_request, arg_name).then(unittest.expectAsync(((api.Topic re
sponse) { |
| 1015 checkTopic(response); | 1050 checkTopic(response); |
| 1016 }))); | 1051 }))); |
| 1017 }); | 1052 }); |
| 1018 | 1053 |
| 1019 unittest.test("method--delete", () { | 1054 unittest.test("method--delete", () { |
| 1020 | 1055 |
| 1021 var mock = new common_test.HttpServerMock(); | 1056 var mock = new HttpServerMock(); |
| 1022 api.ProjectsTopicsResourceApi res = new api.PubsubApi(mock).projects.topic
s; | 1057 api.ProjectsTopicsResourceApi res = new api.PubsubApi(mock).projects.topic
s; |
| 1023 var arg_topic = "foo"; | 1058 var arg_topic = "foo"; |
| 1024 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 1059 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1025 var path = (req.url).path; | 1060 var path = (req.url).path; |
| 1026 var pathOffset = 0; | 1061 var pathOffset = 0; |
| 1027 var index; | 1062 var index; |
| 1028 var subPart; | 1063 var subPart; |
| 1029 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1064 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 1030 pathOffset += 1; | 1065 pathOffset += 1; |
| 1031 | 1066 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1044 var keyvalue = part.split("="); | 1079 var keyvalue = part.split("="); |
| 1045 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1080 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1046 } | 1081 } |
| 1047 } | 1082 } |
| 1048 | 1083 |
| 1049 | 1084 |
| 1050 var h = { | 1085 var h = { |
| 1051 "content-type" : "application/json; charset=utf-8", | 1086 "content-type" : "application/json; charset=utf-8", |
| 1052 }; | 1087 }; |
| 1053 var resp = convert.JSON.encode(buildEmpty()); | 1088 var resp = convert.JSON.encode(buildEmpty()); |
| 1054 return new async.Future.value(common_test.stringResponse(200, h, resp)); | 1089 return new async.Future.value(stringResponse(200, h, resp)); |
| 1055 }), true); | 1090 }), true); |
| 1056 res.delete(arg_topic).then(unittest.expectAsync(((api.Empty response) { | 1091 res.delete(arg_topic).then(unittest.expectAsync(((api.Empty response) { |
| 1057 checkEmpty(response); | 1092 checkEmpty(response); |
| 1058 }))); | 1093 }))); |
| 1059 }); | 1094 }); |
| 1060 | 1095 |
| 1061 unittest.test("method--get", () { | 1096 unittest.test("method--get", () { |
| 1062 | 1097 |
| 1063 var mock = new common_test.HttpServerMock(); | 1098 var mock = new HttpServerMock(); |
| 1064 api.ProjectsTopicsResourceApi res = new api.PubsubApi(mock).projects.topic
s; | 1099 api.ProjectsTopicsResourceApi res = new api.PubsubApi(mock).projects.topic
s; |
| 1065 var arg_topic = "foo"; | 1100 var arg_topic = "foo"; |
| 1066 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 1101 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1067 var path = (req.url).path; | 1102 var path = (req.url).path; |
| 1068 var pathOffset = 0; | 1103 var pathOffset = 0; |
| 1069 var index; | 1104 var index; |
| 1070 var subPart; | 1105 var subPart; |
| 1071 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1106 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 1072 pathOffset += 1; | 1107 pathOffset += 1; |
| 1073 | 1108 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1086 var keyvalue = part.split("="); | 1121 var keyvalue = part.split("="); |
| 1087 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1122 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1088 } | 1123 } |
| 1089 } | 1124 } |
| 1090 | 1125 |
| 1091 | 1126 |
| 1092 var h = { | 1127 var h = { |
| 1093 "content-type" : "application/json; charset=utf-8", | 1128 "content-type" : "application/json; charset=utf-8", |
| 1094 }; | 1129 }; |
| 1095 var resp = convert.JSON.encode(buildTopic()); | 1130 var resp = convert.JSON.encode(buildTopic()); |
| 1096 return new async.Future.value(common_test.stringResponse(200, h, resp)); | 1131 return new async.Future.value(stringResponse(200, h, resp)); |
| 1097 }), true); | 1132 }), true); |
| 1098 res.get(arg_topic).then(unittest.expectAsync(((api.Topic response) { | 1133 res.get(arg_topic).then(unittest.expectAsync(((api.Topic response) { |
| 1099 checkTopic(response); | 1134 checkTopic(response); |
| 1100 }))); | 1135 }))); |
| 1101 }); | 1136 }); |
| 1102 | 1137 |
| 1103 unittest.test("method--list", () { | 1138 unittest.test("method--list", () { |
| 1104 | 1139 |
| 1105 var mock = new common_test.HttpServerMock(); | 1140 var mock = new HttpServerMock(); |
| 1106 api.ProjectsTopicsResourceApi res = new api.PubsubApi(mock).projects.topic
s; | 1141 api.ProjectsTopicsResourceApi res = new api.PubsubApi(mock).projects.topic
s; |
| 1107 var arg_project = "foo"; | 1142 var arg_project = "foo"; |
| 1108 var arg_pageSize = 42; | 1143 var arg_pageSize = 42; |
| 1109 var arg_pageToken = "foo"; | 1144 var arg_pageToken = "foo"; |
| 1110 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 1145 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1111 var path = (req.url).path; | 1146 var path = (req.url).path; |
| 1112 var pathOffset = 0; | 1147 var pathOffset = 0; |
| 1113 var index; | 1148 var index; |
| 1114 var subPart; | 1149 var subPart; |
| 1115 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1150 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1132 } | 1167 } |
| 1133 } | 1168 } |
| 1134 unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equ
als(arg_pageSize)); | 1169 unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equ
als(arg_pageSize)); |
| 1135 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); | 1170 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); |
| 1136 | 1171 |
| 1137 | 1172 |
| 1138 var h = { | 1173 var h = { |
| 1139 "content-type" : "application/json; charset=utf-8", | 1174 "content-type" : "application/json; charset=utf-8", |
| 1140 }; | 1175 }; |
| 1141 var resp = convert.JSON.encode(buildListTopicsResponse()); | 1176 var resp = convert.JSON.encode(buildListTopicsResponse()); |
| 1142 return new async.Future.value(common_test.stringResponse(200, h, resp)); | 1177 return new async.Future.value(stringResponse(200, h, resp)); |
| 1143 }), true); | 1178 }), true); |
| 1144 res.list(arg_project, pageSize: arg_pageSize, pageToken: arg_pageToken).th
en(unittest.expectAsync(((api.ListTopicsResponse response) { | 1179 res.list(arg_project, pageSize: arg_pageSize, pageToken: arg_pageToken).th
en(unittest.expectAsync(((api.ListTopicsResponse response) { |
| 1145 checkListTopicsResponse(response); | 1180 checkListTopicsResponse(response); |
| 1146 }))); | 1181 }))); |
| 1147 }); | 1182 }); |
| 1148 | 1183 |
| 1149 unittest.test("method--publish", () { | 1184 unittest.test("method--publish", () { |
| 1150 | 1185 |
| 1151 var mock = new common_test.HttpServerMock(); | 1186 var mock = new HttpServerMock(); |
| 1152 api.ProjectsTopicsResourceApi res = new api.PubsubApi(mock).projects.topic
s; | 1187 api.ProjectsTopicsResourceApi res = new api.PubsubApi(mock).projects.topic
s; |
| 1153 var arg_request = buildPublishRequest(); | 1188 var arg_request = buildPublishRequest(); |
| 1154 var arg_topic = "foo"; | 1189 var arg_topic = "foo"; |
| 1155 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 1190 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1156 var obj = new api.PublishRequest.fromJson(json); | 1191 var obj = new api.PublishRequest.fromJson(json); |
| 1157 checkPublishRequest(obj); | 1192 checkPublishRequest(obj); |
| 1158 | 1193 |
| 1159 var path = (req.url).path; | 1194 var path = (req.url).path; |
| 1160 var pathOffset = 0; | 1195 var pathOffset = 0; |
| 1161 var index; | 1196 var index; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1178 var keyvalue = part.split("="); | 1213 var keyvalue = part.split("="); |
| 1179 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1214 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 1180 } | 1215 } |
| 1181 } | 1216 } |
| 1182 | 1217 |
| 1183 | 1218 |
| 1184 var h = { | 1219 var h = { |
| 1185 "content-type" : "application/json; charset=utf-8", | 1220 "content-type" : "application/json; charset=utf-8", |
| 1186 }; | 1221 }; |
| 1187 var resp = convert.JSON.encode(buildPublishResponse()); | 1222 var resp = convert.JSON.encode(buildPublishResponse()); |
| 1188 return new async.Future.value(common_test.stringResponse(200, h, resp)); | 1223 return new async.Future.value(stringResponse(200, h, resp)); |
| 1189 }), true); | 1224 }), true); |
| 1190 res.publish(arg_request, arg_topic).then(unittest.expectAsync(((api.Publis
hResponse response) { | 1225 res.publish(arg_request, arg_topic).then(unittest.expectAsync(((api.Publis
hResponse response) { |
| 1191 checkPublishResponse(response); | 1226 checkPublishResponse(response); |
| 1192 }))); | 1227 }))); |
| 1193 }); | 1228 }); |
| 1194 | 1229 |
| 1195 }); | 1230 }); |
| 1196 | 1231 |
| 1197 | 1232 |
| 1198 unittest.group("resource-ProjectsTopicsSubscriptionsResourceApi", () { | 1233 unittest.group("resource-ProjectsTopicsSubscriptionsResourceApi", () { |
| 1199 unittest.test("method--list", () { | 1234 unittest.test("method--list", () { |
| 1200 | 1235 |
| 1201 var mock = new common_test.HttpServerMock(); | 1236 var mock = new HttpServerMock(); |
| 1202 api.ProjectsTopicsSubscriptionsResourceApi res = new api.PubsubApi(mock).p
rojects.topics.subscriptions; | 1237 api.ProjectsTopicsSubscriptionsResourceApi res = new api.PubsubApi(mock).p
rojects.topics.subscriptions; |
| 1203 var arg_topic = "foo"; | 1238 var arg_topic = "foo"; |
| 1204 var arg_pageSize = 42; | 1239 var arg_pageSize = 42; |
| 1205 var arg_pageToken = "foo"; | 1240 var arg_pageToken = "foo"; |
| 1206 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 1241 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 1207 var path = (req.url).path; | 1242 var path = (req.url).path; |
| 1208 var pathOffset = 0; | 1243 var pathOffset = 0; |
| 1209 var index; | 1244 var index; |
| 1210 var subPart; | 1245 var subPart; |
| 1211 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1246 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1228 } | 1263 } |
| 1229 } | 1264 } |
| 1230 unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equ
als(arg_pageSize)); | 1265 unittest.expect(core.int.parse(queryMap["pageSize"].first), unittest.equ
als(arg_pageSize)); |
| 1231 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); | 1266 unittest.expect(queryMap["pageToken"].first, unittest.equals(arg_pageTok
en)); |
| 1232 | 1267 |
| 1233 | 1268 |
| 1234 var h = { | 1269 var h = { |
| 1235 "content-type" : "application/json; charset=utf-8", | 1270 "content-type" : "application/json; charset=utf-8", |
| 1236 }; | 1271 }; |
| 1237 var resp = convert.JSON.encode(buildListTopicSubscriptionsResponse()); | 1272 var resp = convert.JSON.encode(buildListTopicSubscriptionsResponse()); |
| 1238 return new async.Future.value(common_test.stringResponse(200, h, resp)); | 1273 return new async.Future.value(stringResponse(200, h, resp)); |
| 1239 }), true); | 1274 }), true); |
| 1240 res.list(arg_topic, pageSize: arg_pageSize, pageToken: arg_pageToken).then
(unittest.expectAsync(((api.ListTopicSubscriptionsResponse response) { | 1275 res.list(arg_topic, pageSize: arg_pageSize, pageToken: arg_pageToken).then
(unittest.expectAsync(((api.ListTopicSubscriptionsResponse response) { |
| 1241 checkListTopicSubscriptionsResponse(response); | 1276 checkListTopicSubscriptionsResponse(response); |
| 1242 }))); | 1277 }))); |
| 1243 }); | 1278 }); |
| 1244 | 1279 |
| 1245 }); | 1280 }); |
| 1246 | 1281 |
| 1247 | 1282 |
| 1248 } | 1283 } |
| 1249 | 1284 |
| OLD | NEW |