Index: generated/googleapis/test/admin/email_migration_v2_test.dart |
diff --git a/generated/googleapis/test/admin/email_migration_v2_test.dart b/generated/googleapis/test/admin/email_migration_v2_test.dart |
index 8bb33159855e3bc3d14d2d7d4e321df691772b60..1a3ef5de73ad6632ec46f5825fed70eae2c75668 100644 |
--- a/generated/googleapis/test/admin/email_migration_v2_test.dart |
+++ b/generated/googleapis/test/admin/email_migration_v2_test.dart |
@@ -8,22 +8,57 @@ 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/admin/email_migration_v2.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); |
+} |
-buildUnnamed0() { |
+buildUnnamed120() { |
var o = new core.List<core.String>(); |
o.add("foo"); |
o.add("foo"); |
return o; |
} |
-checkUnnamed0(core.List<core.String> o) { |
+checkUnnamed120(core.List<core.String> o) { |
unittest.expect(o, unittest.hasLength(2)); |
unittest.expect(o[0], unittest.equals('foo')); |
unittest.expect(o[1], unittest.equals('foo')); |
@@ -42,7 +77,7 @@ buildMailItem() { |
o.isTrash = true; |
o.isUnread = true; |
o.kind = "foo"; |
- o.labels = buildUnnamed0(); |
+ o.labels = buildUnnamed120(); |
} |
buildCounterMailItem--; |
return o; |
@@ -59,7 +94,7 @@ checkMailItem(api.MailItem o) { |
unittest.expect(o.isTrash, unittest.isTrue); |
unittest.expect(o.isUnread, unittest.isTrue); |
unittest.expect(o.kind, unittest.equals('foo')); |
- checkUnnamed0(o.labels); |
+ checkUnnamed120(o.labels); |
} |
buildCounterMailItem--; |
} |
@@ -80,7 +115,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.MailResourceApi res = new api.AdminApi(mock).mail; |
var arg_request = buildMailItem(); |
var arg_userKey = "foo"; |
@@ -117,7 +152,7 @@ main() { |
"content-type" : "application/json; charset=utf-8", |
}; |
var resp = ""; |
- return new async.Future.value(common_test.stringResponse(200, h, resp)); |
+ return new async.Future.value(stringResponse(200, h, resp)); |
}), true); |
res.insert(arg_request, arg_userKey).then(unittest.expectAsync((_) {})); |
}); |