| Index: generated/googleapis/test/groupsmigration/v1_test.dart
|
| diff --git a/generated/googleapis/test/groupsmigration/v1_test.dart b/generated/googleapis/test/groupsmigration/v1_test.dart
|
| index bcf6d73082d6ffaba33c9afc3906ca42f6bd7e45..04ab38752fe8cb22752fc3825ae21d3b6492c13e 100644
|
| --- a/generated/googleapis/test/groupsmigration/v1_test.dart
|
| +++ b/generated/googleapis/test/groupsmigration/v1_test.dart
|
| @@ -8,13 +8,48 @@ import "dart:convert" as convert;
|
| import 'package:http/http.dart' as http;
|
| import 'package:http/testing.dart' as http_testing;
|
| import 'package:unittest/unittest.dart' as unittest;
|
| -import 'package:googleapis/common/common.dart' as common;
|
| -import 'package:googleapis/src/common_internal.dart' as common_internal;
|
| -import '../common/common_internal_test.dart' as common_test;
|
|
|
| import 'package:googleapis/groupsmigration/v1.dart' as api;
|
|
|
| +class HttpServerMock extends http.BaseClient {
|
| + core.Function _callback;
|
| + core.bool _expectJson;
|
|
|
| + void register(core.Function callback, core.bool expectJson) {
|
| + _callback = callback;
|
| + _expectJson = expectJson;
|
| + }
|
| +
|
| + async.Future<http.StreamedResponse> send(http.BaseRequest request) {
|
| + if (_expectJson) {
|
| + return request.finalize()
|
| + .transform(convert.UTF8.decoder)
|
| + .join('')
|
| + .then((core.String jsonString) {
|
| + if (jsonString.isEmpty) {
|
| + return _callback(request, null);
|
| + } else {
|
| + return _callback(request, convert.JSON.decode(jsonString));
|
| + }
|
| + });
|
| + } else {
|
| + var stream = request.finalize();
|
| + if (stream == null) {
|
| + return _callback(request, []);
|
| + } else {
|
| + return stream.toBytes().then((data) {
|
| + return _callback(request, data);
|
| + });
|
| + }
|
| + }
|
| + }
|
| +}
|
| +
|
| +http.StreamedResponse stringResponse(
|
| + core.int status, core.Map headers, core.String body) {
|
| + var stream = new async.Stream.fromIterable([convert.UTF8.encode(body)]);
|
| + return new http.StreamedResponse(stream, status, headers: headers);
|
| +}
|
|
|
| core.int buildCounterGroups = 0;
|
| buildGroups() {
|
| @@ -53,7 +88,7 @@ main() {
|
| // TODO: Implement tests for media upload;
|
| // TODO: Implement tests for media download;
|
|
|
| - var mock = new common_test.HttpServerMock();
|
| + var mock = new HttpServerMock();
|
| api.ArchiveResourceApi res = new api.GroupsmigrationApi(mock).archive;
|
| var arg_groupId = "foo";
|
| mock.register(unittest.expectAsync((http.BaseRequest req, json) {
|
| @@ -86,7 +121,7 @@ main() {
|
| "content-type" : "application/json; charset=utf-8",
|
| };
|
| var resp = convert.JSON.encode(buildGroups());
|
| - return new async.Future.value(common_test.stringResponse(200, h, resp));
|
| + return new async.Future.value(stringResponse(200, h, resp));
|
| }), true);
|
| res.insert(arg_groupId).then(unittest.expectAsync(((api.Groups response) {
|
| checkGroups(response);
|
|
|