OLD | NEW |
1 library googleapis.youtubeAnalytics.v1.test; | 1 library googleapis.youtubeAnalytics.v1.test; |
2 | 2 |
3 import "dart:core" as core; | 3 import "dart:core" as core; |
4 import "dart:collection" as collection; | 4 import "dart:collection" as collection; |
5 import "dart:async" as async; | 5 import "dart:async" as async; |
6 import "dart:convert" as convert; | 6 import "dart:convert" as convert; |
7 | 7 |
8 import 'package:http/http.dart' as http; | 8 import 'package:http/http.dart' as http; |
9 import 'package:http/testing.dart' as http_testing; | 9 import 'package:http/testing.dart' as http_testing; |
10 import 'package:unittest/unittest.dart' as unittest; | 10 import 'package:unittest/unittest.dart' as unittest; |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 if (buildCounterGroupItem < 3) { | 161 if (buildCounterGroupItem < 3) { |
162 unittest.expect(o.etag, unittest.equals('foo')); | 162 unittest.expect(o.etag, unittest.equals('foo')); |
163 unittest.expect(o.groupId, unittest.equals('foo')); | 163 unittest.expect(o.groupId, unittest.equals('foo')); |
164 unittest.expect(o.id, unittest.equals('foo')); | 164 unittest.expect(o.id, unittest.equals('foo')); |
165 unittest.expect(o.kind, unittest.equals('foo')); | 165 unittest.expect(o.kind, unittest.equals('foo')); |
166 checkGroupItemResource(o.resource); | 166 checkGroupItemResource(o.resource); |
167 } | 167 } |
168 buildCounterGroupItem--; | 168 buildCounterGroupItem--; |
169 } | 169 } |
170 | 170 |
171 buildUnnamed193() { | 171 buildUnnamed195() { |
172 var o = new core.List<api.GroupItem>(); | 172 var o = new core.List<api.GroupItem>(); |
173 o.add(buildGroupItem()); | 173 o.add(buildGroupItem()); |
174 o.add(buildGroupItem()); | 174 o.add(buildGroupItem()); |
175 return o; | 175 return o; |
176 } | 176 } |
177 | 177 |
178 checkUnnamed193(core.List<api.GroupItem> o) { | 178 checkUnnamed195(core.List<api.GroupItem> o) { |
179 unittest.expect(o, unittest.hasLength(2)); | 179 unittest.expect(o, unittest.hasLength(2)); |
180 checkGroupItem(o[0]); | 180 checkGroupItem(o[0]); |
181 checkGroupItem(o[1]); | 181 checkGroupItem(o[1]); |
182 } | 182 } |
183 | 183 |
184 core.int buildCounterGroupItemListResponse = 0; | 184 core.int buildCounterGroupItemListResponse = 0; |
185 buildGroupItemListResponse() { | 185 buildGroupItemListResponse() { |
186 var o = new api.GroupItemListResponse(); | 186 var o = new api.GroupItemListResponse(); |
187 buildCounterGroupItemListResponse++; | 187 buildCounterGroupItemListResponse++; |
188 if (buildCounterGroupItemListResponse < 3) { | 188 if (buildCounterGroupItemListResponse < 3) { |
189 o.etag = "foo"; | 189 o.etag = "foo"; |
190 o.items = buildUnnamed193(); | 190 o.items = buildUnnamed195(); |
191 o.kind = "foo"; | 191 o.kind = "foo"; |
192 } | 192 } |
193 buildCounterGroupItemListResponse--; | 193 buildCounterGroupItemListResponse--; |
194 return o; | 194 return o; |
195 } | 195 } |
196 | 196 |
197 checkGroupItemListResponse(api.GroupItemListResponse o) { | 197 checkGroupItemListResponse(api.GroupItemListResponse o) { |
198 buildCounterGroupItemListResponse++; | 198 buildCounterGroupItemListResponse++; |
199 if (buildCounterGroupItemListResponse < 3) { | 199 if (buildCounterGroupItemListResponse < 3) { |
200 unittest.expect(o.etag, unittest.equals('foo')); | 200 unittest.expect(o.etag, unittest.equals('foo')); |
201 checkUnnamed193(o.items); | 201 checkUnnamed195(o.items); |
202 unittest.expect(o.kind, unittest.equals('foo')); | 202 unittest.expect(o.kind, unittest.equals('foo')); |
203 } | 203 } |
204 buildCounterGroupItemListResponse--; | 204 buildCounterGroupItemListResponse--; |
205 } | 205 } |
206 | 206 |
207 buildUnnamed194() { | 207 buildUnnamed196() { |
208 var o = new core.List<api.Group>(); | 208 var o = new core.List<api.Group>(); |
209 o.add(buildGroup()); | 209 o.add(buildGroup()); |
210 o.add(buildGroup()); | 210 o.add(buildGroup()); |
211 return o; | 211 return o; |
212 } | 212 } |
213 | 213 |
214 checkUnnamed194(core.List<api.Group> o) { | 214 checkUnnamed196(core.List<api.Group> o) { |
215 unittest.expect(o, unittest.hasLength(2)); | 215 unittest.expect(o, unittest.hasLength(2)); |
216 checkGroup(o[0]); | 216 checkGroup(o[0]); |
217 checkGroup(o[1]); | 217 checkGroup(o[1]); |
218 } | 218 } |
219 | 219 |
220 core.int buildCounterGroupListResponse = 0; | 220 core.int buildCounterGroupListResponse = 0; |
221 buildGroupListResponse() { | 221 buildGroupListResponse() { |
222 var o = new api.GroupListResponse(); | 222 var o = new api.GroupListResponse(); |
223 buildCounterGroupListResponse++; | 223 buildCounterGroupListResponse++; |
224 if (buildCounterGroupListResponse < 3) { | 224 if (buildCounterGroupListResponse < 3) { |
225 o.etag = "foo"; | 225 o.etag = "foo"; |
226 o.items = buildUnnamed194(); | 226 o.items = buildUnnamed196(); |
227 o.kind = "foo"; | 227 o.kind = "foo"; |
228 o.nextPageToken = "foo"; | 228 o.nextPageToken = "foo"; |
229 } | 229 } |
230 buildCounterGroupListResponse--; | 230 buildCounterGroupListResponse--; |
231 return o; | 231 return o; |
232 } | 232 } |
233 | 233 |
234 checkGroupListResponse(api.GroupListResponse o) { | 234 checkGroupListResponse(api.GroupListResponse o) { |
235 buildCounterGroupListResponse++; | 235 buildCounterGroupListResponse++; |
236 if (buildCounterGroupListResponse < 3) { | 236 if (buildCounterGroupListResponse < 3) { |
237 unittest.expect(o.etag, unittest.equals('foo')); | 237 unittest.expect(o.etag, unittest.equals('foo')); |
238 checkUnnamed194(o.items); | 238 checkUnnamed196(o.items); |
239 unittest.expect(o.kind, unittest.equals('foo')); | 239 unittest.expect(o.kind, unittest.equals('foo')); |
240 unittest.expect(o.nextPageToken, unittest.equals('foo')); | 240 unittest.expect(o.nextPageToken, unittest.equals('foo')); |
241 } | 241 } |
242 buildCounterGroupListResponse--; | 242 buildCounterGroupListResponse--; |
243 } | 243 } |
244 | 244 |
245 core.int buildCounterResultTableColumnHeaders = 0; | 245 core.int buildCounterResultTableColumnHeaders = 0; |
246 buildResultTableColumnHeaders() { | 246 buildResultTableColumnHeaders() { |
247 var o = new api.ResultTableColumnHeaders(); | 247 var o = new api.ResultTableColumnHeaders(); |
248 buildCounterResultTableColumnHeaders++; | 248 buildCounterResultTableColumnHeaders++; |
249 if (buildCounterResultTableColumnHeaders < 3) { | 249 if (buildCounterResultTableColumnHeaders < 3) { |
250 o.columnType = "foo"; | 250 o.columnType = "foo"; |
251 o.dataType = "foo"; | 251 o.dataType = "foo"; |
252 o.name = "foo"; | 252 o.name = "foo"; |
253 } | 253 } |
254 buildCounterResultTableColumnHeaders--; | 254 buildCounterResultTableColumnHeaders--; |
255 return o; | 255 return o; |
256 } | 256 } |
257 | 257 |
258 checkResultTableColumnHeaders(api.ResultTableColumnHeaders o) { | 258 checkResultTableColumnHeaders(api.ResultTableColumnHeaders o) { |
259 buildCounterResultTableColumnHeaders++; | 259 buildCounterResultTableColumnHeaders++; |
260 if (buildCounterResultTableColumnHeaders < 3) { | 260 if (buildCounterResultTableColumnHeaders < 3) { |
261 unittest.expect(o.columnType, unittest.equals('foo')); | 261 unittest.expect(o.columnType, unittest.equals('foo')); |
262 unittest.expect(o.dataType, unittest.equals('foo')); | 262 unittest.expect(o.dataType, unittest.equals('foo')); |
263 unittest.expect(o.name, unittest.equals('foo')); | 263 unittest.expect(o.name, unittest.equals('foo')); |
264 } | 264 } |
265 buildCounterResultTableColumnHeaders--; | 265 buildCounterResultTableColumnHeaders--; |
266 } | 266 } |
267 | 267 |
268 buildUnnamed195() { | 268 buildUnnamed197() { |
269 var o = new core.List<api.ResultTableColumnHeaders>(); | 269 var o = new core.List<api.ResultTableColumnHeaders>(); |
270 o.add(buildResultTableColumnHeaders()); | 270 o.add(buildResultTableColumnHeaders()); |
271 o.add(buildResultTableColumnHeaders()); | 271 o.add(buildResultTableColumnHeaders()); |
272 return o; | 272 return o; |
273 } | 273 } |
274 | 274 |
275 checkUnnamed195(core.List<api.ResultTableColumnHeaders> o) { | 275 checkUnnamed197(core.List<api.ResultTableColumnHeaders> o) { |
276 unittest.expect(o, unittest.hasLength(2)); | 276 unittest.expect(o, unittest.hasLength(2)); |
277 checkResultTableColumnHeaders(o[0]); | 277 checkResultTableColumnHeaders(o[0]); |
278 checkResultTableColumnHeaders(o[1]); | 278 checkResultTableColumnHeaders(o[1]); |
279 } | 279 } |
280 | 280 |
281 buildUnnamed196() { | 281 buildUnnamed198() { |
282 var o = new core.List<core.Object>(); | 282 var o = new core.List<core.Object>(); |
283 o.add({'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}); | 283 o.add({'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}); |
284 o.add({'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}); | 284 o.add({'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}); |
285 return o; | 285 return o; |
286 } | 286 } |
287 | 287 |
288 checkUnnamed196(core.List<core.Object> o) { | 288 checkUnnamed198(core.List<core.Object> o) { |
289 unittest.expect(o, unittest.hasLength(2)); | 289 unittest.expect(o, unittest.hasLength(2)); |
290 var casted1 = (o[0]) as core.Map; unittest.expect(casted1, unittest.hasLength(
3)); unittest.expect(casted1["list"], unittest.equals([1, 2, 3])); unittest.expe
ct(casted1["bool"], unittest.equals(true)); unittest.expect(casted1["string"], u
nittest.equals('foo')); | 290 var casted1 = (o[0]) as core.Map; unittest.expect(casted1, unittest.hasLength(
3)); unittest.expect(casted1["list"], unittest.equals([1, 2, 3])); unittest.expe
ct(casted1["bool"], unittest.equals(true)); unittest.expect(casted1["string"], u
nittest.equals('foo')); |
291 var casted2 = (o[1]) as core.Map; unittest.expect(casted2, unittest.hasLength(
3)); unittest.expect(casted2["list"], unittest.equals([1, 2, 3])); unittest.expe
ct(casted2["bool"], unittest.equals(true)); unittest.expect(casted2["string"], u
nittest.equals('foo')); | 291 var casted2 = (o[1]) as core.Map; unittest.expect(casted2, unittest.hasLength(
3)); unittest.expect(casted2["list"], unittest.equals([1, 2, 3])); unittest.expe
ct(casted2["bool"], unittest.equals(true)); unittest.expect(casted2["string"], u
nittest.equals('foo')); |
292 } | 292 } |
293 | 293 |
294 buildUnnamed197() { | 294 buildUnnamed199() { |
295 var o = new core.List<core.List<core.Object>>(); | 295 var o = new core.List<core.List<core.Object>>(); |
296 o.add(buildUnnamed196()); | 296 o.add(buildUnnamed198()); |
297 o.add(buildUnnamed196()); | 297 o.add(buildUnnamed198()); |
298 return o; | 298 return o; |
299 } | 299 } |
300 | 300 |
301 checkUnnamed197(core.List<core.List<core.Object>> o) { | 301 checkUnnamed199(core.List<core.List<core.Object>> o) { |
302 unittest.expect(o, unittest.hasLength(2)); | 302 unittest.expect(o, unittest.hasLength(2)); |
303 checkUnnamed196(o[0]); | 303 checkUnnamed198(o[0]); |
304 checkUnnamed196(o[1]); | 304 checkUnnamed198(o[1]); |
305 } | 305 } |
306 | 306 |
307 core.int buildCounterResultTable = 0; | 307 core.int buildCounterResultTable = 0; |
308 buildResultTable() { | 308 buildResultTable() { |
309 var o = new api.ResultTable(); | 309 var o = new api.ResultTable(); |
310 buildCounterResultTable++; | 310 buildCounterResultTable++; |
311 if (buildCounterResultTable < 3) { | 311 if (buildCounterResultTable < 3) { |
312 o.columnHeaders = buildUnnamed195(); | 312 o.columnHeaders = buildUnnamed197(); |
313 o.kind = "foo"; | 313 o.kind = "foo"; |
314 o.rows = buildUnnamed197(); | 314 o.rows = buildUnnamed199(); |
315 } | 315 } |
316 buildCounterResultTable--; | 316 buildCounterResultTable--; |
317 return o; | 317 return o; |
318 } | 318 } |
319 | 319 |
320 checkResultTable(api.ResultTable o) { | 320 checkResultTable(api.ResultTable o) { |
321 buildCounterResultTable++; | 321 buildCounterResultTable++; |
322 if (buildCounterResultTable < 3) { | 322 if (buildCounterResultTable < 3) { |
323 checkUnnamed195(o.columnHeaders); | 323 checkUnnamed197(o.columnHeaders); |
324 unittest.expect(o.kind, unittest.equals('foo')); | 324 unittest.expect(o.kind, unittest.equals('foo')); |
325 checkUnnamed197(o.rows); | 325 checkUnnamed199(o.rows); |
326 } | 326 } |
327 buildCounterResultTable--; | 327 buildCounterResultTable--; |
328 } | 328 } |
329 | 329 |
330 | 330 |
331 main() { | 331 main() { |
332 unittest.group("obj-schema-GroupContentDetails", () { | 332 unittest.group("obj-schema-GroupContentDetails", () { |
333 unittest.test("to-json--from-json", () { | 333 unittest.test("to-json--from-json", () { |
334 var o = buildGroupContentDetails(); | 334 var o = buildGroupContentDetails(); |
335 var od = new api.GroupContentDetails.fromJson(o.toJson()); | 335 var od = new api.GroupContentDetails.fromJson(o.toJson()); |
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
772 | 772 |
773 var mock = new HttpServerMock(); | 773 var mock = new HttpServerMock(); |
774 api.ReportsResourceApi res = new api.YoutubeAnalyticsApi(mock).reports; | 774 api.ReportsResourceApi res = new api.YoutubeAnalyticsApi(mock).reports; |
775 var arg_ids = "foo"; | 775 var arg_ids = "foo"; |
776 var arg_start_date = "foo"; | 776 var arg_start_date = "foo"; |
777 var arg_end_date = "foo"; | 777 var arg_end_date = "foo"; |
778 var arg_metrics = "foo"; | 778 var arg_metrics = "foo"; |
779 var arg_currency = "foo"; | 779 var arg_currency = "foo"; |
780 var arg_dimensions = "foo"; | 780 var arg_dimensions = "foo"; |
781 var arg_filters = "foo"; | 781 var arg_filters = "foo"; |
| 782 var arg_include_historical_channel_data = true; |
782 var arg_max_results = 42; | 783 var arg_max_results = 42; |
783 var arg_sort = "foo"; | 784 var arg_sort = "foo"; |
784 var arg_start_index = 42; | 785 var arg_start_index = 42; |
785 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 786 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
786 var path = (req.url).path; | 787 var path = (req.url).path; |
787 var pathOffset = 0; | 788 var pathOffset = 0; |
788 var index; | 789 var index; |
789 var subPart; | 790 var subPart; |
790 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 791 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
791 pathOffset += 1; | 792 pathOffset += 1; |
(...skipping 18 matching lines...) Expand all Loading... |
810 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 811 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
811 } | 812 } |
812 } | 813 } |
813 unittest.expect(queryMap["ids"].first, unittest.equals(arg_ids)); | 814 unittest.expect(queryMap["ids"].first, unittest.equals(arg_ids)); |
814 unittest.expect(queryMap["start-date"].first, unittest.equals(arg_start_
date)); | 815 unittest.expect(queryMap["start-date"].first, unittest.equals(arg_start_
date)); |
815 unittest.expect(queryMap["end-date"].first, unittest.equals(arg_end_date
)); | 816 unittest.expect(queryMap["end-date"].first, unittest.equals(arg_end_date
)); |
816 unittest.expect(queryMap["metrics"].first, unittest.equals(arg_metrics))
; | 817 unittest.expect(queryMap["metrics"].first, unittest.equals(arg_metrics))
; |
817 unittest.expect(queryMap["currency"].first, unittest.equals(arg_currency
)); | 818 unittest.expect(queryMap["currency"].first, unittest.equals(arg_currency
)); |
818 unittest.expect(queryMap["dimensions"].first, unittest.equals(arg_dimens
ions)); | 819 unittest.expect(queryMap["dimensions"].first, unittest.equals(arg_dimens
ions)); |
819 unittest.expect(queryMap["filters"].first, unittest.equals(arg_filters))
; | 820 unittest.expect(queryMap["filters"].first, unittest.equals(arg_filters))
; |
| 821 unittest.expect(queryMap["include-historical-channel-data"].first, unitt
est.equals("$arg_include_historical_channel_data")); |
820 unittest.expect(core.int.parse(queryMap["max-results"].first), unittest.
equals(arg_max_results)); | 822 unittest.expect(core.int.parse(queryMap["max-results"].first), unittest.
equals(arg_max_results)); |
821 unittest.expect(queryMap["sort"].first, unittest.equals(arg_sort)); | 823 unittest.expect(queryMap["sort"].first, unittest.equals(arg_sort)); |
822 unittest.expect(core.int.parse(queryMap["start-index"].first), unittest.
equals(arg_start_index)); | 824 unittest.expect(core.int.parse(queryMap["start-index"].first), unittest.
equals(arg_start_index)); |
823 | 825 |
824 | 826 |
825 var h = { | 827 var h = { |
826 "content-type" : "application/json; charset=utf-8", | 828 "content-type" : "application/json; charset=utf-8", |
827 }; | 829 }; |
828 var resp = convert.JSON.encode(buildResultTable()); | 830 var resp = convert.JSON.encode(buildResultTable()); |
829 return new async.Future.value(stringResponse(200, h, resp)); | 831 return new async.Future.value(stringResponse(200, h, resp)); |
830 }), true); | 832 }), true); |
831 res.query(arg_ids, arg_start_date, arg_end_date, arg_metrics, currency: ar
g_currency, dimensions: arg_dimensions, filters: arg_filters, max_results: arg_m
ax_results, sort: arg_sort, start_index: arg_start_index).then(unittest.expectAs
ync(((api.ResultTable response) { | 833 res.query(arg_ids, arg_start_date, arg_end_date, arg_metrics, currency: ar
g_currency, dimensions: arg_dimensions, filters: arg_filters, include_historical
_channel_data: arg_include_historical_channel_data, max_results: arg_max_results
, sort: arg_sort, start_index: arg_start_index).then(unittest.expectAsync(((api.
ResultTable response) { |
832 checkResultTable(response); | 834 checkResultTable(response); |
833 }))); | 835 }))); |
834 }); | 836 }); |
835 | 837 |
836 }); | 838 }); |
837 | 839 |
838 | 840 |
839 } | 841 } |
840 | 842 |
OLD | NEW |