| OLD | NEW |
| 1 library googleapis.consumersurveys.v2.test; | 1 library googleapis.consumersurveys.v2.test; |
| 2 | 2 |
| 3 import "dart:core" as core; | 3 import "dart:core" as core; |
| 4 import "dart:collection" as collection; | |
| 5 import "dart:async" as async; | 4 import "dart:async" as async; |
| 6 import "dart:convert" as convert; | 5 import "dart:convert" as convert; |
| 7 | 6 |
| 8 import 'package:http/http.dart' as http; | 7 import 'package:http/http.dart' as http; |
| 9 import 'package:http/testing.dart' as http_testing; | |
| 10 import 'package:test/test.dart' as unittest; | 8 import 'package:test/test.dart' as unittest; |
| 11 | 9 |
| 12 import 'package:googleapis/consumersurveys/v2.dart' as api; | 10 import 'package:googleapis/consumersurveys/v2.dart' as api; |
| 13 | 11 |
| 14 class HttpServerMock extends http.BaseClient { | 12 class HttpServerMock extends http.BaseClient { |
| 15 core.Function _callback; | 13 core.Function _callback; |
| 16 core.bool _expectJson; | 14 core.bool _expectJson; |
| 17 | 15 |
| 18 void register(core.Function callback, core.bool expectJson) { | 16 void register(core.Function callback, core.bool expectJson) { |
| 19 _callback = callback; | 17 _callback = callback; |
| 20 _expectJson = expectJson; | 18 _expectJson = expectJson; |
| 21 } | 19 } |
| 22 | 20 |
| 23 async.Future<http.StreamedResponse> send(http.BaseRequest request) { | 21 async.Future<http.StreamedResponse> send(http.BaseRequest request) { |
| 24 if (_expectJson) { | 22 if (_expectJson) { |
| 25 return request.finalize() | 23 return request |
| 24 .finalize() |
| 26 .transform(convert.UTF8.decoder) | 25 .transform(convert.UTF8.decoder) |
| 27 .join('') | 26 .join('') |
| 28 .then((core.String jsonString) { | 27 .then((core.String jsonString) { |
| 29 if (jsonString.isEmpty) { | 28 if (jsonString.isEmpty) { |
| 30 return _callback(request, null); | 29 return _callback(request, null); |
| 31 } else { | 30 } else { |
| 32 return _callback(request, convert.JSON.decode(jsonString)); | 31 return _callback(request, convert.JSON.decode(jsonString)); |
| 33 } | 32 } |
| 34 }); | 33 }); |
| 35 } else { | 34 } else { |
| 36 var stream = request.finalize(); | 35 var stream = request.finalize(); |
| 37 if (stream == null) { | 36 if (stream == null) { |
| 38 return _callback(request, []); | 37 return _callback(request, []); |
| 39 } else { | 38 } else { |
| 40 return stream.toBytes().then((data) { | 39 return stream.toBytes().then((data) { |
| 41 return _callback(request, data); | 40 return _callback(request, data); |
| 42 }); | 41 }); |
| 43 } | 42 } |
| 44 } | 43 } |
| 45 } | 44 } |
| 46 } | 45 } |
| 47 | 46 |
| 48 http.StreamedResponse stringResponse( | 47 http.StreamedResponse stringResponse(core.int status, |
| 49 core.int status, core.Map<core.String, core.String> headers, core.String bod
y) { | 48 core.Map<core.String, core.String> headers, core.String body) { |
| 50 var stream = new async.Stream.fromIterable([convert.UTF8.encode(body)]); | 49 var stream = new async.Stream.fromIterable([convert.UTF8.encode(body)]); |
| 51 return new http.StreamedResponse(stream, status, headers: headers); | 50 return new http.StreamedResponse(stream, status, headers: headers); |
| 52 } | 51 } |
| 53 | 52 |
| 54 buildUnnamed75() { | 53 buildUnnamed70() { |
| 55 var o = new core.List<api.FieldMask>(); | 54 var o = new core.List<api.FieldMask>(); |
| 56 o.add(buildFieldMask()); | 55 o.add(buildFieldMask()); |
| 57 o.add(buildFieldMask()); | 56 o.add(buildFieldMask()); |
| 58 return o; | 57 return o; |
| 59 } | 58 } |
| 60 | 59 |
| 61 checkUnnamed75(core.List<api.FieldMask> o) { | 60 checkUnnamed70(core.List<api.FieldMask> o) { |
| 62 unittest.expect(o, unittest.hasLength(2)); | 61 unittest.expect(o, unittest.hasLength(2)); |
| 63 checkFieldMask(o[0]); | 62 checkFieldMask(o[0]); |
| 64 checkFieldMask(o[1]); | 63 checkFieldMask(o[1]); |
| 65 } | 64 } |
| 66 | 65 |
| 67 core.int buildCounterFieldMask = 0; | 66 core.int buildCounterFieldMask = 0; |
| 68 buildFieldMask() { | 67 buildFieldMask() { |
| 69 var o = new api.FieldMask(); | 68 var o = new api.FieldMask(); |
| 70 buildCounterFieldMask++; | 69 buildCounterFieldMask++; |
| 71 if (buildCounterFieldMask < 3) { | 70 if (buildCounterFieldMask < 3) { |
| 72 o.fields = buildUnnamed75(); | 71 o.fields = buildUnnamed70(); |
| 73 o.id = 42; | 72 o.id = 42; |
| 74 } | 73 } |
| 75 buildCounterFieldMask--; | 74 buildCounterFieldMask--; |
| 76 return o; | 75 return o; |
| 77 } | 76 } |
| 78 | 77 |
| 79 checkFieldMask(api.FieldMask o) { | 78 checkFieldMask(api.FieldMask o) { |
| 80 buildCounterFieldMask++; | 79 buildCounterFieldMask++; |
| 81 if (buildCounterFieldMask < 3) { | 80 if (buildCounterFieldMask < 3) { |
| 82 checkUnnamed75(o.fields); | 81 checkUnnamed70(o.fields); |
| 83 unittest.expect(o.id, unittest.equals(42)); | 82 unittest.expect(o.id, unittest.equals(42)); |
| 84 } | 83 } |
| 85 buildCounterFieldMask--; | 84 buildCounterFieldMask--; |
| 86 } | 85 } |
| 87 | 86 |
| 88 buildUnnamed76() { | 87 buildUnnamed71() { |
| 89 var o = new core.List<core.String>(); | 88 var o = new core.List<core.String>(); |
| 90 o.add("foo"); | 89 o.add("foo"); |
| 91 o.add("foo"); | 90 o.add("foo"); |
| 92 return o; | 91 return o; |
| 93 } | 92 } |
| 94 | 93 |
| 95 checkUnnamed76(core.List<core.String> o) { | 94 checkUnnamed71(core.List<core.String> o) { |
| 96 unittest.expect(o, unittest.hasLength(2)); | 95 unittest.expect(o, unittest.hasLength(2)); |
| 97 unittest.expect(o[0], unittest.equals('foo')); | 96 unittest.expect(o[0], unittest.equals('foo')); |
| 98 unittest.expect(o[1], unittest.equals('foo')); | 97 unittest.expect(o[1], unittest.equals('foo')); |
| 99 } | 98 } |
| 100 | 99 |
| 101 core.int buildCounterMobileAppPanel = 0; | 100 core.int buildCounterMobileAppPanel = 0; |
| 102 buildMobileAppPanel() { | 101 buildMobileAppPanel() { |
| 103 var o = new api.MobileAppPanel(); | 102 var o = new api.MobileAppPanel(); |
| 104 buildCounterMobileAppPanel++; | 103 buildCounterMobileAppPanel++; |
| 105 if (buildCounterMobileAppPanel < 3) { | 104 if (buildCounterMobileAppPanel < 3) { |
| 106 o.country = "foo"; | 105 o.country = "foo"; |
| 107 o.isPublicPanel = true; | 106 o.isPublicPanel = true; |
| 108 o.language = "foo"; | 107 o.language = "foo"; |
| 109 o.mobileAppPanelId = "foo"; | 108 o.mobileAppPanelId = "foo"; |
| 110 o.name = "foo"; | 109 o.name = "foo"; |
| 111 o.owners = buildUnnamed76(); | 110 o.owners = buildUnnamed71(); |
| 112 } | 111 } |
| 113 buildCounterMobileAppPanel--; | 112 buildCounterMobileAppPanel--; |
| 114 return o; | 113 return o; |
| 115 } | 114 } |
| 116 | 115 |
| 117 checkMobileAppPanel(api.MobileAppPanel o) { | 116 checkMobileAppPanel(api.MobileAppPanel o) { |
| 118 buildCounterMobileAppPanel++; | 117 buildCounterMobileAppPanel++; |
| 119 if (buildCounterMobileAppPanel < 3) { | 118 if (buildCounterMobileAppPanel < 3) { |
| 120 unittest.expect(o.country, unittest.equals('foo')); | 119 unittest.expect(o.country, unittest.equals('foo')); |
| 121 unittest.expect(o.isPublicPanel, unittest.isTrue); | 120 unittest.expect(o.isPublicPanel, unittest.isTrue); |
| 122 unittest.expect(o.language, unittest.equals('foo')); | 121 unittest.expect(o.language, unittest.equals('foo')); |
| 123 unittest.expect(o.mobileAppPanelId, unittest.equals('foo')); | 122 unittest.expect(o.mobileAppPanelId, unittest.equals('foo')); |
| 124 unittest.expect(o.name, unittest.equals('foo')); | 123 unittest.expect(o.name, unittest.equals('foo')); |
| 125 checkUnnamed76(o.owners); | 124 checkUnnamed71(o.owners); |
| 126 } | 125 } |
| 127 buildCounterMobileAppPanel--; | 126 buildCounterMobileAppPanel--; |
| 128 } | 127 } |
| 129 | 128 |
| 130 buildUnnamed77() { | 129 buildUnnamed72() { |
| 131 var o = new core.List<api.MobileAppPanel>(); | 130 var o = new core.List<api.MobileAppPanel>(); |
| 132 o.add(buildMobileAppPanel()); | 131 o.add(buildMobileAppPanel()); |
| 133 o.add(buildMobileAppPanel()); | 132 o.add(buildMobileAppPanel()); |
| 134 return o; | 133 return o; |
| 135 } | 134 } |
| 136 | 135 |
| 137 checkUnnamed77(core.List<api.MobileAppPanel> o) { | 136 checkUnnamed72(core.List<api.MobileAppPanel> o) { |
| 138 unittest.expect(o, unittest.hasLength(2)); | 137 unittest.expect(o, unittest.hasLength(2)); |
| 139 checkMobileAppPanel(o[0]); | 138 checkMobileAppPanel(o[0]); |
| 140 checkMobileAppPanel(o[1]); | 139 checkMobileAppPanel(o[1]); |
| 141 } | 140 } |
| 142 | 141 |
| 143 core.int buildCounterMobileAppPanelsListResponse = 0; | 142 core.int buildCounterMobileAppPanelsListResponse = 0; |
| 144 buildMobileAppPanelsListResponse() { | 143 buildMobileAppPanelsListResponse() { |
| 145 var o = new api.MobileAppPanelsListResponse(); | 144 var o = new api.MobileAppPanelsListResponse(); |
| 146 buildCounterMobileAppPanelsListResponse++; | 145 buildCounterMobileAppPanelsListResponse++; |
| 147 if (buildCounterMobileAppPanelsListResponse < 3) { | 146 if (buildCounterMobileAppPanelsListResponse < 3) { |
| 148 o.pageInfo = buildPageInfo(); | 147 o.pageInfo = buildPageInfo(); |
| 149 o.requestId = "foo"; | 148 o.requestId = "foo"; |
| 150 o.resources = buildUnnamed77(); | 149 o.resources = buildUnnamed72(); |
| 151 o.tokenPagination = buildTokenPagination(); | 150 o.tokenPagination = buildTokenPagination(); |
| 152 } | 151 } |
| 153 buildCounterMobileAppPanelsListResponse--; | 152 buildCounterMobileAppPanelsListResponse--; |
| 154 return o; | 153 return o; |
| 155 } | 154 } |
| 156 | 155 |
| 157 checkMobileAppPanelsListResponse(api.MobileAppPanelsListResponse o) { | 156 checkMobileAppPanelsListResponse(api.MobileAppPanelsListResponse o) { |
| 158 buildCounterMobileAppPanelsListResponse++; | 157 buildCounterMobileAppPanelsListResponse++; |
| 159 if (buildCounterMobileAppPanelsListResponse < 3) { | 158 if (buildCounterMobileAppPanelsListResponse < 3) { |
| 160 checkPageInfo(o.pageInfo); | 159 checkPageInfo(o.pageInfo); |
| 161 unittest.expect(o.requestId, unittest.equals('foo')); | 160 unittest.expect(o.requestId, unittest.equals('foo')); |
| 162 checkUnnamed77(o.resources); | 161 checkUnnamed72(o.resources); |
| 163 checkTokenPagination(o.tokenPagination); | 162 checkTokenPagination(o.tokenPagination); |
| 164 } | 163 } |
| 165 buildCounterMobileAppPanelsListResponse--; | 164 buildCounterMobileAppPanelsListResponse--; |
| 166 } | 165 } |
| 167 | 166 |
| 168 core.int buildCounterPageInfo = 0; | 167 core.int buildCounterPageInfo = 0; |
| 169 buildPageInfo() { | 168 buildPageInfo() { |
| 170 var o = new api.PageInfo(); | 169 var o = new api.PageInfo(); |
| 171 buildCounterPageInfo++; | 170 buildCounterPageInfo++; |
| 172 if (buildCounterPageInfo < 3) { | 171 if (buildCounterPageInfo < 3) { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 200 } | 199 } |
| 201 | 200 |
| 202 checkResultsGetRequest(api.ResultsGetRequest o) { | 201 checkResultsGetRequest(api.ResultsGetRequest o) { |
| 203 buildCounterResultsGetRequest++; | 202 buildCounterResultsGetRequest++; |
| 204 if (buildCounterResultsGetRequest < 3) { | 203 if (buildCounterResultsGetRequest < 3) { |
| 205 checkResultsMask(o.resultMask); | 204 checkResultsMask(o.resultMask); |
| 206 } | 205 } |
| 207 buildCounterResultsGetRequest--; | 206 buildCounterResultsGetRequest--; |
| 208 } | 207 } |
| 209 | 208 |
| 210 buildUnnamed78() { | 209 buildUnnamed73() { |
| 211 var o = new core.List<api.FieldMask>(); | 210 var o = new core.List<api.FieldMask>(); |
| 212 o.add(buildFieldMask()); | 211 o.add(buildFieldMask()); |
| 213 o.add(buildFieldMask()); | 212 o.add(buildFieldMask()); |
| 214 return o; | 213 return o; |
| 215 } | 214 } |
| 216 | 215 |
| 217 checkUnnamed78(core.List<api.FieldMask> o) { | 216 checkUnnamed73(core.List<api.FieldMask> o) { |
| 218 unittest.expect(o, unittest.hasLength(2)); | 217 unittest.expect(o, unittest.hasLength(2)); |
| 219 checkFieldMask(o[0]); | 218 checkFieldMask(o[0]); |
| 220 checkFieldMask(o[1]); | 219 checkFieldMask(o[1]); |
| 221 } | 220 } |
| 222 | 221 |
| 223 core.int buildCounterResultsMask = 0; | 222 core.int buildCounterResultsMask = 0; |
| 224 buildResultsMask() { | 223 buildResultsMask() { |
| 225 var o = new api.ResultsMask(); | 224 var o = new api.ResultsMask(); |
| 226 buildCounterResultsMask++; | 225 buildCounterResultsMask++; |
| 227 if (buildCounterResultsMask < 3) { | 226 if (buildCounterResultsMask < 3) { |
| 228 o.fields = buildUnnamed78(); | 227 o.fields = buildUnnamed73(); |
| 229 o.projection = "foo"; | 228 o.projection = "foo"; |
| 230 } | 229 } |
| 231 buildCounterResultsMask--; | 230 buildCounterResultsMask--; |
| 232 return o; | 231 return o; |
| 233 } | 232 } |
| 234 | 233 |
| 235 checkResultsMask(api.ResultsMask o) { | 234 checkResultsMask(api.ResultsMask o) { |
| 236 buildCounterResultsMask++; | 235 buildCounterResultsMask++; |
| 237 if (buildCounterResultsMask < 3) { | 236 if (buildCounterResultsMask < 3) { |
| 238 checkUnnamed78(o.fields); | 237 checkUnnamed73(o.fields); |
| 239 unittest.expect(o.projection, unittest.equals('foo')); | 238 unittest.expect(o.projection, unittest.equals('foo')); |
| 240 } | 239 } |
| 241 buildCounterResultsMask--; | 240 buildCounterResultsMask--; |
| 242 } | 241 } |
| 243 | 242 |
| 244 buildUnnamed79() { | 243 buildUnnamed74() { |
| 245 var o = new core.List<core.String>(); | 244 var o = new core.List<core.String>(); |
| 246 o.add("foo"); | 245 o.add("foo"); |
| 247 o.add("foo"); | 246 o.add("foo"); |
| 248 return o; | 247 return o; |
| 249 } | 248 } |
| 250 | 249 |
| 251 checkUnnamed79(core.List<core.String> o) { | 250 checkUnnamed74(core.List<core.String> o) { |
| 252 unittest.expect(o, unittest.hasLength(2)); | 251 unittest.expect(o, unittest.hasLength(2)); |
| 253 unittest.expect(o[0], unittest.equals('foo')); | 252 unittest.expect(o[0], unittest.equals('foo')); |
| 254 unittest.expect(o[1], unittest.equals('foo')); | 253 unittest.expect(o[1], unittest.equals('foo')); |
| 255 } | 254 } |
| 256 | 255 |
| 257 buildUnnamed80() { | 256 buildUnnamed75() { |
| 258 var o = new core.List<api.SurveyQuestion>(); | 257 var o = new core.List<api.SurveyQuestion>(); |
| 259 o.add(buildSurveyQuestion()); | 258 o.add(buildSurveyQuestion()); |
| 260 o.add(buildSurveyQuestion()); | 259 o.add(buildSurveyQuestion()); |
| 261 return o; | 260 return o; |
| 262 } | 261 } |
| 263 | 262 |
| 264 checkUnnamed80(core.List<api.SurveyQuestion> o) { | 263 checkUnnamed75(core.List<api.SurveyQuestion> o) { |
| 265 unittest.expect(o, unittest.hasLength(2)); | 264 unittest.expect(o, unittest.hasLength(2)); |
| 266 checkSurveyQuestion(o[0]); | 265 checkSurveyQuestion(o[0]); |
| 267 checkSurveyQuestion(o[1]); | 266 checkSurveyQuestion(o[1]); |
| 268 } | 267 } |
| 269 | 268 |
| 270 core.int buildCounterSurvey = 0; | 269 core.int buildCounterSurvey = 0; |
| 271 buildSurvey() { | 270 buildSurvey() { |
| 272 var o = new api.Survey(); | 271 var o = new api.Survey(); |
| 273 buildCounterSurvey++; | 272 buildCounterSurvey++; |
| 274 if (buildCounterSurvey < 3) { | 273 if (buildCounterSurvey < 3) { |
| 275 o.audience = buildSurveyAudience(); | 274 o.audience = buildSurveyAudience(); |
| 276 o.cost = buildSurveyCost(); | 275 o.cost = buildSurveyCost(); |
| 277 o.customerData = "foo"; | 276 o.customerData = "foo"; |
| 278 o.description = "foo"; | 277 o.description = "foo"; |
| 279 o.owners = buildUnnamed79(); | 278 o.owners = buildUnnamed74(); |
| 280 o.questions = buildUnnamed80(); | 279 o.questions = buildUnnamed75(); |
| 281 o.rejectionReason = buildSurveyRejection(); | 280 o.rejectionReason = buildSurveyRejection(); |
| 282 o.state = "foo"; | 281 o.state = "foo"; |
| 283 o.surveyUrlId = "foo"; | 282 o.surveyUrlId = "foo"; |
| 284 o.title = "foo"; | 283 o.title = "foo"; |
| 285 o.wantedResponseCount = 42; | 284 o.wantedResponseCount = 42; |
| 286 } | 285 } |
| 287 buildCounterSurvey--; | 286 buildCounterSurvey--; |
| 288 return o; | 287 return o; |
| 289 } | 288 } |
| 290 | 289 |
| 291 checkSurvey(api.Survey o) { | 290 checkSurvey(api.Survey o) { |
| 292 buildCounterSurvey++; | 291 buildCounterSurvey++; |
| 293 if (buildCounterSurvey < 3) { | 292 if (buildCounterSurvey < 3) { |
| 294 checkSurveyAudience(o.audience); | 293 checkSurveyAudience(o.audience); |
| 295 checkSurveyCost(o.cost); | 294 checkSurveyCost(o.cost); |
| 296 unittest.expect(o.customerData, unittest.equals('foo')); | 295 unittest.expect(o.customerData, unittest.equals('foo')); |
| 297 unittest.expect(o.description, unittest.equals('foo')); | 296 unittest.expect(o.description, unittest.equals('foo')); |
| 298 checkUnnamed79(o.owners); | 297 checkUnnamed74(o.owners); |
| 299 checkUnnamed80(o.questions); | 298 checkUnnamed75(o.questions); |
| 300 checkSurveyRejection(o.rejectionReason); | 299 checkSurveyRejection(o.rejectionReason); |
| 301 unittest.expect(o.state, unittest.equals('foo')); | 300 unittest.expect(o.state, unittest.equals('foo')); |
| 302 unittest.expect(o.surveyUrlId, unittest.equals('foo')); | 301 unittest.expect(o.surveyUrlId, unittest.equals('foo')); |
| 303 unittest.expect(o.title, unittest.equals('foo')); | 302 unittest.expect(o.title, unittest.equals('foo')); |
| 304 unittest.expect(o.wantedResponseCount, unittest.equals(42)); | 303 unittest.expect(o.wantedResponseCount, unittest.equals(42)); |
| 305 } | 304 } |
| 306 buildCounterSurvey--; | 305 buildCounterSurvey--; |
| 307 } | 306 } |
| 308 | 307 |
| 309 buildUnnamed81() { | 308 buildUnnamed76() { |
| 310 var o = new core.List<core.String>(); | 309 var o = new core.List<core.String>(); |
| 311 o.add("foo"); | 310 o.add("foo"); |
| 312 o.add("foo"); | 311 o.add("foo"); |
| 313 return o; | 312 return o; |
| 314 } | 313 } |
| 315 | 314 |
| 316 checkUnnamed81(core.List<core.String> o) { | 315 checkUnnamed76(core.List<core.String> o) { |
| 317 unittest.expect(o, unittest.hasLength(2)); | 316 unittest.expect(o, unittest.hasLength(2)); |
| 318 unittest.expect(o[0], unittest.equals('foo')); | 317 unittest.expect(o[0], unittest.equals('foo')); |
| 319 unittest.expect(o[1], unittest.equals('foo')); | 318 unittest.expect(o[1], unittest.equals('foo')); |
| 320 } | 319 } |
| 321 | 320 |
| 322 buildUnnamed82() { | 321 buildUnnamed77() { |
| 323 var o = new core.List<core.String>(); | 322 var o = new core.List<core.String>(); |
| 324 o.add("foo"); | 323 o.add("foo"); |
| 325 o.add("foo"); | 324 o.add("foo"); |
| 326 return o; | 325 return o; |
| 327 } | 326 } |
| 328 | 327 |
| 329 checkUnnamed82(core.List<core.String> o) { | 328 checkUnnamed77(core.List<core.String> o) { |
| 330 unittest.expect(o, unittest.hasLength(2)); | 329 unittest.expect(o, unittest.hasLength(2)); |
| 331 unittest.expect(o[0], unittest.equals('foo')); | 330 unittest.expect(o[0], unittest.equals('foo')); |
| 332 unittest.expect(o[1], unittest.equals('foo')); | 331 unittest.expect(o[1], unittest.equals('foo')); |
| 333 } | 332 } |
| 334 | 333 |
| 335 core.int buildCounterSurveyAudience = 0; | 334 core.int buildCounterSurveyAudience = 0; |
| 336 buildSurveyAudience() { | 335 buildSurveyAudience() { |
| 337 var o = new api.SurveyAudience(); | 336 var o = new api.SurveyAudience(); |
| 338 buildCounterSurveyAudience++; | 337 buildCounterSurveyAudience++; |
| 339 if (buildCounterSurveyAudience < 3) { | 338 if (buildCounterSurveyAudience < 3) { |
| 340 o.ages = buildUnnamed81(); | 339 o.ages = buildUnnamed76(); |
| 341 o.country = "foo"; | 340 o.country = "foo"; |
| 342 o.countrySubdivision = "foo"; | 341 o.countrySubdivision = "foo"; |
| 343 o.gender = "foo"; | 342 o.gender = "foo"; |
| 344 o.languages = buildUnnamed82(); | 343 o.languages = buildUnnamed77(); |
| 345 o.mobileAppPanelId = "foo"; | 344 o.mobileAppPanelId = "foo"; |
| 346 o.populationSource = "foo"; | 345 o.populationSource = "foo"; |
| 347 } | 346 } |
| 348 buildCounterSurveyAudience--; | 347 buildCounterSurveyAudience--; |
| 349 return o; | 348 return o; |
| 350 } | 349 } |
| 351 | 350 |
| 352 checkSurveyAudience(api.SurveyAudience o) { | 351 checkSurveyAudience(api.SurveyAudience o) { |
| 353 buildCounterSurveyAudience++; | 352 buildCounterSurveyAudience++; |
| 354 if (buildCounterSurveyAudience < 3) { | 353 if (buildCounterSurveyAudience < 3) { |
| 355 checkUnnamed81(o.ages); | 354 checkUnnamed76(o.ages); |
| 356 unittest.expect(o.country, unittest.equals('foo')); | 355 unittest.expect(o.country, unittest.equals('foo')); |
| 357 unittest.expect(o.countrySubdivision, unittest.equals('foo')); | 356 unittest.expect(o.countrySubdivision, unittest.equals('foo')); |
| 358 unittest.expect(o.gender, unittest.equals('foo')); | 357 unittest.expect(o.gender, unittest.equals('foo')); |
| 359 checkUnnamed82(o.languages); | 358 checkUnnamed77(o.languages); |
| 360 unittest.expect(o.mobileAppPanelId, unittest.equals('foo')); | 359 unittest.expect(o.mobileAppPanelId, unittest.equals('foo')); |
| 361 unittest.expect(o.populationSource, unittest.equals('foo')); | 360 unittest.expect(o.populationSource, unittest.equals('foo')); |
| 362 } | 361 } |
| 363 buildCounterSurveyAudience--; | 362 buildCounterSurveyAudience--; |
| 364 } | 363 } |
| 365 | 364 |
| 366 core.int buildCounterSurveyCost = 0; | 365 core.int buildCounterSurveyCost = 0; |
| 367 buildSurveyCost() { | 366 buildSurveyCost() { |
| 368 var o = new api.SurveyCost(); | 367 var o = new api.SurveyCost(); |
| 369 buildCounterSurveyCost++; | 368 buildCounterSurveyCost++; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 381 buildCounterSurveyCost++; | 380 buildCounterSurveyCost++; |
| 382 if (buildCounterSurveyCost < 3) { | 381 if (buildCounterSurveyCost < 3) { |
| 383 unittest.expect(o.costPerResponseNanos, unittest.equals('foo')); | 382 unittest.expect(o.costPerResponseNanos, unittest.equals('foo')); |
| 384 unittest.expect(o.currencyCode, unittest.equals('foo')); | 383 unittest.expect(o.currencyCode, unittest.equals('foo')); |
| 385 unittest.expect(o.maxCostPerResponseNanos, unittest.equals('foo')); | 384 unittest.expect(o.maxCostPerResponseNanos, unittest.equals('foo')); |
| 386 unittest.expect(o.nanos, unittest.equals('foo')); | 385 unittest.expect(o.nanos, unittest.equals('foo')); |
| 387 } | 386 } |
| 388 buildCounterSurveyCost--; | 387 buildCounterSurveyCost--; |
| 389 } | 388 } |
| 390 | 389 |
| 391 buildUnnamed83() { | 390 buildUnnamed78() { |
| 392 var o = new core.List<core.String>(); | 391 var o = new core.List<core.String>(); |
| 393 o.add("foo"); | 392 o.add("foo"); |
| 394 o.add("foo"); | 393 o.add("foo"); |
| 395 return o; | 394 return o; |
| 396 } | 395 } |
| 397 | 396 |
| 398 checkUnnamed83(core.List<core.String> o) { | 397 checkUnnamed78(core.List<core.String> o) { |
| 399 unittest.expect(o, unittest.hasLength(2)); | 398 unittest.expect(o, unittest.hasLength(2)); |
| 400 unittest.expect(o[0], unittest.equals('foo')); | 399 unittest.expect(o[0], unittest.equals('foo')); |
| 401 unittest.expect(o[1], unittest.equals('foo')); | 400 unittest.expect(o[1], unittest.equals('foo')); |
| 402 } | 401 } |
| 403 | 402 |
| 404 buildUnnamed84() { | 403 buildUnnamed79() { |
| 405 var o = new core.List<api.SurveyQuestionImage>(); | 404 var o = new core.List<api.SurveyQuestionImage>(); |
| 406 o.add(buildSurveyQuestionImage()); | 405 o.add(buildSurveyQuestionImage()); |
| 407 o.add(buildSurveyQuestionImage()); | 406 o.add(buildSurveyQuestionImage()); |
| 408 return o; | 407 return o; |
| 409 } | 408 } |
| 410 | 409 |
| 411 checkUnnamed84(core.List<api.SurveyQuestionImage> o) { | 410 checkUnnamed79(core.List<api.SurveyQuestionImage> o) { |
| 412 unittest.expect(o, unittest.hasLength(2)); | 411 unittest.expect(o, unittest.hasLength(2)); |
| 413 checkSurveyQuestionImage(o[0]); | 412 checkSurveyQuestionImage(o[0]); |
| 414 checkSurveyQuestionImage(o[1]); | 413 checkSurveyQuestionImage(o[1]); |
| 415 } | 414 } |
| 416 | 415 |
| 417 buildUnnamed85() { | 416 buildUnnamed80() { |
| 418 var o = new core.List<core.String>(); | 417 var o = new core.List<core.String>(); |
| 419 o.add("foo"); | 418 o.add("foo"); |
| 420 o.add("foo"); | 419 o.add("foo"); |
| 421 return o; | 420 return o; |
| 422 } | 421 } |
| 423 | 422 |
| 424 checkUnnamed85(core.List<core.String> o) { | 423 checkUnnamed80(core.List<core.String> o) { |
| 425 unittest.expect(o, unittest.hasLength(2)); | 424 unittest.expect(o, unittest.hasLength(2)); |
| 426 unittest.expect(o[0], unittest.equals('foo')); | 425 unittest.expect(o[0], unittest.equals('foo')); |
| 427 unittest.expect(o[1], unittest.equals('foo')); | 426 unittest.expect(o[1], unittest.equals('foo')); |
| 428 } | 427 } |
| 429 | 428 |
| 430 buildUnnamed86() { | 429 buildUnnamed81() { |
| 431 var o = new core.List<core.String>(); | 430 var o = new core.List<core.String>(); |
| 432 o.add("foo"); | 431 o.add("foo"); |
| 433 o.add("foo"); | 432 o.add("foo"); |
| 434 return o; | 433 return o; |
| 435 } | 434 } |
| 436 | 435 |
| 437 checkUnnamed86(core.List<core.String> o) { | 436 checkUnnamed81(core.List<core.String> o) { |
| 438 unittest.expect(o, unittest.hasLength(2)); | 437 unittest.expect(o, unittest.hasLength(2)); |
| 439 unittest.expect(o[0], unittest.equals('foo')); | 438 unittest.expect(o[0], unittest.equals('foo')); |
| 440 unittest.expect(o[1], unittest.equals('foo')); | 439 unittest.expect(o[1], unittest.equals('foo')); |
| 441 } | 440 } |
| 442 | 441 |
| 443 core.int buildCounterSurveyQuestion = 0; | 442 core.int buildCounterSurveyQuestion = 0; |
| 444 buildSurveyQuestion() { | 443 buildSurveyQuestion() { |
| 445 var o = new api.SurveyQuestion(); | 444 var o = new api.SurveyQuestion(); |
| 446 buildCounterSurveyQuestion++; | 445 buildCounterSurveyQuestion++; |
| 447 if (buildCounterSurveyQuestion < 3) { | 446 if (buildCounterSurveyQuestion < 3) { |
| 448 o.answerOrder = "foo"; | 447 o.answerOrder = "foo"; |
| 449 o.answers = buildUnnamed83(); | 448 o.answers = buildUnnamed78(); |
| 450 o.hasOther = true; | 449 o.hasOther = true; |
| 451 o.highValueLabel = "foo"; | 450 o.highValueLabel = "foo"; |
| 452 o.images = buildUnnamed84(); | 451 o.images = buildUnnamed79(); |
| 453 o.lastAnswerPositionPinned = true; | 452 o.lastAnswerPositionPinned = true; |
| 454 o.lowValueLabel = "foo"; | 453 o.lowValueLabel = "foo"; |
| 455 o.mustPickSuggestion = true; | 454 o.mustPickSuggestion = true; |
| 456 o.numStars = "foo"; | 455 o.numStars = "foo"; |
| 457 o.openTextPlaceholder = "foo"; | 456 o.openTextPlaceholder = "foo"; |
| 458 o.openTextSuggestions = buildUnnamed85(); | 457 o.openTextSuggestions = buildUnnamed80(); |
| 459 o.question = "foo"; | 458 o.question = "foo"; |
| 460 o.sentimentText = "foo"; | 459 o.sentimentText = "foo"; |
| 461 o.singleLineResponse = true; | 460 o.singleLineResponse = true; |
| 462 o.thresholdAnswers = buildUnnamed86(); | 461 o.thresholdAnswers = buildUnnamed81(); |
| 463 o.type = "foo"; | 462 o.type = "foo"; |
| 464 o.unitOfMeasurementLabel = "foo"; | 463 o.unitOfMeasurementLabel = "foo"; |
| 465 o.videoId = "foo"; | 464 o.videoId = "foo"; |
| 466 } | 465 } |
| 467 buildCounterSurveyQuestion--; | 466 buildCounterSurveyQuestion--; |
| 468 return o; | 467 return o; |
| 469 } | 468 } |
| 470 | 469 |
| 471 checkSurveyQuestion(api.SurveyQuestion o) { | 470 checkSurveyQuestion(api.SurveyQuestion o) { |
| 472 buildCounterSurveyQuestion++; | 471 buildCounterSurveyQuestion++; |
| 473 if (buildCounterSurveyQuestion < 3) { | 472 if (buildCounterSurveyQuestion < 3) { |
| 474 unittest.expect(o.answerOrder, unittest.equals('foo')); | 473 unittest.expect(o.answerOrder, unittest.equals('foo')); |
| 475 checkUnnamed83(o.answers); | 474 checkUnnamed78(o.answers); |
| 476 unittest.expect(o.hasOther, unittest.isTrue); | 475 unittest.expect(o.hasOther, unittest.isTrue); |
| 477 unittest.expect(o.highValueLabel, unittest.equals('foo')); | 476 unittest.expect(o.highValueLabel, unittest.equals('foo')); |
| 478 checkUnnamed84(o.images); | 477 checkUnnamed79(o.images); |
| 479 unittest.expect(o.lastAnswerPositionPinned, unittest.isTrue); | 478 unittest.expect(o.lastAnswerPositionPinned, unittest.isTrue); |
| 480 unittest.expect(o.lowValueLabel, unittest.equals('foo')); | 479 unittest.expect(o.lowValueLabel, unittest.equals('foo')); |
| 481 unittest.expect(o.mustPickSuggestion, unittest.isTrue); | 480 unittest.expect(o.mustPickSuggestion, unittest.isTrue); |
| 482 unittest.expect(o.numStars, unittest.equals('foo')); | 481 unittest.expect(o.numStars, unittest.equals('foo')); |
| 483 unittest.expect(o.openTextPlaceholder, unittest.equals('foo')); | 482 unittest.expect(o.openTextPlaceholder, unittest.equals('foo')); |
| 484 checkUnnamed85(o.openTextSuggestions); | 483 checkUnnamed80(o.openTextSuggestions); |
| 485 unittest.expect(o.question, unittest.equals('foo')); | 484 unittest.expect(o.question, unittest.equals('foo')); |
| 486 unittest.expect(o.sentimentText, unittest.equals('foo')); | 485 unittest.expect(o.sentimentText, unittest.equals('foo')); |
| 487 unittest.expect(o.singleLineResponse, unittest.isTrue); | 486 unittest.expect(o.singleLineResponse, unittest.isTrue); |
| 488 checkUnnamed86(o.thresholdAnswers); | 487 checkUnnamed81(o.thresholdAnswers); |
| 489 unittest.expect(o.type, unittest.equals('foo')); | 488 unittest.expect(o.type, unittest.equals('foo')); |
| 490 unittest.expect(o.unitOfMeasurementLabel, unittest.equals('foo')); | 489 unittest.expect(o.unitOfMeasurementLabel, unittest.equals('foo')); |
| 491 unittest.expect(o.videoId, unittest.equals('foo')); | 490 unittest.expect(o.videoId, unittest.equals('foo')); |
| 492 } | 491 } |
| 493 buildCounterSurveyQuestion--; | 492 buildCounterSurveyQuestion--; |
| 494 } | 493 } |
| 495 | 494 |
| 496 core.int buildCounterSurveyQuestionImage = 0; | 495 core.int buildCounterSurveyQuestionImage = 0; |
| 497 buildSurveyQuestionImage() { | 496 buildSurveyQuestionImage() { |
| 498 var o = new api.SurveyQuestionImage(); | 497 var o = new api.SurveyQuestionImage(); |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 570 } | 569 } |
| 571 | 570 |
| 572 checkSurveysDeleteResponse(api.SurveysDeleteResponse o) { | 571 checkSurveysDeleteResponse(api.SurveysDeleteResponse o) { |
| 573 buildCounterSurveysDeleteResponse++; | 572 buildCounterSurveysDeleteResponse++; |
| 574 if (buildCounterSurveysDeleteResponse < 3) { | 573 if (buildCounterSurveysDeleteResponse < 3) { |
| 575 unittest.expect(o.requestId, unittest.equals('foo')); | 574 unittest.expect(o.requestId, unittest.equals('foo')); |
| 576 } | 575 } |
| 577 buildCounterSurveysDeleteResponse--; | 576 buildCounterSurveysDeleteResponse--; |
| 578 } | 577 } |
| 579 | 578 |
| 580 buildUnnamed87() { | 579 buildUnnamed82() { |
| 581 var o = new core.List<api.Survey>(); | 580 var o = new core.List<api.Survey>(); |
| 582 o.add(buildSurvey()); | 581 o.add(buildSurvey()); |
| 583 o.add(buildSurvey()); | 582 o.add(buildSurvey()); |
| 584 return o; | 583 return o; |
| 585 } | 584 } |
| 586 | 585 |
| 587 checkUnnamed87(core.List<api.Survey> o) { | 586 checkUnnamed82(core.List<api.Survey> o) { |
| 588 unittest.expect(o, unittest.hasLength(2)); | 587 unittest.expect(o, unittest.hasLength(2)); |
| 589 checkSurvey(o[0]); | 588 checkSurvey(o[0]); |
| 590 checkSurvey(o[1]); | 589 checkSurvey(o[1]); |
| 591 } | 590 } |
| 592 | 591 |
| 593 core.int buildCounterSurveysListResponse = 0; | 592 core.int buildCounterSurveysListResponse = 0; |
| 594 buildSurveysListResponse() { | 593 buildSurveysListResponse() { |
| 595 var o = new api.SurveysListResponse(); | 594 var o = new api.SurveysListResponse(); |
| 596 buildCounterSurveysListResponse++; | 595 buildCounterSurveysListResponse++; |
| 597 if (buildCounterSurveysListResponse < 3) { | 596 if (buildCounterSurveysListResponse < 3) { |
| 598 o.pageInfo = buildPageInfo(); | 597 o.pageInfo = buildPageInfo(); |
| 599 o.requestId = "foo"; | 598 o.requestId = "foo"; |
| 600 o.resources = buildUnnamed87(); | 599 o.resources = buildUnnamed82(); |
| 601 o.tokenPagination = buildTokenPagination(); | 600 o.tokenPagination = buildTokenPagination(); |
| 602 } | 601 } |
| 603 buildCounterSurveysListResponse--; | 602 buildCounterSurveysListResponse--; |
| 604 return o; | 603 return o; |
| 605 } | 604 } |
| 606 | 605 |
| 607 checkSurveysListResponse(api.SurveysListResponse o) { | 606 checkSurveysListResponse(api.SurveysListResponse o) { |
| 608 buildCounterSurveysListResponse++; | 607 buildCounterSurveysListResponse++; |
| 609 if (buildCounterSurveysListResponse < 3) { | 608 if (buildCounterSurveysListResponse < 3) { |
| 610 checkPageInfo(o.pageInfo); | 609 checkPageInfo(o.pageInfo); |
| 611 unittest.expect(o.requestId, unittest.equals('foo')); | 610 unittest.expect(o.requestId, unittest.equals('foo')); |
| 612 checkUnnamed87(o.resources); | 611 checkUnnamed82(o.resources); |
| 613 checkTokenPagination(o.tokenPagination); | 612 checkTokenPagination(o.tokenPagination); |
| 614 } | 613 } |
| 615 buildCounterSurveysListResponse--; | 614 buildCounterSurveysListResponse--; |
| 616 } | 615 } |
| 617 | 616 |
| 618 core.int buildCounterSurveysStartRequest = 0; | 617 core.int buildCounterSurveysStartRequest = 0; |
| 619 buildSurveysStartRequest() { | 618 buildSurveysStartRequest() { |
| 620 var o = new api.SurveysStartRequest(); | 619 var o = new api.SurveysStartRequest(); |
| 621 buildCounterSurveysStartRequest++; | 620 buildCounterSurveysStartRequest++; |
| 622 if (buildCounterSurveysStartRequest < 3) { | 621 if (buildCounterSurveysStartRequest < 3) { |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 686 | 685 |
| 687 checkTokenPagination(api.TokenPagination o) { | 686 checkTokenPagination(api.TokenPagination o) { |
| 688 buildCounterTokenPagination++; | 687 buildCounterTokenPagination++; |
| 689 if (buildCounterTokenPagination < 3) { | 688 if (buildCounterTokenPagination < 3) { |
| 690 unittest.expect(o.nextPageToken, unittest.equals('foo')); | 689 unittest.expect(o.nextPageToken, unittest.equals('foo')); |
| 691 unittest.expect(o.previousPageToken, unittest.equals('foo')); | 690 unittest.expect(o.previousPageToken, unittest.equals('foo')); |
| 692 } | 691 } |
| 693 buildCounterTokenPagination--; | 692 buildCounterTokenPagination--; |
| 694 } | 693 } |
| 695 | 694 |
| 696 | |
| 697 main() { | 695 main() { |
| 698 unittest.group("obj-schema-FieldMask", () { | 696 unittest.group("obj-schema-FieldMask", () { |
| 699 unittest.test("to-json--from-json", () { | 697 unittest.test("to-json--from-json", () { |
| 700 var o = buildFieldMask(); | 698 var o = buildFieldMask(); |
| 701 var od = new api.FieldMask.fromJson(o.toJson()); | 699 var od = new api.FieldMask.fromJson(o.toJson()); |
| 702 checkFieldMask(od); | 700 checkFieldMask(od); |
| 703 }); | 701 }); |
| 704 }); | 702 }); |
| 705 | 703 |
| 706 | |
| 707 unittest.group("obj-schema-MobileAppPanel", () { | 704 unittest.group("obj-schema-MobileAppPanel", () { |
| 708 unittest.test("to-json--from-json", () { | 705 unittest.test("to-json--from-json", () { |
| 709 var o = buildMobileAppPanel(); | 706 var o = buildMobileAppPanel(); |
| 710 var od = new api.MobileAppPanel.fromJson(o.toJson()); | 707 var od = new api.MobileAppPanel.fromJson(o.toJson()); |
| 711 checkMobileAppPanel(od); | 708 checkMobileAppPanel(od); |
| 712 }); | 709 }); |
| 713 }); | 710 }); |
| 714 | 711 |
| 715 | |
| 716 unittest.group("obj-schema-MobileAppPanelsListResponse", () { | 712 unittest.group("obj-schema-MobileAppPanelsListResponse", () { |
| 717 unittest.test("to-json--from-json", () { | 713 unittest.test("to-json--from-json", () { |
| 718 var o = buildMobileAppPanelsListResponse(); | 714 var o = buildMobileAppPanelsListResponse(); |
| 719 var od = new api.MobileAppPanelsListResponse.fromJson(o.toJson()); | 715 var od = new api.MobileAppPanelsListResponse.fromJson(o.toJson()); |
| 720 checkMobileAppPanelsListResponse(od); | 716 checkMobileAppPanelsListResponse(od); |
| 721 }); | 717 }); |
| 722 }); | 718 }); |
| 723 | 719 |
| 724 | |
| 725 unittest.group("obj-schema-PageInfo", () { | 720 unittest.group("obj-schema-PageInfo", () { |
| 726 unittest.test("to-json--from-json", () { | 721 unittest.test("to-json--from-json", () { |
| 727 var o = buildPageInfo(); | 722 var o = buildPageInfo(); |
| 728 var od = new api.PageInfo.fromJson(o.toJson()); | 723 var od = new api.PageInfo.fromJson(o.toJson()); |
| 729 checkPageInfo(od); | 724 checkPageInfo(od); |
| 730 }); | 725 }); |
| 731 }); | 726 }); |
| 732 | 727 |
| 733 | |
| 734 unittest.group("obj-schema-ResultsGetRequest", () { | 728 unittest.group("obj-schema-ResultsGetRequest", () { |
| 735 unittest.test("to-json--from-json", () { | 729 unittest.test("to-json--from-json", () { |
| 736 var o = buildResultsGetRequest(); | 730 var o = buildResultsGetRequest(); |
| 737 var od = new api.ResultsGetRequest.fromJson(o.toJson()); | 731 var od = new api.ResultsGetRequest.fromJson(o.toJson()); |
| 738 checkResultsGetRequest(od); | 732 checkResultsGetRequest(od); |
| 739 }); | 733 }); |
| 740 }); | 734 }); |
| 741 | 735 |
| 742 | |
| 743 unittest.group("obj-schema-ResultsMask", () { | 736 unittest.group("obj-schema-ResultsMask", () { |
| 744 unittest.test("to-json--from-json", () { | 737 unittest.test("to-json--from-json", () { |
| 745 var o = buildResultsMask(); | 738 var o = buildResultsMask(); |
| 746 var od = new api.ResultsMask.fromJson(o.toJson()); | 739 var od = new api.ResultsMask.fromJson(o.toJson()); |
| 747 checkResultsMask(od); | 740 checkResultsMask(od); |
| 748 }); | 741 }); |
| 749 }); | 742 }); |
| 750 | 743 |
| 751 | |
| 752 unittest.group("obj-schema-Survey", () { | 744 unittest.group("obj-schema-Survey", () { |
| 753 unittest.test("to-json--from-json", () { | 745 unittest.test("to-json--from-json", () { |
| 754 var o = buildSurvey(); | 746 var o = buildSurvey(); |
| 755 var od = new api.Survey.fromJson(o.toJson()); | 747 var od = new api.Survey.fromJson(o.toJson()); |
| 756 checkSurvey(od); | 748 checkSurvey(od); |
| 757 }); | 749 }); |
| 758 }); | 750 }); |
| 759 | 751 |
| 760 | |
| 761 unittest.group("obj-schema-SurveyAudience", () { | 752 unittest.group("obj-schema-SurveyAudience", () { |
| 762 unittest.test("to-json--from-json", () { | 753 unittest.test("to-json--from-json", () { |
| 763 var o = buildSurveyAudience(); | 754 var o = buildSurveyAudience(); |
| 764 var od = new api.SurveyAudience.fromJson(o.toJson()); | 755 var od = new api.SurveyAudience.fromJson(o.toJson()); |
| 765 checkSurveyAudience(od); | 756 checkSurveyAudience(od); |
| 766 }); | 757 }); |
| 767 }); | 758 }); |
| 768 | 759 |
| 769 | |
| 770 unittest.group("obj-schema-SurveyCost", () { | 760 unittest.group("obj-schema-SurveyCost", () { |
| 771 unittest.test("to-json--from-json", () { | 761 unittest.test("to-json--from-json", () { |
| 772 var o = buildSurveyCost(); | 762 var o = buildSurveyCost(); |
| 773 var od = new api.SurveyCost.fromJson(o.toJson()); | 763 var od = new api.SurveyCost.fromJson(o.toJson()); |
| 774 checkSurveyCost(od); | 764 checkSurveyCost(od); |
| 775 }); | 765 }); |
| 776 }); | 766 }); |
| 777 | 767 |
| 778 | |
| 779 unittest.group("obj-schema-SurveyQuestion", () { | 768 unittest.group("obj-schema-SurveyQuestion", () { |
| 780 unittest.test("to-json--from-json", () { | 769 unittest.test("to-json--from-json", () { |
| 781 var o = buildSurveyQuestion(); | 770 var o = buildSurveyQuestion(); |
| 782 var od = new api.SurveyQuestion.fromJson(o.toJson()); | 771 var od = new api.SurveyQuestion.fromJson(o.toJson()); |
| 783 checkSurveyQuestion(od); | 772 checkSurveyQuestion(od); |
| 784 }); | 773 }); |
| 785 }); | 774 }); |
| 786 | 775 |
| 787 | |
| 788 unittest.group("obj-schema-SurveyQuestionImage", () { | 776 unittest.group("obj-schema-SurveyQuestionImage", () { |
| 789 unittest.test("to-json--from-json", () { | 777 unittest.test("to-json--from-json", () { |
| 790 var o = buildSurveyQuestionImage(); | 778 var o = buildSurveyQuestionImage(); |
| 791 var od = new api.SurveyQuestionImage.fromJson(o.toJson()); | 779 var od = new api.SurveyQuestionImage.fromJson(o.toJson()); |
| 792 checkSurveyQuestionImage(od); | 780 checkSurveyQuestionImage(od); |
| 793 }); | 781 }); |
| 794 }); | 782 }); |
| 795 | 783 |
| 796 | |
| 797 unittest.group("obj-schema-SurveyRejection", () { | 784 unittest.group("obj-schema-SurveyRejection", () { |
| 798 unittest.test("to-json--from-json", () { | 785 unittest.test("to-json--from-json", () { |
| 799 var o = buildSurveyRejection(); | 786 var o = buildSurveyRejection(); |
| 800 var od = new api.SurveyRejection.fromJson(o.toJson()); | 787 var od = new api.SurveyRejection.fromJson(o.toJson()); |
| 801 checkSurveyRejection(od); | 788 checkSurveyRejection(od); |
| 802 }); | 789 }); |
| 803 }); | 790 }); |
| 804 | 791 |
| 805 | |
| 806 unittest.group("obj-schema-SurveyResults", () { | 792 unittest.group("obj-schema-SurveyResults", () { |
| 807 unittest.test("to-json--from-json", () { | 793 unittest.test("to-json--from-json", () { |
| 808 var o = buildSurveyResults(); | 794 var o = buildSurveyResults(); |
| 809 var od = new api.SurveyResults.fromJson(o.toJson()); | 795 var od = new api.SurveyResults.fromJson(o.toJson()); |
| 810 checkSurveyResults(od); | 796 checkSurveyResults(od); |
| 811 }); | 797 }); |
| 812 }); | 798 }); |
| 813 | 799 |
| 814 | |
| 815 unittest.group("obj-schema-SurveysDeleteResponse", () { | 800 unittest.group("obj-schema-SurveysDeleteResponse", () { |
| 816 unittest.test("to-json--from-json", () { | 801 unittest.test("to-json--from-json", () { |
| 817 var o = buildSurveysDeleteResponse(); | 802 var o = buildSurveysDeleteResponse(); |
| 818 var od = new api.SurveysDeleteResponse.fromJson(o.toJson()); | 803 var od = new api.SurveysDeleteResponse.fromJson(o.toJson()); |
| 819 checkSurveysDeleteResponse(od); | 804 checkSurveysDeleteResponse(od); |
| 820 }); | 805 }); |
| 821 }); | 806 }); |
| 822 | 807 |
| 823 | |
| 824 unittest.group("obj-schema-SurveysListResponse", () { | 808 unittest.group("obj-schema-SurveysListResponse", () { |
| 825 unittest.test("to-json--from-json", () { | 809 unittest.test("to-json--from-json", () { |
| 826 var o = buildSurveysListResponse(); | 810 var o = buildSurveysListResponse(); |
| 827 var od = new api.SurveysListResponse.fromJson(o.toJson()); | 811 var od = new api.SurveysListResponse.fromJson(o.toJson()); |
| 828 checkSurveysListResponse(od); | 812 checkSurveysListResponse(od); |
| 829 }); | 813 }); |
| 830 }); | 814 }); |
| 831 | 815 |
| 832 | |
| 833 unittest.group("obj-schema-SurveysStartRequest", () { | 816 unittest.group("obj-schema-SurveysStartRequest", () { |
| 834 unittest.test("to-json--from-json", () { | 817 unittest.test("to-json--from-json", () { |
| 835 var o = buildSurveysStartRequest(); | 818 var o = buildSurveysStartRequest(); |
| 836 var od = new api.SurveysStartRequest.fromJson(o.toJson()); | 819 var od = new api.SurveysStartRequest.fromJson(o.toJson()); |
| 837 checkSurveysStartRequest(od); | 820 checkSurveysStartRequest(od); |
| 838 }); | 821 }); |
| 839 }); | 822 }); |
| 840 | 823 |
| 841 | |
| 842 unittest.group("obj-schema-SurveysStartResponse", () { | 824 unittest.group("obj-schema-SurveysStartResponse", () { |
| 843 unittest.test("to-json--from-json", () { | 825 unittest.test("to-json--from-json", () { |
| 844 var o = buildSurveysStartResponse(); | 826 var o = buildSurveysStartResponse(); |
| 845 var od = new api.SurveysStartResponse.fromJson(o.toJson()); | 827 var od = new api.SurveysStartResponse.fromJson(o.toJson()); |
| 846 checkSurveysStartResponse(od); | 828 checkSurveysStartResponse(od); |
| 847 }); | 829 }); |
| 848 }); | 830 }); |
| 849 | 831 |
| 850 | |
| 851 unittest.group("obj-schema-SurveysStopResponse", () { | 832 unittest.group("obj-schema-SurveysStopResponse", () { |
| 852 unittest.test("to-json--from-json", () { | 833 unittest.test("to-json--from-json", () { |
| 853 var o = buildSurveysStopResponse(); | 834 var o = buildSurveysStopResponse(); |
| 854 var od = new api.SurveysStopResponse.fromJson(o.toJson()); | 835 var od = new api.SurveysStopResponse.fromJson(o.toJson()); |
| 855 checkSurveysStopResponse(od); | 836 checkSurveysStopResponse(od); |
| 856 }); | 837 }); |
| 857 }); | 838 }); |
| 858 | 839 |
| 859 | |
| 860 unittest.group("obj-schema-TokenPagination", () { | 840 unittest.group("obj-schema-TokenPagination", () { |
| 861 unittest.test("to-json--from-json", () { | 841 unittest.test("to-json--from-json", () { |
| 862 var o = buildTokenPagination(); | 842 var o = buildTokenPagination(); |
| 863 var od = new api.TokenPagination.fromJson(o.toJson()); | 843 var od = new api.TokenPagination.fromJson(o.toJson()); |
| 864 checkTokenPagination(od); | 844 checkTokenPagination(od); |
| 865 }); | 845 }); |
| 866 }); | 846 }); |
| 867 | 847 |
| 868 | |
| 869 unittest.group("resource-MobileapppanelsResourceApi", () { | 848 unittest.group("resource-MobileapppanelsResourceApi", () { |
| 870 unittest.test("method--get", () { | 849 unittest.test("method--get", () { |
| 871 | |
| 872 var mock = new HttpServerMock(); | 850 var mock = new HttpServerMock(); |
| 873 api.MobileapppanelsResourceApi res = new api.ConsumersurveysApi(mock).mobi
leapppanels; | 851 api.MobileapppanelsResourceApi res = |
| 852 new api.ConsumersurveysApi(mock).mobileapppanels; |
| 874 var arg_panelId = "foo"; | 853 var arg_panelId = "foo"; |
| 875 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 854 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 876 var path = (req.url).path; | 855 var path = (req.url).path; |
| 877 var pathOffset = 0; | 856 var pathOffset = 0; |
| 878 var index; | 857 var index; |
| 879 var subPart; | 858 var subPart; |
| 880 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 859 unittest.expect( |
| 860 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| 881 pathOffset += 1; | 861 pathOffset += 1; |
| 882 unittest.expect(path.substring(pathOffset, pathOffset + 19), unittest.eq
uals("consumersurveys/v2/")); | 862 unittest.expect(path.substring(pathOffset, pathOffset + 19), |
| 863 unittest.equals("consumersurveys/v2/")); |
| 883 pathOffset += 19; | 864 pathOffset += 19; |
| 884 unittest.expect(path.substring(pathOffset, pathOffset + 16), unittest.eq
uals("mobileAppPanels/")); | 865 unittest.expect(path.substring(pathOffset, pathOffset + 16), |
| 866 unittest.equals("mobileAppPanels/")); |
| 885 pathOffset += 16; | 867 pathOffset += 16; |
| 886 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); | 868 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 887 pathOffset = path.length; | 869 pathOffset = path.length; |
| 888 unittest.expect(subPart, unittest.equals("$arg_panelId")); | 870 unittest.expect(subPart, unittest.equals("$arg_panelId")); |
| 889 | 871 |
| 890 var query = (req.url).query; | 872 var query = (req.url).query; |
| 891 var queryOffset = 0; | 873 var queryOffset = 0; |
| 892 var queryMap = {}; | 874 var queryMap = {}; |
| 893 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 875 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 894 parseBool(n) { | 876 parseBool(n) { |
| 895 if (n == "true") return true; | 877 if (n == "true") return true; |
| 896 if (n == "false") return false; | 878 if (n == "false") return false; |
| 897 if (n == null) return null; | 879 if (n == null) return null; |
| 898 throw new core.ArgumentError("Invalid boolean: $n"); | 880 throw new core.ArgumentError("Invalid boolean: $n"); |
| 899 } | 881 } |
| 882 |
| 900 if (query.length > 0) { | 883 if (query.length > 0) { |
| 901 for (var part in query.split("&")) { | 884 for (var part in query.split("&")) { |
| 902 var keyvalue = part.split("="); | 885 var keyvalue = part.split("="); |
| 903 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 886 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 887 core.Uri.decodeQueryComponent(keyvalue[1])); |
| 904 } | 888 } |
| 905 } | 889 } |
| 906 | 890 |
| 907 | |
| 908 var h = { | 891 var h = { |
| 909 "content-type" : "application/json; charset=utf-8", | 892 "content-type": "application/json; charset=utf-8", |
| 910 }; | 893 }; |
| 911 var resp = convert.JSON.encode(buildMobileAppPanel()); | 894 var resp = convert.JSON.encode(buildMobileAppPanel()); |
| 912 return new async.Future.value(stringResponse(200, h, resp)); | 895 return new async.Future.value(stringResponse(200, h, resp)); |
| 913 }), true); | 896 }), true); |
| 914 res.get(arg_panelId).then(unittest.expectAsync1(((api.MobileAppPanel respo
nse) { | 897 res |
| 898 .get(arg_panelId) |
| 899 .then(unittest.expectAsync1(((api.MobileAppPanel response) { |
| 915 checkMobileAppPanel(response); | 900 checkMobileAppPanel(response); |
| 916 }))); | 901 }))); |
| 917 }); | 902 }); |
| 918 | 903 |
| 919 unittest.test("method--list", () { | 904 unittest.test("method--list", () { |
| 920 | |
| 921 var mock = new HttpServerMock(); | 905 var mock = new HttpServerMock(); |
| 922 api.MobileapppanelsResourceApi res = new api.ConsumersurveysApi(mock).mobi
leapppanels; | 906 api.MobileapppanelsResourceApi res = |
| 907 new api.ConsumersurveysApi(mock).mobileapppanels; |
| 923 var arg_maxResults = 42; | 908 var arg_maxResults = 42; |
| 924 var arg_startIndex = 42; | 909 var arg_startIndex = 42; |
| 925 var arg_token = "foo"; | 910 var arg_token = "foo"; |
| 926 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 911 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 927 var path = (req.url).path; | 912 var path = (req.url).path; |
| 928 var pathOffset = 0; | 913 var pathOffset = 0; |
| 929 var index; | 914 var index; |
| 930 var subPart; | 915 var subPart; |
| 931 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 916 unittest.expect( |
| 917 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| 932 pathOffset += 1; | 918 pathOffset += 1; |
| 933 unittest.expect(path.substring(pathOffset, pathOffset + 19), unittest.eq
uals("consumersurveys/v2/")); | 919 unittest.expect(path.substring(pathOffset, pathOffset + 19), |
| 920 unittest.equals("consumersurveys/v2/")); |
| 934 pathOffset += 19; | 921 pathOffset += 19; |
| 935 unittest.expect(path.substring(pathOffset, pathOffset + 15), unittest.eq
uals("mobileAppPanels")); | 922 unittest.expect(path.substring(pathOffset, pathOffset + 15), |
| 923 unittest.equals("mobileAppPanels")); |
| 936 pathOffset += 15; | 924 pathOffset += 15; |
| 937 | 925 |
| 938 var query = (req.url).query; | 926 var query = (req.url).query; |
| 939 var queryOffset = 0; | 927 var queryOffset = 0; |
| 940 var queryMap = {}; | 928 var queryMap = {}; |
| 941 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 929 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 942 parseBool(n) { | 930 parseBool(n) { |
| 943 if (n == "true") return true; | 931 if (n == "true") return true; |
| 944 if (n == "false") return false; | 932 if (n == "false") return false; |
| 945 if (n == null) return null; | 933 if (n == null) return null; |
| 946 throw new core.ArgumentError("Invalid boolean: $n"); | 934 throw new core.ArgumentError("Invalid boolean: $n"); |
| 947 } | 935 } |
| 936 |
| 948 if (query.length > 0) { | 937 if (query.length > 0) { |
| 949 for (var part in query.split("&")) { | 938 for (var part in query.split("&")) { |
| 950 var keyvalue = part.split("="); | 939 var keyvalue = part.split("="); |
| 951 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 940 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 941 core.Uri.decodeQueryComponent(keyvalue[1])); |
| 952 } | 942 } |
| 953 } | 943 } |
| 954 unittest.expect(core.int.parse(queryMap["maxResults"].first), unittest.e
quals(arg_maxResults)); | 944 unittest.expect(core.int.parse(queryMap["maxResults"].first), |
| 955 unittest.expect(core.int.parse(queryMap["startIndex"].first), unittest.e
quals(arg_startIndex)); | 945 unittest.equals(arg_maxResults)); |
| 946 unittest.expect(core.int.parse(queryMap["startIndex"].first), |
| 947 unittest.equals(arg_startIndex)); |
| 956 unittest.expect(queryMap["token"].first, unittest.equals(arg_token)); | 948 unittest.expect(queryMap["token"].first, unittest.equals(arg_token)); |
| 957 | 949 |
| 958 | |
| 959 var h = { | 950 var h = { |
| 960 "content-type" : "application/json; charset=utf-8", | 951 "content-type": "application/json; charset=utf-8", |
| 961 }; | 952 }; |
| 962 var resp = convert.JSON.encode(buildMobileAppPanelsListResponse()); | 953 var resp = convert.JSON.encode(buildMobileAppPanelsListResponse()); |
| 963 return new async.Future.value(stringResponse(200, h, resp)); | 954 return new async.Future.value(stringResponse(200, h, resp)); |
| 964 }), true); | 955 }), true); |
| 965 res.list(maxResults: arg_maxResults, startIndex: arg_startIndex, token: ar
g_token).then(unittest.expectAsync1(((api.MobileAppPanelsListResponse response)
{ | 956 res |
| 957 .list( |
| 958 maxResults: arg_maxResults, |
| 959 startIndex: arg_startIndex, |
| 960 token: arg_token) |
| 961 .then(unittest |
| 962 .expectAsync1(((api.MobileAppPanelsListResponse response) { |
| 966 checkMobileAppPanelsListResponse(response); | 963 checkMobileAppPanelsListResponse(response); |
| 967 }))); | 964 }))); |
| 968 }); | 965 }); |
| 969 | 966 |
| 970 unittest.test("method--update", () { | 967 unittest.test("method--update", () { |
| 971 | |
| 972 var mock = new HttpServerMock(); | 968 var mock = new HttpServerMock(); |
| 973 api.MobileapppanelsResourceApi res = new api.ConsumersurveysApi(mock).mobi
leapppanels; | 969 api.MobileapppanelsResourceApi res = |
| 970 new api.ConsumersurveysApi(mock).mobileapppanels; |
| 974 var arg_request = buildMobileAppPanel(); | 971 var arg_request = buildMobileAppPanel(); |
| 975 var arg_panelId = "foo"; | 972 var arg_panelId = "foo"; |
| 976 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 973 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 977 var obj = new api.MobileAppPanel.fromJson(json); | 974 var obj = new api.MobileAppPanel.fromJson(json); |
| 978 checkMobileAppPanel(obj); | 975 checkMobileAppPanel(obj); |
| 979 | 976 |
| 980 var path = (req.url).path; | 977 var path = (req.url).path; |
| 981 var pathOffset = 0; | 978 var pathOffset = 0; |
| 982 var index; | 979 var index; |
| 983 var subPart; | 980 var subPart; |
| 984 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 981 unittest.expect( |
| 982 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| 985 pathOffset += 1; | 983 pathOffset += 1; |
| 986 unittest.expect(path.substring(pathOffset, pathOffset + 19), unittest.eq
uals("consumersurveys/v2/")); | 984 unittest.expect(path.substring(pathOffset, pathOffset + 19), |
| 985 unittest.equals("consumersurveys/v2/")); |
| 987 pathOffset += 19; | 986 pathOffset += 19; |
| 988 unittest.expect(path.substring(pathOffset, pathOffset + 16), unittest.eq
uals("mobileAppPanels/")); | 987 unittest.expect(path.substring(pathOffset, pathOffset + 16), |
| 988 unittest.equals("mobileAppPanels/")); |
| 989 pathOffset += 16; | 989 pathOffset += 16; |
| 990 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); | 990 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 991 pathOffset = path.length; | 991 pathOffset = path.length; |
| 992 unittest.expect(subPart, unittest.equals("$arg_panelId")); | 992 unittest.expect(subPart, unittest.equals("$arg_panelId")); |
| 993 | 993 |
| 994 var query = (req.url).query; | 994 var query = (req.url).query; |
| 995 var queryOffset = 0; | 995 var queryOffset = 0; |
| 996 var queryMap = {}; | 996 var queryMap = {}; |
| 997 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 997 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 998 parseBool(n) { | 998 parseBool(n) { |
| 999 if (n == "true") return true; | 999 if (n == "true") return true; |
| 1000 if (n == "false") return false; | 1000 if (n == "false") return false; |
| 1001 if (n == null) return null; | 1001 if (n == null) return null; |
| 1002 throw new core.ArgumentError("Invalid boolean: $n"); | 1002 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1003 } | 1003 } |
| 1004 |
| 1004 if (query.length > 0) { | 1005 if (query.length > 0) { |
| 1005 for (var part in query.split("&")) { | 1006 for (var part in query.split("&")) { |
| 1006 var keyvalue = part.split("="); | 1007 var keyvalue = part.split("="); |
| 1007 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1008 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1009 core.Uri.decodeQueryComponent(keyvalue[1])); |
| 1008 } | 1010 } |
| 1009 } | 1011 } |
| 1010 | 1012 |
| 1011 | |
| 1012 var h = { | 1013 var h = { |
| 1013 "content-type" : "application/json; charset=utf-8", | 1014 "content-type": "application/json; charset=utf-8", |
| 1014 }; | 1015 }; |
| 1015 var resp = convert.JSON.encode(buildMobileAppPanel()); | 1016 var resp = convert.JSON.encode(buildMobileAppPanel()); |
| 1016 return new async.Future.value(stringResponse(200, h, resp)); | 1017 return new async.Future.value(stringResponse(200, h, resp)); |
| 1017 }), true); | 1018 }), true); |
| 1018 res.update(arg_request, arg_panelId).then(unittest.expectAsync1(((api.Mobi
leAppPanel response) { | 1019 res |
| 1020 .update(arg_request, arg_panelId) |
| 1021 .then(unittest.expectAsync1(((api.MobileAppPanel response) { |
| 1019 checkMobileAppPanel(response); | 1022 checkMobileAppPanel(response); |
| 1020 }))); | 1023 }))); |
| 1021 }); | 1024 }); |
| 1022 | |
| 1023 }); | 1025 }); |
| 1024 | 1026 |
| 1025 | |
| 1026 unittest.group("resource-ResultsResourceApi", () { | 1027 unittest.group("resource-ResultsResourceApi", () { |
| 1027 unittest.test("method--get", () { | 1028 unittest.test("method--get", () { |
| 1028 // TODO: Implement tests for media upload; | 1029 // TODO: Implement tests for media upload; |
| 1029 // TODO: Implement tests for media download; | 1030 // TODO: Implement tests for media download; |
| 1030 | 1031 |
| 1031 var mock = new HttpServerMock(); | 1032 var mock = new HttpServerMock(); |
| 1032 api.ResultsResourceApi res = new api.ConsumersurveysApi(mock).results; | 1033 api.ResultsResourceApi res = new api.ConsumersurveysApi(mock).results; |
| 1033 var arg_request = buildResultsGetRequest(); | 1034 var arg_request = buildResultsGetRequest(); |
| 1034 var arg_surveyUrlId = "foo"; | 1035 var arg_surveyUrlId = "foo"; |
| 1035 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1036 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 1036 var obj = new api.ResultsGetRequest.fromJson(json); | 1037 var obj = new api.ResultsGetRequest.fromJson(json); |
| 1037 checkResultsGetRequest(obj); | 1038 checkResultsGetRequest(obj); |
| 1038 | 1039 |
| 1039 var path = (req.url).path; | 1040 var path = (req.url).path; |
| 1040 var pathOffset = 0; | 1041 var pathOffset = 0; |
| 1041 var index; | 1042 var index; |
| 1042 var subPart; | 1043 var subPart; |
| 1043 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1044 unittest.expect( |
| 1045 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| 1044 pathOffset += 1; | 1046 pathOffset += 1; |
| 1045 unittest.expect(path.substring(pathOffset, pathOffset + 19), unittest.eq
uals("consumersurveys/v2/")); | 1047 unittest.expect(path.substring(pathOffset, pathOffset + 19), |
| 1048 unittest.equals("consumersurveys/v2/")); |
| 1046 pathOffset += 19; | 1049 pathOffset += 19; |
| 1047 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("surveys/")); | 1050 unittest.expect(path.substring(pathOffset, pathOffset + 8), |
| 1051 unittest.equals("surveys/")); |
| 1048 pathOffset += 8; | 1052 pathOffset += 8; |
| 1049 index = path.indexOf("/results", pathOffset); | 1053 index = path.indexOf("/results", pathOffset); |
| 1050 unittest.expect(index >= 0, unittest.isTrue); | 1054 unittest.expect(index >= 0, unittest.isTrue); |
| 1051 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | 1055 subPart = |
| 1056 core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| 1052 pathOffset = index; | 1057 pathOffset = index; |
| 1053 unittest.expect(subPart, unittest.equals("$arg_surveyUrlId")); | 1058 unittest.expect(subPart, unittest.equals("$arg_surveyUrlId")); |
| 1054 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("/results")); | 1059 unittest.expect(path.substring(pathOffset, pathOffset + 8), |
| 1060 unittest.equals("/results")); |
| 1055 pathOffset += 8; | 1061 pathOffset += 8; |
| 1056 | 1062 |
| 1057 var query = (req.url).query; | 1063 var query = (req.url).query; |
| 1058 var queryOffset = 0; | 1064 var queryOffset = 0; |
| 1059 var queryMap = {}; | 1065 var queryMap = {}; |
| 1060 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1066 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1061 parseBool(n) { | 1067 parseBool(n) { |
| 1062 if (n == "true") return true; | 1068 if (n == "true") return true; |
| 1063 if (n == "false") return false; | 1069 if (n == "false") return false; |
| 1064 if (n == null) return null; | 1070 if (n == null) return null; |
| 1065 throw new core.ArgumentError("Invalid boolean: $n"); | 1071 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1066 } | 1072 } |
| 1073 |
| 1067 if (query.length > 0) { | 1074 if (query.length > 0) { |
| 1068 for (var part in query.split("&")) { | 1075 for (var part in query.split("&")) { |
| 1069 var keyvalue = part.split("="); | 1076 var keyvalue = part.split("="); |
| 1070 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1077 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1078 core.Uri.decodeQueryComponent(keyvalue[1])); |
| 1071 } | 1079 } |
| 1072 } | 1080 } |
| 1073 | 1081 |
| 1074 | |
| 1075 var h = { | 1082 var h = { |
| 1076 "content-type" : "application/json; charset=utf-8", | 1083 "content-type": "application/json; charset=utf-8", |
| 1077 }; | 1084 }; |
| 1078 var resp = convert.JSON.encode(buildSurveyResults()); | 1085 var resp = convert.JSON.encode(buildSurveyResults()); |
| 1079 return new async.Future.value(stringResponse(200, h, resp)); | 1086 return new async.Future.value(stringResponse(200, h, resp)); |
| 1080 }), true); | 1087 }), true); |
| 1081 res.get(arg_request, arg_surveyUrlId).then(unittest.expectAsync1(((api.Sur
veyResults response) { | 1088 res |
| 1089 .get(arg_request, arg_surveyUrlId) |
| 1090 .then(unittest.expectAsync1(((api.SurveyResults response) { |
| 1082 checkSurveyResults(response); | 1091 checkSurveyResults(response); |
| 1083 }))); | 1092 }))); |
| 1084 }); | 1093 }); |
| 1085 | |
| 1086 }); | 1094 }); |
| 1087 | 1095 |
| 1088 | |
| 1089 unittest.group("resource-SurveysResourceApi", () { | 1096 unittest.group("resource-SurveysResourceApi", () { |
| 1090 unittest.test("method--delete", () { | 1097 unittest.test("method--delete", () { |
| 1091 | |
| 1092 var mock = new HttpServerMock(); | 1098 var mock = new HttpServerMock(); |
| 1093 api.SurveysResourceApi res = new api.ConsumersurveysApi(mock).surveys; | 1099 api.SurveysResourceApi res = new api.ConsumersurveysApi(mock).surveys; |
| 1094 var arg_surveyUrlId = "foo"; | 1100 var arg_surveyUrlId = "foo"; |
| 1095 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1101 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 1096 var path = (req.url).path; | 1102 var path = (req.url).path; |
| 1097 var pathOffset = 0; | 1103 var pathOffset = 0; |
| 1098 var index; | 1104 var index; |
| 1099 var subPart; | 1105 var subPart; |
| 1100 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1106 unittest.expect( |
| 1107 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| 1101 pathOffset += 1; | 1108 pathOffset += 1; |
| 1102 unittest.expect(path.substring(pathOffset, pathOffset + 19), unittest.eq
uals("consumersurveys/v2/")); | 1109 unittest.expect(path.substring(pathOffset, pathOffset + 19), |
| 1110 unittest.equals("consumersurveys/v2/")); |
| 1103 pathOffset += 19; | 1111 pathOffset += 19; |
| 1104 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("surveys/")); | 1112 unittest.expect(path.substring(pathOffset, pathOffset + 8), |
| 1113 unittest.equals("surveys/")); |
| 1105 pathOffset += 8; | 1114 pathOffset += 8; |
| 1106 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); | 1115 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 1107 pathOffset = path.length; | 1116 pathOffset = path.length; |
| 1108 unittest.expect(subPart, unittest.equals("$arg_surveyUrlId")); | 1117 unittest.expect(subPart, unittest.equals("$arg_surveyUrlId")); |
| 1109 | 1118 |
| 1110 var query = (req.url).query; | 1119 var query = (req.url).query; |
| 1111 var queryOffset = 0; | 1120 var queryOffset = 0; |
| 1112 var queryMap = {}; | 1121 var queryMap = {}; |
| 1113 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1122 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1114 parseBool(n) { | 1123 parseBool(n) { |
| 1115 if (n == "true") return true; | 1124 if (n == "true") return true; |
| 1116 if (n == "false") return false; | 1125 if (n == "false") return false; |
| 1117 if (n == null) return null; | 1126 if (n == null) return null; |
| 1118 throw new core.ArgumentError("Invalid boolean: $n"); | 1127 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1119 } | 1128 } |
| 1129 |
| 1120 if (query.length > 0) { | 1130 if (query.length > 0) { |
| 1121 for (var part in query.split("&")) { | 1131 for (var part in query.split("&")) { |
| 1122 var keyvalue = part.split("="); | 1132 var keyvalue = part.split("="); |
| 1123 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1133 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1134 core.Uri.decodeQueryComponent(keyvalue[1])); |
| 1124 } | 1135 } |
| 1125 } | 1136 } |
| 1126 | 1137 |
| 1127 | |
| 1128 var h = { | 1138 var h = { |
| 1129 "content-type" : "application/json; charset=utf-8", | 1139 "content-type": "application/json; charset=utf-8", |
| 1130 }; | 1140 }; |
| 1131 var resp = convert.JSON.encode(buildSurveysDeleteResponse()); | 1141 var resp = convert.JSON.encode(buildSurveysDeleteResponse()); |
| 1132 return new async.Future.value(stringResponse(200, h, resp)); | 1142 return new async.Future.value(stringResponse(200, h, resp)); |
| 1133 }), true); | 1143 }), true); |
| 1134 res.delete(arg_surveyUrlId).then(unittest.expectAsync1(((api.SurveysDelete
Response response) { | 1144 res |
| 1145 .delete(arg_surveyUrlId) |
| 1146 .then(unittest.expectAsync1(((api.SurveysDeleteResponse response) { |
| 1135 checkSurveysDeleteResponse(response); | 1147 checkSurveysDeleteResponse(response); |
| 1136 }))); | 1148 }))); |
| 1137 }); | 1149 }); |
| 1138 | 1150 |
| 1139 unittest.test("method--get", () { | 1151 unittest.test("method--get", () { |
| 1140 | |
| 1141 var mock = new HttpServerMock(); | 1152 var mock = new HttpServerMock(); |
| 1142 api.SurveysResourceApi res = new api.ConsumersurveysApi(mock).surveys; | 1153 api.SurveysResourceApi res = new api.ConsumersurveysApi(mock).surveys; |
| 1143 var arg_surveyUrlId = "foo"; | 1154 var arg_surveyUrlId = "foo"; |
| 1144 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1155 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 1145 var path = (req.url).path; | 1156 var path = (req.url).path; |
| 1146 var pathOffset = 0; | 1157 var pathOffset = 0; |
| 1147 var index; | 1158 var index; |
| 1148 var subPart; | 1159 var subPart; |
| 1149 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1160 unittest.expect( |
| 1161 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| 1150 pathOffset += 1; | 1162 pathOffset += 1; |
| 1151 unittest.expect(path.substring(pathOffset, pathOffset + 19), unittest.eq
uals("consumersurveys/v2/")); | 1163 unittest.expect(path.substring(pathOffset, pathOffset + 19), |
| 1164 unittest.equals("consumersurveys/v2/")); |
| 1152 pathOffset += 19; | 1165 pathOffset += 19; |
| 1153 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("surveys/")); | 1166 unittest.expect(path.substring(pathOffset, pathOffset + 8), |
| 1167 unittest.equals("surveys/")); |
| 1154 pathOffset += 8; | 1168 pathOffset += 8; |
| 1155 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); | 1169 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 1156 pathOffset = path.length; | 1170 pathOffset = path.length; |
| 1157 unittest.expect(subPart, unittest.equals("$arg_surveyUrlId")); | 1171 unittest.expect(subPart, unittest.equals("$arg_surveyUrlId")); |
| 1158 | 1172 |
| 1159 var query = (req.url).query; | 1173 var query = (req.url).query; |
| 1160 var queryOffset = 0; | 1174 var queryOffset = 0; |
| 1161 var queryMap = {}; | 1175 var queryMap = {}; |
| 1162 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1176 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1163 parseBool(n) { | 1177 parseBool(n) { |
| 1164 if (n == "true") return true; | 1178 if (n == "true") return true; |
| 1165 if (n == "false") return false; | 1179 if (n == "false") return false; |
| 1166 if (n == null) return null; | 1180 if (n == null) return null; |
| 1167 throw new core.ArgumentError("Invalid boolean: $n"); | 1181 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1168 } | 1182 } |
| 1183 |
| 1169 if (query.length > 0) { | 1184 if (query.length > 0) { |
| 1170 for (var part in query.split("&")) { | 1185 for (var part in query.split("&")) { |
| 1171 var keyvalue = part.split("="); | 1186 var keyvalue = part.split("="); |
| 1172 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1187 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1188 core.Uri.decodeQueryComponent(keyvalue[1])); |
| 1173 } | 1189 } |
| 1174 } | 1190 } |
| 1175 | 1191 |
| 1176 | |
| 1177 var h = { | 1192 var h = { |
| 1178 "content-type" : "application/json; charset=utf-8", | 1193 "content-type": "application/json; charset=utf-8", |
| 1179 }; | 1194 }; |
| 1180 var resp = convert.JSON.encode(buildSurvey()); | 1195 var resp = convert.JSON.encode(buildSurvey()); |
| 1181 return new async.Future.value(stringResponse(200, h, resp)); | 1196 return new async.Future.value(stringResponse(200, h, resp)); |
| 1182 }), true); | 1197 }), true); |
| 1183 res.get(arg_surveyUrlId).then(unittest.expectAsync1(((api.Survey response)
{ | 1198 res |
| 1199 .get(arg_surveyUrlId) |
| 1200 .then(unittest.expectAsync1(((api.Survey response) { |
| 1184 checkSurvey(response); | 1201 checkSurvey(response); |
| 1185 }))); | 1202 }))); |
| 1186 }); | 1203 }); |
| 1187 | 1204 |
| 1188 unittest.test("method--insert", () { | 1205 unittest.test("method--insert", () { |
| 1189 | |
| 1190 var mock = new HttpServerMock(); | 1206 var mock = new HttpServerMock(); |
| 1191 api.SurveysResourceApi res = new api.ConsumersurveysApi(mock).surveys; | 1207 api.SurveysResourceApi res = new api.ConsumersurveysApi(mock).surveys; |
| 1192 var arg_request = buildSurvey(); | 1208 var arg_request = buildSurvey(); |
| 1193 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1209 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 1194 var obj = new api.Survey.fromJson(json); | 1210 var obj = new api.Survey.fromJson(json); |
| 1195 checkSurvey(obj); | 1211 checkSurvey(obj); |
| 1196 | 1212 |
| 1197 var path = (req.url).path; | 1213 var path = (req.url).path; |
| 1198 var pathOffset = 0; | 1214 var pathOffset = 0; |
| 1199 var index; | 1215 var index; |
| 1200 var subPart; | 1216 var subPart; |
| 1201 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1217 unittest.expect( |
| 1218 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| 1202 pathOffset += 1; | 1219 pathOffset += 1; |
| 1203 unittest.expect(path.substring(pathOffset, pathOffset + 19), unittest.eq
uals("consumersurveys/v2/")); | 1220 unittest.expect(path.substring(pathOffset, pathOffset + 19), |
| 1221 unittest.equals("consumersurveys/v2/")); |
| 1204 pathOffset += 19; | 1222 pathOffset += 19; |
| 1205 unittest.expect(path.substring(pathOffset, pathOffset + 7), unittest.equ
als("surveys")); | 1223 unittest.expect(path.substring(pathOffset, pathOffset + 7), |
| 1224 unittest.equals("surveys")); |
| 1206 pathOffset += 7; | 1225 pathOffset += 7; |
| 1207 | 1226 |
| 1208 var query = (req.url).query; | 1227 var query = (req.url).query; |
| 1209 var queryOffset = 0; | 1228 var queryOffset = 0; |
| 1210 var queryMap = {}; | 1229 var queryMap = {}; |
| 1211 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1230 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1212 parseBool(n) { | 1231 parseBool(n) { |
| 1213 if (n == "true") return true; | 1232 if (n == "true") return true; |
| 1214 if (n == "false") return false; | 1233 if (n == "false") return false; |
| 1215 if (n == null) return null; | 1234 if (n == null) return null; |
| 1216 throw new core.ArgumentError("Invalid boolean: $n"); | 1235 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1217 } | 1236 } |
| 1237 |
| 1218 if (query.length > 0) { | 1238 if (query.length > 0) { |
| 1219 for (var part in query.split("&")) { | 1239 for (var part in query.split("&")) { |
| 1220 var keyvalue = part.split("="); | 1240 var keyvalue = part.split("="); |
| 1221 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1241 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1242 core.Uri.decodeQueryComponent(keyvalue[1])); |
| 1222 } | 1243 } |
| 1223 } | 1244 } |
| 1224 | 1245 |
| 1225 | |
| 1226 var h = { | 1246 var h = { |
| 1227 "content-type" : "application/json; charset=utf-8", | 1247 "content-type": "application/json; charset=utf-8", |
| 1228 }; | 1248 }; |
| 1229 var resp = convert.JSON.encode(buildSurvey()); | 1249 var resp = convert.JSON.encode(buildSurvey()); |
| 1230 return new async.Future.value(stringResponse(200, h, resp)); | 1250 return new async.Future.value(stringResponse(200, h, resp)); |
| 1231 }), true); | 1251 }), true); |
| 1232 res.insert(arg_request).then(unittest.expectAsync1(((api.Survey response)
{ | 1252 res |
| 1253 .insert(arg_request) |
| 1254 .then(unittest.expectAsync1(((api.Survey response) { |
| 1233 checkSurvey(response); | 1255 checkSurvey(response); |
| 1234 }))); | 1256 }))); |
| 1235 }); | 1257 }); |
| 1236 | 1258 |
| 1237 unittest.test("method--list", () { | 1259 unittest.test("method--list", () { |
| 1238 | |
| 1239 var mock = new HttpServerMock(); | 1260 var mock = new HttpServerMock(); |
| 1240 api.SurveysResourceApi res = new api.ConsumersurveysApi(mock).surveys; | 1261 api.SurveysResourceApi res = new api.ConsumersurveysApi(mock).surveys; |
| 1241 var arg_maxResults = 42; | 1262 var arg_maxResults = 42; |
| 1242 var arg_startIndex = 42; | 1263 var arg_startIndex = 42; |
| 1243 var arg_token = "foo"; | 1264 var arg_token = "foo"; |
| 1244 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1265 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 1245 var path = (req.url).path; | 1266 var path = (req.url).path; |
| 1246 var pathOffset = 0; | 1267 var pathOffset = 0; |
| 1247 var index; | 1268 var index; |
| 1248 var subPart; | 1269 var subPart; |
| 1249 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1270 unittest.expect( |
| 1271 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| 1250 pathOffset += 1; | 1272 pathOffset += 1; |
| 1251 unittest.expect(path.substring(pathOffset, pathOffset + 19), unittest.eq
uals("consumersurveys/v2/")); | 1273 unittest.expect(path.substring(pathOffset, pathOffset + 19), |
| 1274 unittest.equals("consumersurveys/v2/")); |
| 1252 pathOffset += 19; | 1275 pathOffset += 19; |
| 1253 unittest.expect(path.substring(pathOffset, pathOffset + 7), unittest.equ
als("surveys")); | 1276 unittest.expect(path.substring(pathOffset, pathOffset + 7), |
| 1277 unittest.equals("surveys")); |
| 1254 pathOffset += 7; | 1278 pathOffset += 7; |
| 1255 | 1279 |
| 1256 var query = (req.url).query; | 1280 var query = (req.url).query; |
| 1257 var queryOffset = 0; | 1281 var queryOffset = 0; |
| 1258 var queryMap = {}; | 1282 var queryMap = {}; |
| 1259 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1283 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1260 parseBool(n) { | 1284 parseBool(n) { |
| 1261 if (n == "true") return true; | 1285 if (n == "true") return true; |
| 1262 if (n == "false") return false; | 1286 if (n == "false") return false; |
| 1263 if (n == null) return null; | 1287 if (n == null) return null; |
| 1264 throw new core.ArgumentError("Invalid boolean: $n"); | 1288 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1265 } | 1289 } |
| 1290 |
| 1266 if (query.length > 0) { | 1291 if (query.length > 0) { |
| 1267 for (var part in query.split("&")) { | 1292 for (var part in query.split("&")) { |
| 1268 var keyvalue = part.split("="); | 1293 var keyvalue = part.split("="); |
| 1269 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1294 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1295 core.Uri.decodeQueryComponent(keyvalue[1])); |
| 1270 } | 1296 } |
| 1271 } | 1297 } |
| 1272 unittest.expect(core.int.parse(queryMap["maxResults"].first), unittest.e
quals(arg_maxResults)); | 1298 unittest.expect(core.int.parse(queryMap["maxResults"].first), |
| 1273 unittest.expect(core.int.parse(queryMap["startIndex"].first), unittest.e
quals(arg_startIndex)); | 1299 unittest.equals(arg_maxResults)); |
| 1300 unittest.expect(core.int.parse(queryMap["startIndex"].first), |
| 1301 unittest.equals(arg_startIndex)); |
| 1274 unittest.expect(queryMap["token"].first, unittest.equals(arg_token)); | 1302 unittest.expect(queryMap["token"].first, unittest.equals(arg_token)); |
| 1275 | 1303 |
| 1276 | |
| 1277 var h = { | 1304 var h = { |
| 1278 "content-type" : "application/json; charset=utf-8", | 1305 "content-type": "application/json; charset=utf-8", |
| 1279 }; | 1306 }; |
| 1280 var resp = convert.JSON.encode(buildSurveysListResponse()); | 1307 var resp = convert.JSON.encode(buildSurveysListResponse()); |
| 1281 return new async.Future.value(stringResponse(200, h, resp)); | 1308 return new async.Future.value(stringResponse(200, h, resp)); |
| 1282 }), true); | 1309 }), true); |
| 1283 res.list(maxResults: arg_maxResults, startIndex: arg_startIndex, token: ar
g_token).then(unittest.expectAsync1(((api.SurveysListResponse response) { | 1310 res |
| 1311 .list( |
| 1312 maxResults: arg_maxResults, |
| 1313 startIndex: arg_startIndex, |
| 1314 token: arg_token) |
| 1315 .then(unittest.expectAsync1(((api.SurveysListResponse response) { |
| 1284 checkSurveysListResponse(response); | 1316 checkSurveysListResponse(response); |
| 1285 }))); | 1317 }))); |
| 1286 }); | 1318 }); |
| 1287 | 1319 |
| 1288 unittest.test("method--start", () { | 1320 unittest.test("method--start", () { |
| 1289 | |
| 1290 var mock = new HttpServerMock(); | 1321 var mock = new HttpServerMock(); |
| 1291 api.SurveysResourceApi res = new api.ConsumersurveysApi(mock).surveys; | 1322 api.SurveysResourceApi res = new api.ConsumersurveysApi(mock).surveys; |
| 1292 var arg_request = buildSurveysStartRequest(); | 1323 var arg_request = buildSurveysStartRequest(); |
| 1293 var arg_resourceId = "foo"; | 1324 var arg_resourceId = "foo"; |
| 1294 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1325 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 1295 var obj = new api.SurveysStartRequest.fromJson(json); | 1326 var obj = new api.SurveysStartRequest.fromJson(json); |
| 1296 checkSurveysStartRequest(obj); | 1327 checkSurveysStartRequest(obj); |
| 1297 | 1328 |
| 1298 var path = (req.url).path; | 1329 var path = (req.url).path; |
| 1299 var pathOffset = 0; | 1330 var pathOffset = 0; |
| 1300 var index; | 1331 var index; |
| 1301 var subPart; | 1332 var subPart; |
| 1302 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1333 unittest.expect( |
| 1334 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| 1303 pathOffset += 1; | 1335 pathOffset += 1; |
| 1304 unittest.expect(path.substring(pathOffset, pathOffset + 19), unittest.eq
uals("consumersurveys/v2/")); | 1336 unittest.expect(path.substring(pathOffset, pathOffset + 19), |
| 1337 unittest.equals("consumersurveys/v2/")); |
| 1305 pathOffset += 19; | 1338 pathOffset += 19; |
| 1306 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("surveys/")); | 1339 unittest.expect(path.substring(pathOffset, pathOffset + 8), |
| 1340 unittest.equals("surveys/")); |
| 1307 pathOffset += 8; | 1341 pathOffset += 8; |
| 1308 index = path.indexOf("/start", pathOffset); | 1342 index = path.indexOf("/start", pathOffset); |
| 1309 unittest.expect(index >= 0, unittest.isTrue); | 1343 unittest.expect(index >= 0, unittest.isTrue); |
| 1310 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | 1344 subPart = |
| 1345 core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| 1311 pathOffset = index; | 1346 pathOffset = index; |
| 1312 unittest.expect(subPart, unittest.equals("$arg_resourceId")); | 1347 unittest.expect(subPart, unittest.equals("$arg_resourceId")); |
| 1313 unittest.expect(path.substring(pathOffset, pathOffset + 6), unittest.equ
als("/start")); | 1348 unittest.expect(path.substring(pathOffset, pathOffset + 6), |
| 1349 unittest.equals("/start")); |
| 1314 pathOffset += 6; | 1350 pathOffset += 6; |
| 1315 | 1351 |
| 1316 var query = (req.url).query; | 1352 var query = (req.url).query; |
| 1317 var queryOffset = 0; | 1353 var queryOffset = 0; |
| 1318 var queryMap = {}; | 1354 var queryMap = {}; |
| 1319 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1355 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1320 parseBool(n) { | 1356 parseBool(n) { |
| 1321 if (n == "true") return true; | 1357 if (n == "true") return true; |
| 1322 if (n == "false") return false; | 1358 if (n == "false") return false; |
| 1323 if (n == null) return null; | 1359 if (n == null) return null; |
| 1324 throw new core.ArgumentError("Invalid boolean: $n"); | 1360 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1325 } | 1361 } |
| 1362 |
| 1326 if (query.length > 0) { | 1363 if (query.length > 0) { |
| 1327 for (var part in query.split("&")) { | 1364 for (var part in query.split("&")) { |
| 1328 var keyvalue = part.split("="); | 1365 var keyvalue = part.split("="); |
| 1329 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1366 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1367 core.Uri.decodeQueryComponent(keyvalue[1])); |
| 1330 } | 1368 } |
| 1331 } | 1369 } |
| 1332 | 1370 |
| 1333 | |
| 1334 var h = { | 1371 var h = { |
| 1335 "content-type" : "application/json; charset=utf-8", | 1372 "content-type": "application/json; charset=utf-8", |
| 1336 }; | 1373 }; |
| 1337 var resp = convert.JSON.encode(buildSurveysStartResponse()); | 1374 var resp = convert.JSON.encode(buildSurveysStartResponse()); |
| 1338 return new async.Future.value(stringResponse(200, h, resp)); | 1375 return new async.Future.value(stringResponse(200, h, resp)); |
| 1339 }), true); | 1376 }), true); |
| 1340 res.start(arg_request, arg_resourceId).then(unittest.expectAsync1(((api.Su
rveysStartResponse response) { | 1377 res |
| 1378 .start(arg_request, arg_resourceId) |
| 1379 .then(unittest.expectAsync1(((api.SurveysStartResponse response) { |
| 1341 checkSurveysStartResponse(response); | 1380 checkSurveysStartResponse(response); |
| 1342 }))); | 1381 }))); |
| 1343 }); | 1382 }); |
| 1344 | 1383 |
| 1345 unittest.test("method--stop", () { | 1384 unittest.test("method--stop", () { |
| 1346 | |
| 1347 var mock = new HttpServerMock(); | 1385 var mock = new HttpServerMock(); |
| 1348 api.SurveysResourceApi res = new api.ConsumersurveysApi(mock).surveys; | 1386 api.SurveysResourceApi res = new api.ConsumersurveysApi(mock).surveys; |
| 1349 var arg_resourceId = "foo"; | 1387 var arg_resourceId = "foo"; |
| 1350 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1388 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 1351 var path = (req.url).path; | 1389 var path = (req.url).path; |
| 1352 var pathOffset = 0; | 1390 var pathOffset = 0; |
| 1353 var index; | 1391 var index; |
| 1354 var subPart; | 1392 var subPart; |
| 1355 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1393 unittest.expect( |
| 1394 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| 1356 pathOffset += 1; | 1395 pathOffset += 1; |
| 1357 unittest.expect(path.substring(pathOffset, pathOffset + 19), unittest.eq
uals("consumersurveys/v2/")); | 1396 unittest.expect(path.substring(pathOffset, pathOffset + 19), |
| 1397 unittest.equals("consumersurveys/v2/")); |
| 1358 pathOffset += 19; | 1398 pathOffset += 19; |
| 1359 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("surveys/")); | 1399 unittest.expect(path.substring(pathOffset, pathOffset + 8), |
| 1400 unittest.equals("surveys/")); |
| 1360 pathOffset += 8; | 1401 pathOffset += 8; |
| 1361 index = path.indexOf("/stop", pathOffset); | 1402 index = path.indexOf("/stop", pathOffset); |
| 1362 unittest.expect(index >= 0, unittest.isTrue); | 1403 unittest.expect(index >= 0, unittest.isTrue); |
| 1363 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset, index
)); | 1404 subPart = |
| 1405 core.Uri.decodeQueryComponent(path.substring(pathOffset, index)); |
| 1364 pathOffset = index; | 1406 pathOffset = index; |
| 1365 unittest.expect(subPart, unittest.equals("$arg_resourceId")); | 1407 unittest.expect(subPart, unittest.equals("$arg_resourceId")); |
| 1366 unittest.expect(path.substring(pathOffset, pathOffset + 5), unittest.equ
als("/stop")); | 1408 unittest.expect(path.substring(pathOffset, pathOffset + 5), |
| 1409 unittest.equals("/stop")); |
| 1367 pathOffset += 5; | 1410 pathOffset += 5; |
| 1368 | 1411 |
| 1369 var query = (req.url).query; | 1412 var query = (req.url).query; |
| 1370 var queryOffset = 0; | 1413 var queryOffset = 0; |
| 1371 var queryMap = {}; | 1414 var queryMap = {}; |
| 1372 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1415 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1373 parseBool(n) { | 1416 parseBool(n) { |
| 1374 if (n == "true") return true; | 1417 if (n == "true") return true; |
| 1375 if (n == "false") return false; | 1418 if (n == "false") return false; |
| 1376 if (n == null) return null; | 1419 if (n == null) return null; |
| 1377 throw new core.ArgumentError("Invalid boolean: $n"); | 1420 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1378 } | 1421 } |
| 1422 |
| 1379 if (query.length > 0) { | 1423 if (query.length > 0) { |
| 1380 for (var part in query.split("&")) { | 1424 for (var part in query.split("&")) { |
| 1381 var keyvalue = part.split("="); | 1425 var keyvalue = part.split("="); |
| 1382 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1426 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1427 core.Uri.decodeQueryComponent(keyvalue[1])); |
| 1383 } | 1428 } |
| 1384 } | 1429 } |
| 1385 | 1430 |
| 1386 | |
| 1387 var h = { | 1431 var h = { |
| 1388 "content-type" : "application/json; charset=utf-8", | 1432 "content-type": "application/json; charset=utf-8", |
| 1389 }; | 1433 }; |
| 1390 var resp = convert.JSON.encode(buildSurveysStopResponse()); | 1434 var resp = convert.JSON.encode(buildSurveysStopResponse()); |
| 1391 return new async.Future.value(stringResponse(200, h, resp)); | 1435 return new async.Future.value(stringResponse(200, h, resp)); |
| 1392 }), true); | 1436 }), true); |
| 1393 res.stop(arg_resourceId).then(unittest.expectAsync1(((api.SurveysStopRespo
nse response) { | 1437 res |
| 1438 .stop(arg_resourceId) |
| 1439 .then(unittest.expectAsync1(((api.SurveysStopResponse response) { |
| 1394 checkSurveysStopResponse(response); | 1440 checkSurveysStopResponse(response); |
| 1395 }))); | 1441 }))); |
| 1396 }); | 1442 }); |
| 1397 | 1443 |
| 1398 unittest.test("method--update", () { | 1444 unittest.test("method--update", () { |
| 1399 | |
| 1400 var mock = new HttpServerMock(); | 1445 var mock = new HttpServerMock(); |
| 1401 api.SurveysResourceApi res = new api.ConsumersurveysApi(mock).surveys; | 1446 api.SurveysResourceApi res = new api.ConsumersurveysApi(mock).surveys; |
| 1402 var arg_request = buildSurvey(); | 1447 var arg_request = buildSurvey(); |
| 1403 var arg_surveyUrlId = "foo"; | 1448 var arg_surveyUrlId = "foo"; |
| 1404 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { | 1449 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 1405 var obj = new api.Survey.fromJson(json); | 1450 var obj = new api.Survey.fromJson(json); |
| 1406 checkSurvey(obj); | 1451 checkSurvey(obj); |
| 1407 | 1452 |
| 1408 var path = (req.url).path; | 1453 var path = (req.url).path; |
| 1409 var pathOffset = 0; | 1454 var pathOffset = 0; |
| 1410 var index; | 1455 var index; |
| 1411 var subPart; | 1456 var subPart; |
| 1412 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 1457 unittest.expect( |
| 1458 path.substring(pathOffset, pathOffset + 1), unittest.equals("/")); |
| 1413 pathOffset += 1; | 1459 pathOffset += 1; |
| 1414 unittest.expect(path.substring(pathOffset, pathOffset + 19), unittest.eq
uals("consumersurveys/v2/")); | 1460 unittest.expect(path.substring(pathOffset, pathOffset + 19), |
| 1461 unittest.equals("consumersurveys/v2/")); |
| 1415 pathOffset += 19; | 1462 pathOffset += 19; |
| 1416 unittest.expect(path.substring(pathOffset, pathOffset + 8), unittest.equ
als("surveys/")); | 1463 unittest.expect(path.substring(pathOffset, pathOffset + 8), |
| 1464 unittest.equals("surveys/")); |
| 1417 pathOffset += 8; | 1465 pathOffset += 8; |
| 1418 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); | 1466 subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset)); |
| 1419 pathOffset = path.length; | 1467 pathOffset = path.length; |
| 1420 unittest.expect(subPart, unittest.equals("$arg_surveyUrlId")); | 1468 unittest.expect(subPart, unittest.equals("$arg_surveyUrlId")); |
| 1421 | 1469 |
| 1422 var query = (req.url).query; | 1470 var query = (req.url).query; |
| 1423 var queryOffset = 0; | 1471 var queryOffset = 0; |
| 1424 var queryMap = {}; | 1472 var queryMap = {}; |
| 1425 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | 1473 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 1426 parseBool(n) { | 1474 parseBool(n) { |
| 1427 if (n == "true") return true; | 1475 if (n == "true") return true; |
| 1428 if (n == "false") return false; | 1476 if (n == "false") return false; |
| 1429 if (n == null) return null; | 1477 if (n == null) return null; |
| 1430 throw new core.ArgumentError("Invalid boolean: $n"); | 1478 throw new core.ArgumentError("Invalid boolean: $n"); |
| 1431 } | 1479 } |
| 1480 |
| 1432 if (query.length > 0) { | 1481 if (query.length > 0) { |
| 1433 for (var part in query.split("&")) { | 1482 for (var part in query.split("&")) { |
| 1434 var keyvalue = part.split("="); | 1483 var keyvalue = part.split("="); |
| 1435 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 1484 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), |
| 1485 core.Uri.decodeQueryComponent(keyvalue[1])); |
| 1436 } | 1486 } |
| 1437 } | 1487 } |
| 1438 | 1488 |
| 1439 | |
| 1440 var h = { | 1489 var h = { |
| 1441 "content-type" : "application/json; charset=utf-8", | 1490 "content-type": "application/json; charset=utf-8", |
| 1442 }; | 1491 }; |
| 1443 var resp = convert.JSON.encode(buildSurvey()); | 1492 var resp = convert.JSON.encode(buildSurvey()); |
| 1444 return new async.Future.value(stringResponse(200, h, resp)); | 1493 return new async.Future.value(stringResponse(200, h, resp)); |
| 1445 }), true); | 1494 }), true); |
| 1446 res.update(arg_request, arg_surveyUrlId).then(unittest.expectAsync1(((api.
Survey response) { | 1495 res |
| 1496 .update(arg_request, arg_surveyUrlId) |
| 1497 .then(unittest.expectAsync1(((api.Survey response) { |
| 1447 checkSurvey(response); | 1498 checkSurvey(response); |
| 1448 }))); | 1499 }))); |
| 1449 }); | 1500 }); |
| 1450 | |
| 1451 }); | 1501 }); |
| 1452 | |
| 1453 | |
| 1454 } | 1502 } |
| 1455 | |
| OLD | NEW |