Index: generated/googleapis/test/groupssettings/v1_test.dart |
diff --git a/generated/googleapis/test/groupssettings/v1_test.dart b/generated/googleapis/test/groupssettings/v1_test.dart |
index 69bfd14a14fd61abece605619fd8adaae0d7a153..ad5fe08d5a8281620a8db73fe9971f0c56c77c0a 100644 |
--- a/generated/googleapis/test/groupssettings/v1_test.dart |
+++ b/generated/googleapis/test/groupssettings/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/groupssettings/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() { |
@@ -103,7 +138,7 @@ main() { |
unittest.group("resource-GroupsResourceApi", () { |
unittest.test("method--get", () { |
- var mock = new common_test.HttpServerMock(); |
+ var mock = new HttpServerMock(); |
api.GroupsResourceApi res = new api.GroupssettingsApi(mock).groups; |
var arg_groupUniqueId = "foo"; |
mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
@@ -136,7 +171,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.get(arg_groupUniqueId).then(unittest.expectAsync(((api.Groups response) { |
checkGroups(response); |
@@ -145,7 +180,7 @@ main() { |
unittest.test("method--patch", () { |
- var mock = new common_test.HttpServerMock(); |
+ var mock = new HttpServerMock(); |
api.GroupsResourceApi res = new api.GroupssettingsApi(mock).groups; |
var arg_request = buildGroups(); |
var arg_groupUniqueId = "foo"; |
@@ -182,7 +217,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.patch(arg_request, arg_groupUniqueId).then(unittest.expectAsync(((api.Groups response) { |
checkGroups(response); |
@@ -191,7 +226,7 @@ main() { |
unittest.test("method--update", () { |
- var mock = new common_test.HttpServerMock(); |
+ var mock = new HttpServerMock(); |
api.GroupsResourceApi res = new api.GroupssettingsApi(mock).groups; |
var arg_request = buildGroups(); |
var arg_groupUniqueId = "foo"; |
@@ -228,7 +263,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.update(arg_request, arg_groupUniqueId).then(unittest.expectAsync(((api.Groups response) { |
checkGroups(response); |