blob: eccffbc10e34811a1bc990b2fbef65c978f69248 [file] [log] [blame]
// ignore_for_file: camel_case_types
// ignore_for_file: comment_references
// ignore_for_file: constant_identifier_names
// ignore_for_file: directives_ordering
// ignore_for_file: file_names
// ignore_for_file: library_names
// ignore_for_file: lines_longer_than_80_chars
// ignore_for_file: non_constant_identifier_names
// ignore_for_file: omit_local_variable_types
// ignore_for_file: prefer_expression_function_bodies
// ignore_for_file: prefer_final_locals
// ignore_for_file: prefer_interpolation_to_compose_strings
// ignore_for_file: unnecessary_brace_in_string_interps
// ignore_for_file: unnecessary_cast
// ignore_for_file: unnecessary_lambdas
// ignore_for_file: unnecessary_parenthesis
// ignore_for_file: unnecessary_string_interpolations
// ignore_for_file: avoid_returning_null
// ignore_for_file: cascade_invocations
// ignore_for_file: prefer_single_quotes
// ignore_for_file: unused_local_variable
library googleapis.gmail.v1.test;
import "dart:core" as core;
import "dart:async" as async;
import "dart:convert" as convert;
import 'package:http/http.dart' as http;
import 'package:test/test.dart' as unittest;
import 'package:googleapis/gmail/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;
}
@core.override
async.Future<http.StreamedResponse> send(http.BaseRequest request) async {
if (_expectJson) {
final jsonString =
await request.finalize().transform(convert.utf8.decoder).join('');
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 {
final data = await stream.toBytes();
return _callback(request, data);
}
}
}
}
http.StreamedResponse stringResponse(core.int status,
core.Map<core.String, core.String> headers, core.String body) {
var stream = async.Stream.fromIterable([convert.utf8.encode(body)]);
return http.StreamedResponse(stream, status, headers: headers);
}
core.int buildCounterAutoForwarding = 0;
api.AutoForwarding buildAutoForwarding() {
var o = api.AutoForwarding();
buildCounterAutoForwarding++;
if (buildCounterAutoForwarding < 3) {
o.disposition = 'foo';
o.emailAddress = 'foo';
o.enabled = true;
}
buildCounterAutoForwarding--;
return o;
}
void checkAutoForwarding(api.AutoForwarding o) {
buildCounterAutoForwarding++;
if (buildCounterAutoForwarding < 3) {
unittest.expect(o.disposition, unittest.equals('foo'));
unittest.expect(o.emailAddress, unittest.equals('foo'));
unittest.expect(o.enabled, unittest.isTrue);
}
buildCounterAutoForwarding--;
}
core.List<core.String> buildUnnamed3173() {
var o = <core.String>[];
o.add('foo');
o.add('foo');
return o;
}
void checkUnnamed3173(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'));
}
core.int buildCounterBatchDeleteMessagesRequest = 0;
api.BatchDeleteMessagesRequest buildBatchDeleteMessagesRequest() {
var o = api.BatchDeleteMessagesRequest();
buildCounterBatchDeleteMessagesRequest++;
if (buildCounterBatchDeleteMessagesRequest < 3) {
o.ids = buildUnnamed3173();
}
buildCounterBatchDeleteMessagesRequest--;
return o;
}
void checkBatchDeleteMessagesRequest(api.BatchDeleteMessagesRequest o) {
buildCounterBatchDeleteMessagesRequest++;
if (buildCounterBatchDeleteMessagesRequest < 3) {
checkUnnamed3173(o.ids);
}
buildCounterBatchDeleteMessagesRequest--;
}
core.List<core.String> buildUnnamed3174() {
var o = <core.String>[];
o.add('foo');
o.add('foo');
return o;
}
void checkUnnamed3174(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'));
}
core.List<core.String> buildUnnamed3175() {
var o = <core.String>[];
o.add('foo');
o.add('foo');
return o;
}
void checkUnnamed3175(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'));
}
core.List<core.String> buildUnnamed3176() {
var o = <core.String>[];
o.add('foo');
o.add('foo');
return o;
}
void checkUnnamed3176(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'));
}
core.int buildCounterBatchModifyMessagesRequest = 0;
api.BatchModifyMessagesRequest buildBatchModifyMessagesRequest() {
var o = api.BatchModifyMessagesRequest();
buildCounterBatchModifyMessagesRequest++;
if (buildCounterBatchModifyMessagesRequest < 3) {
o.addLabelIds = buildUnnamed3174();
o.ids = buildUnnamed3175();
o.removeLabelIds = buildUnnamed3176();
}
buildCounterBatchModifyMessagesRequest--;
return o;
}
void checkBatchModifyMessagesRequest(api.BatchModifyMessagesRequest o) {
buildCounterBatchModifyMessagesRequest++;
if (buildCounterBatchModifyMessagesRequest < 3) {
checkUnnamed3174(o.addLabelIds);
checkUnnamed3175(o.ids);
checkUnnamed3176(o.removeLabelIds);
}
buildCounterBatchModifyMessagesRequest--;
}
core.int buildCounterDelegate = 0;
api.Delegate buildDelegate() {
var o = api.Delegate();
buildCounterDelegate++;
if (buildCounterDelegate < 3) {
o.delegateEmail = 'foo';
o.verificationStatus = 'foo';
}
buildCounterDelegate--;
return o;
}
void checkDelegate(api.Delegate o) {
buildCounterDelegate++;
if (buildCounterDelegate < 3) {
unittest.expect(o.delegateEmail, unittest.equals('foo'));
unittest.expect(o.verificationStatus, unittest.equals('foo'));
}
buildCounterDelegate--;
}
core.int buildCounterDraft = 0;
api.Draft buildDraft() {
var o = api.Draft();
buildCounterDraft++;
if (buildCounterDraft < 3) {
o.id = 'foo';
o.message = buildMessage();
}
buildCounterDraft--;
return o;
}
void checkDraft(api.Draft o) {
buildCounterDraft++;
if (buildCounterDraft < 3) {
unittest.expect(o.id, unittest.equals('foo'));
checkMessage(o.message);
}
buildCounterDraft--;
}
core.int buildCounterFilter = 0;
api.Filter buildFilter() {
var o = api.Filter();
buildCounterFilter++;
if (buildCounterFilter < 3) {
o.action = buildFilterAction();
o.criteria = buildFilterCriteria();
o.id = 'foo';
}
buildCounterFilter--;
return o;
}
void checkFilter(api.Filter o) {
buildCounterFilter++;
if (buildCounterFilter < 3) {
checkFilterAction(o.action);
checkFilterCriteria(o.criteria);
unittest.expect(o.id, unittest.equals('foo'));
}
buildCounterFilter--;
}
core.List<core.String> buildUnnamed3177() {
var o = <core.String>[];
o.add('foo');
o.add('foo');
return o;
}
void checkUnnamed3177(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'));
}
core.List<core.String> buildUnnamed3178() {
var o = <core.String>[];
o.add('foo');
o.add('foo');
return o;
}
void checkUnnamed3178(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'));
}
core.int buildCounterFilterAction = 0;
api.FilterAction buildFilterAction() {
var o = api.FilterAction();
buildCounterFilterAction++;
if (buildCounterFilterAction < 3) {
o.addLabelIds = buildUnnamed3177();
o.forward = 'foo';
o.removeLabelIds = buildUnnamed3178();
}
buildCounterFilterAction--;
return o;
}
void checkFilterAction(api.FilterAction o) {
buildCounterFilterAction++;
if (buildCounterFilterAction < 3) {
checkUnnamed3177(o.addLabelIds);
unittest.expect(o.forward, unittest.equals('foo'));
checkUnnamed3178(o.removeLabelIds);
}
buildCounterFilterAction--;
}
core.int buildCounterFilterCriteria = 0;
api.FilterCriteria buildFilterCriteria() {
var o = api.FilterCriteria();
buildCounterFilterCriteria++;
if (buildCounterFilterCriteria < 3) {
o.excludeChats = true;
o.from = 'foo';
o.hasAttachment = true;
o.negatedQuery = 'foo';
o.query = 'foo';
o.size = 42;
o.sizeComparison = 'foo';
o.subject = 'foo';
o.to = 'foo';
}
buildCounterFilterCriteria--;
return o;
}
void checkFilterCriteria(api.FilterCriteria o) {
buildCounterFilterCriteria++;
if (buildCounterFilterCriteria < 3) {
unittest.expect(o.excludeChats, unittest.isTrue);
unittest.expect(o.from, unittest.equals('foo'));
unittest.expect(o.hasAttachment, unittest.isTrue);
unittest.expect(o.negatedQuery, unittest.equals('foo'));
unittest.expect(o.query, unittest.equals('foo'));
unittest.expect(o.size, unittest.equals(42));
unittest.expect(o.sizeComparison, unittest.equals('foo'));
unittest.expect(o.subject, unittest.equals('foo'));
unittest.expect(o.to, unittest.equals('foo'));
}
buildCounterFilterCriteria--;
}
core.int buildCounterForwardingAddress = 0;
api.ForwardingAddress buildForwardingAddress() {
var o = api.ForwardingAddress();
buildCounterForwardingAddress++;
if (buildCounterForwardingAddress < 3) {
o.forwardingEmail = 'foo';
o.verificationStatus = 'foo';
}
buildCounterForwardingAddress--;
return o;
}
void checkForwardingAddress(api.ForwardingAddress o) {
buildCounterForwardingAddress++;
if (buildCounterForwardingAddress < 3) {
unittest.expect(o.forwardingEmail, unittest.equals('foo'));
unittest.expect(o.verificationStatus, unittest.equals('foo'));
}
buildCounterForwardingAddress--;
}
core.List<api.HistoryLabelAdded> buildUnnamed3179() {
var o = <api.HistoryLabelAdded>[];
o.add(buildHistoryLabelAdded());
o.add(buildHistoryLabelAdded());
return o;
}
void checkUnnamed3179(core.List<api.HistoryLabelAdded> o) {
unittest.expect(o, unittest.hasLength(2));
checkHistoryLabelAdded(o[0]);
checkHistoryLabelAdded(o[1]);
}
core.List<api.HistoryLabelRemoved> buildUnnamed3180() {
var o = <api.HistoryLabelRemoved>[];
o.add(buildHistoryLabelRemoved());
o.add(buildHistoryLabelRemoved());
return o;
}
void checkUnnamed3180(core.List<api.HistoryLabelRemoved> o) {
unittest.expect(o, unittest.hasLength(2));
checkHistoryLabelRemoved(o[0]);
checkHistoryLabelRemoved(o[1]);
}
core.List<api.Message> buildUnnamed3181() {
var o = <api.Message>[];
o.add(buildMessage());
o.add(buildMessage());
return o;
}
void checkUnnamed3181(core.List<api.Message> o) {
unittest.expect(o, unittest.hasLength(2));
checkMessage(o[0]);
checkMessage(o[1]);
}
core.List<api.HistoryMessageAdded> buildUnnamed3182() {
var o = <api.HistoryMessageAdded>[];
o.add(buildHistoryMessageAdded());
o.add(buildHistoryMessageAdded());
return o;
}
void checkUnnamed3182(core.List<api.HistoryMessageAdded> o) {
unittest.expect(o, unittest.hasLength(2));
checkHistoryMessageAdded(o[0]);
checkHistoryMessageAdded(o[1]);
}
core.List<api.HistoryMessageDeleted> buildUnnamed3183() {
var o = <api.HistoryMessageDeleted>[];
o.add(buildHistoryMessageDeleted());
o.add(buildHistoryMessageDeleted());
return o;
}
void checkUnnamed3183(core.List<api.HistoryMessageDeleted> o) {
unittest.expect(o, unittest.hasLength(2));
checkHistoryMessageDeleted(o[0]);
checkHistoryMessageDeleted(o[1]);
}
core.int buildCounterHistory = 0;
api.History buildHistory() {
var o = api.History();
buildCounterHistory++;
if (buildCounterHistory < 3) {
o.id = 'foo';
o.labelsAdded = buildUnnamed3179();
o.labelsRemoved = buildUnnamed3180();
o.messages = buildUnnamed3181();
o.messagesAdded = buildUnnamed3182();
o.messagesDeleted = buildUnnamed3183();
}
buildCounterHistory--;
return o;
}
void checkHistory(api.History o) {
buildCounterHistory++;
if (buildCounterHistory < 3) {
unittest.expect(o.id, unittest.equals('foo'));
checkUnnamed3179(o.labelsAdded);
checkUnnamed3180(o.labelsRemoved);
checkUnnamed3181(o.messages);
checkUnnamed3182(o.messagesAdded);
checkUnnamed3183(o.messagesDeleted);
}
buildCounterHistory--;
}
core.List<core.String> buildUnnamed3184() {
var o = <core.String>[];
o.add('foo');
o.add('foo');
return o;
}
void checkUnnamed3184(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'));
}
core.int buildCounterHistoryLabelAdded = 0;
api.HistoryLabelAdded buildHistoryLabelAdded() {
var o = api.HistoryLabelAdded();
buildCounterHistoryLabelAdded++;
if (buildCounterHistoryLabelAdded < 3) {
o.labelIds = buildUnnamed3184();
o.message = buildMessage();
}
buildCounterHistoryLabelAdded--;
return o;
}
void checkHistoryLabelAdded(api.HistoryLabelAdded o) {
buildCounterHistoryLabelAdded++;
if (buildCounterHistoryLabelAdded < 3) {
checkUnnamed3184(o.labelIds);
checkMessage(o.message);
}
buildCounterHistoryLabelAdded--;
}
core.List<core.String> buildUnnamed3185() {
var o = <core.String>[];
o.add('foo');
o.add('foo');
return o;
}
void checkUnnamed3185(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'));
}
core.int buildCounterHistoryLabelRemoved = 0;
api.HistoryLabelRemoved buildHistoryLabelRemoved() {
var o = api.HistoryLabelRemoved();
buildCounterHistoryLabelRemoved++;
if (buildCounterHistoryLabelRemoved < 3) {
o.labelIds = buildUnnamed3185();
o.message = buildMessage();
}
buildCounterHistoryLabelRemoved--;
return o;
}
void checkHistoryLabelRemoved(api.HistoryLabelRemoved o) {
buildCounterHistoryLabelRemoved++;
if (buildCounterHistoryLabelRemoved < 3) {
checkUnnamed3185(o.labelIds);
checkMessage(o.message);
}
buildCounterHistoryLabelRemoved--;
}
core.int buildCounterHistoryMessageAdded = 0;
api.HistoryMessageAdded buildHistoryMessageAdded() {
var o = api.HistoryMessageAdded();
buildCounterHistoryMessageAdded++;
if (buildCounterHistoryMessageAdded < 3) {
o.message = buildMessage();
}
buildCounterHistoryMessageAdded--;
return o;
}
void checkHistoryMessageAdded(api.HistoryMessageAdded o) {
buildCounterHistoryMessageAdded++;
if (buildCounterHistoryMessageAdded < 3) {
checkMessage(o.message);
}
buildCounterHistoryMessageAdded--;
}
core.int buildCounterHistoryMessageDeleted = 0;
api.HistoryMessageDeleted buildHistoryMessageDeleted() {
var o = api.HistoryMessageDeleted();
buildCounterHistoryMessageDeleted++;
if (buildCounterHistoryMessageDeleted < 3) {
o.message = buildMessage();
}
buildCounterHistoryMessageDeleted--;
return o;
}
void checkHistoryMessageDeleted(api.HistoryMessageDeleted o) {
buildCounterHistoryMessageDeleted++;
if (buildCounterHistoryMessageDeleted < 3) {
checkMessage(o.message);
}
buildCounterHistoryMessageDeleted--;
}
core.int buildCounterImapSettings = 0;
api.ImapSettings buildImapSettings() {
var o = api.ImapSettings();
buildCounterImapSettings++;
if (buildCounterImapSettings < 3) {
o.autoExpunge = true;
o.enabled = true;
o.expungeBehavior = 'foo';
o.maxFolderSize = 42;
}
buildCounterImapSettings--;
return o;
}
void checkImapSettings(api.ImapSettings o) {
buildCounterImapSettings++;
if (buildCounterImapSettings < 3) {
unittest.expect(o.autoExpunge, unittest.isTrue);
unittest.expect(o.enabled, unittest.isTrue);
unittest.expect(o.expungeBehavior, unittest.equals('foo'));
unittest.expect(o.maxFolderSize, unittest.equals(42));
}
buildCounterImapSettings--;
}
core.int buildCounterLabel = 0;
api.Label buildLabel() {
var o = api.Label();
buildCounterLabel++;
if (buildCounterLabel < 3) {
o.color = buildLabelColor();
o.id = 'foo';
o.labelListVisibility = 'foo';
o.messageListVisibility = 'foo';
o.messagesTotal = 42;
o.messagesUnread = 42;
o.name = 'foo';
o.threadsTotal = 42;
o.threadsUnread = 42;
o.type = 'foo';
}
buildCounterLabel--;
return o;
}
void checkLabel(api.Label o) {
buildCounterLabel++;
if (buildCounterLabel < 3) {
checkLabelColor(o.color);
unittest.expect(o.id, unittest.equals('foo'));
unittest.expect(o.labelListVisibility, unittest.equals('foo'));
unittest.expect(o.messageListVisibility, unittest.equals('foo'));
unittest.expect(o.messagesTotal, unittest.equals(42));
unittest.expect(o.messagesUnread, unittest.equals(42));
unittest.expect(o.name, unittest.equals('foo'));
unittest.expect(o.threadsTotal, unittest.equals(42));
unittest.expect(o.threadsUnread, unittest.equals(42));
unittest.expect(o.type, unittest.equals('foo'));
}
buildCounterLabel--;
}
core.int buildCounterLabelColor = 0;
api.LabelColor buildLabelColor() {
var o = api.LabelColor();
buildCounterLabelColor++;
if (buildCounterLabelColor < 3) {
o.backgroundColor = 'foo';
o.textColor = 'foo';
}
buildCounterLabelColor--;
return o;
}
void checkLabelColor(api.LabelColor o) {
buildCounterLabelColor++;
if (buildCounterLabelColor < 3) {
unittest.expect(o.backgroundColor, unittest.equals('foo'));
unittest.expect(o.textColor, unittest.equals('foo'));
}
buildCounterLabelColor--;
}
core.int buildCounterLanguageSettings = 0;
api.LanguageSettings buildLanguageSettings() {
var o = api.LanguageSettings();
buildCounterLanguageSettings++;
if (buildCounterLanguageSettings < 3) {
o.displayLanguage = 'foo';
}
buildCounterLanguageSettings--;
return o;
}
void checkLanguageSettings(api.LanguageSettings o) {
buildCounterLanguageSettings++;
if (buildCounterLanguageSettings < 3) {
unittest.expect(o.displayLanguage, unittest.equals('foo'));
}
buildCounterLanguageSettings--;
}
core.List<api.Delegate> buildUnnamed3186() {
var o = <api.Delegate>[];
o.add(buildDelegate());
o.add(buildDelegate());
return o;
}
void checkUnnamed3186(core.List<api.Delegate> o) {
unittest.expect(o, unittest.hasLength(2));
checkDelegate(o[0]);
checkDelegate(o[1]);
}
core.int buildCounterListDelegatesResponse = 0;
api.ListDelegatesResponse buildListDelegatesResponse() {
var o = api.ListDelegatesResponse();
buildCounterListDelegatesResponse++;
if (buildCounterListDelegatesResponse < 3) {
o.delegates = buildUnnamed3186();
}
buildCounterListDelegatesResponse--;
return o;
}
void checkListDelegatesResponse(api.ListDelegatesResponse o) {
buildCounterListDelegatesResponse++;
if (buildCounterListDelegatesResponse < 3) {
checkUnnamed3186(o.delegates);
}
buildCounterListDelegatesResponse--;
}
core.List<api.Draft> buildUnnamed3187() {
var o = <api.Draft>[];
o.add(buildDraft());
o.add(buildDraft());
return o;
}
void checkUnnamed3187(core.List<api.Draft> o) {
unittest.expect(o, unittest.hasLength(2));
checkDraft(o[0]);
checkDraft(o[1]);
}
core.int buildCounterListDraftsResponse = 0;
api.ListDraftsResponse buildListDraftsResponse() {
var o = api.ListDraftsResponse();
buildCounterListDraftsResponse++;
if (buildCounterListDraftsResponse < 3) {
o.drafts = buildUnnamed3187();
o.nextPageToken = 'foo';
o.resultSizeEstimate = 42;
}
buildCounterListDraftsResponse--;
return o;
}
void checkListDraftsResponse(api.ListDraftsResponse o) {
buildCounterListDraftsResponse++;
if (buildCounterListDraftsResponse < 3) {
checkUnnamed3187(o.drafts);
unittest.expect(o.nextPageToken, unittest.equals('foo'));
unittest.expect(o.resultSizeEstimate, unittest.equals(42));
}
buildCounterListDraftsResponse--;
}
core.List<api.Filter> buildUnnamed3188() {
var o = <api.Filter>[];
o.add(buildFilter());
o.add(buildFilter());
return o;
}
void checkUnnamed3188(core.List<api.Filter> o) {
unittest.expect(o, unittest.hasLength(2));
checkFilter(o[0]);
checkFilter(o[1]);
}
core.int buildCounterListFiltersResponse = 0;
api.ListFiltersResponse buildListFiltersResponse() {
var o = api.ListFiltersResponse();
buildCounterListFiltersResponse++;
if (buildCounterListFiltersResponse < 3) {
o.filter = buildUnnamed3188();
}
buildCounterListFiltersResponse--;
return o;
}
void checkListFiltersResponse(api.ListFiltersResponse o) {
buildCounterListFiltersResponse++;
if (buildCounterListFiltersResponse < 3) {
checkUnnamed3188(o.filter);
}
buildCounterListFiltersResponse--;
}
core.List<api.ForwardingAddress> buildUnnamed3189() {
var o = <api.ForwardingAddress>[];
o.add(buildForwardingAddress());
o.add(buildForwardingAddress());
return o;
}
void checkUnnamed3189(core.List<api.ForwardingAddress> o) {
unittest.expect(o, unittest.hasLength(2));
checkForwardingAddress(o[0]);
checkForwardingAddress(o[1]);
}
core.int buildCounterListForwardingAddressesResponse = 0;
api.ListForwardingAddressesResponse buildListForwardingAddressesResponse() {
var o = api.ListForwardingAddressesResponse();
buildCounterListForwardingAddressesResponse++;
if (buildCounterListForwardingAddressesResponse < 3) {
o.forwardingAddresses = buildUnnamed3189();
}
buildCounterListForwardingAddressesResponse--;
return o;
}
void checkListForwardingAddressesResponse(
api.ListForwardingAddressesResponse o) {
buildCounterListForwardingAddressesResponse++;
if (buildCounterListForwardingAddressesResponse < 3) {
checkUnnamed3189(o.forwardingAddresses);
}
buildCounterListForwardingAddressesResponse--;
}
core.List<api.History> buildUnnamed3190() {
var o = <api.History>[];
o.add(buildHistory());
o.add(buildHistory());
return o;
}
void checkUnnamed3190(core.List<api.History> o) {
unittest.expect(o, unittest.hasLength(2));
checkHistory(o[0]);
checkHistory(o[1]);
}
core.int buildCounterListHistoryResponse = 0;
api.ListHistoryResponse buildListHistoryResponse() {
var o = api.ListHistoryResponse();
buildCounterListHistoryResponse++;
if (buildCounterListHistoryResponse < 3) {
o.history = buildUnnamed3190();
o.historyId = 'foo';
o.nextPageToken = 'foo';
}
buildCounterListHistoryResponse--;
return o;
}
void checkListHistoryResponse(api.ListHistoryResponse o) {
buildCounterListHistoryResponse++;
if (buildCounterListHistoryResponse < 3) {
checkUnnamed3190(o.history);
unittest.expect(o.historyId, unittest.equals('foo'));
unittest.expect(o.nextPageToken, unittest.equals('foo'));
}
buildCounterListHistoryResponse--;
}
core.List<api.Label> buildUnnamed3191() {
var o = <api.Label>[];
o.add(buildLabel());
o.add(buildLabel());
return o;
}
void checkUnnamed3191(core.List<api.Label> o) {
unittest.expect(o, unittest.hasLength(2));
checkLabel(o[0]);
checkLabel(o[1]);
}
core.int buildCounterListLabelsResponse = 0;
api.ListLabelsResponse buildListLabelsResponse() {
var o = api.ListLabelsResponse();
buildCounterListLabelsResponse++;
if (buildCounterListLabelsResponse < 3) {
o.labels = buildUnnamed3191();
}
buildCounterListLabelsResponse--;
return o;
}
void checkListLabelsResponse(api.ListLabelsResponse o) {
buildCounterListLabelsResponse++;
if (buildCounterListLabelsResponse < 3) {
checkUnnamed3191(o.labels);
}
buildCounterListLabelsResponse--;
}
core.List<api.Message> buildUnnamed3192() {
var o = <api.Message>[];
o.add(buildMessage());
o.add(buildMessage());
return o;
}
void checkUnnamed3192(core.List<api.Message> o) {
unittest.expect(o, unittest.hasLength(2));
checkMessage(o[0]);
checkMessage(o[1]);
}
core.int buildCounterListMessagesResponse = 0;
api.ListMessagesResponse buildListMessagesResponse() {
var o = api.ListMessagesResponse();
buildCounterListMessagesResponse++;
if (buildCounterListMessagesResponse < 3) {
o.messages = buildUnnamed3192();
o.nextPageToken = 'foo';
o.resultSizeEstimate = 42;
}
buildCounterListMessagesResponse--;
return o;
}
void checkListMessagesResponse(api.ListMessagesResponse o) {
buildCounterListMessagesResponse++;
if (buildCounterListMessagesResponse < 3) {
checkUnnamed3192(o.messages);
unittest.expect(o.nextPageToken, unittest.equals('foo'));
unittest.expect(o.resultSizeEstimate, unittest.equals(42));
}
buildCounterListMessagesResponse--;
}
core.List<api.SendAs> buildUnnamed3193() {
var o = <api.SendAs>[];
o.add(buildSendAs());
o.add(buildSendAs());
return o;
}
void checkUnnamed3193(core.List<api.SendAs> o) {
unittest.expect(o, unittest.hasLength(2));
checkSendAs(o[0]);
checkSendAs(o[1]);
}
core.int buildCounterListSendAsResponse = 0;
api.ListSendAsResponse buildListSendAsResponse() {
var o = api.ListSendAsResponse();
buildCounterListSendAsResponse++;
if (buildCounterListSendAsResponse < 3) {
o.sendAs = buildUnnamed3193();
}
buildCounterListSendAsResponse--;
return o;
}
void checkListSendAsResponse(api.ListSendAsResponse o) {
buildCounterListSendAsResponse++;
if (buildCounterListSendAsResponse < 3) {
checkUnnamed3193(o.sendAs);
}
buildCounterListSendAsResponse--;
}
core.List<api.SmimeInfo> buildUnnamed3194() {
var o = <api.SmimeInfo>[];
o.add(buildSmimeInfo());
o.add(buildSmimeInfo());
return o;
}
void checkUnnamed3194(core.List<api.SmimeInfo> o) {
unittest.expect(o, unittest.hasLength(2));
checkSmimeInfo(o[0]);
checkSmimeInfo(o[1]);
}
core.int buildCounterListSmimeInfoResponse = 0;
api.ListSmimeInfoResponse buildListSmimeInfoResponse() {
var o = api.ListSmimeInfoResponse();
buildCounterListSmimeInfoResponse++;
if (buildCounterListSmimeInfoResponse < 3) {
o.smimeInfo = buildUnnamed3194();
}
buildCounterListSmimeInfoResponse--;
return o;
}
void checkListSmimeInfoResponse(api.ListSmimeInfoResponse o) {
buildCounterListSmimeInfoResponse++;
if (buildCounterListSmimeInfoResponse < 3) {
checkUnnamed3194(o.smimeInfo);
}
buildCounterListSmimeInfoResponse--;
}
core.List<api.Thread> buildUnnamed3195() {
var o = <api.Thread>[];
o.add(buildThread());
o.add(buildThread());
return o;
}
void checkUnnamed3195(core.List<api.Thread> o) {
unittest.expect(o, unittest.hasLength(2));
checkThread(o[0]);
checkThread(o[1]);
}
core.int buildCounterListThreadsResponse = 0;
api.ListThreadsResponse buildListThreadsResponse() {
var o = api.ListThreadsResponse();
buildCounterListThreadsResponse++;
if (buildCounterListThreadsResponse < 3) {
o.nextPageToken = 'foo';
o.resultSizeEstimate = 42;
o.threads = buildUnnamed3195();
}
buildCounterListThreadsResponse--;
return o;
}
void checkListThreadsResponse(api.ListThreadsResponse o) {
buildCounterListThreadsResponse++;
if (buildCounterListThreadsResponse < 3) {
unittest.expect(o.nextPageToken, unittest.equals('foo'));
unittest.expect(o.resultSizeEstimate, unittest.equals(42));
checkUnnamed3195(o.threads);
}
buildCounterListThreadsResponse--;
}
core.List<core.String> buildUnnamed3196() {
var o = <core.String>[];
o.add('foo');
o.add('foo');
return o;
}
void checkUnnamed3196(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'));
}
core.int buildCounterMessage = 0;
api.Message buildMessage() {
var o = api.Message();
buildCounterMessage++;
if (buildCounterMessage < 3) {
o.historyId = 'foo';
o.id = 'foo';
o.internalDate = 'foo';
o.labelIds = buildUnnamed3196();
o.payload = buildMessagePart();
o.raw = 'foo';
o.sizeEstimate = 42;
o.snippet = 'foo';
o.threadId = 'foo';
}
buildCounterMessage--;
return o;
}
void checkMessage(api.Message o) {
buildCounterMessage++;
if (buildCounterMessage < 3) {
unittest.expect(o.historyId, unittest.equals('foo'));
unittest.expect(o.id, unittest.equals('foo'));
unittest.expect(o.internalDate, unittest.equals('foo'));
checkUnnamed3196(o.labelIds);
checkMessagePart(o.payload);
unittest.expect(o.raw, unittest.equals('foo'));
unittest.expect(o.sizeEstimate, unittest.equals(42));
unittest.expect(o.snippet, unittest.equals('foo'));
unittest.expect(o.threadId, unittest.equals('foo'));
}
buildCounterMessage--;
}
core.List<api.MessagePartHeader> buildUnnamed3197() {
var o = <api.MessagePartHeader>[];
o.add(buildMessagePartHeader());
o.add(buildMessagePartHeader());
return o;
}
void checkUnnamed3197(core.List<api.MessagePartHeader> o) {
unittest.expect(o, unittest.hasLength(2));
checkMessagePartHeader(o[0]);
checkMessagePartHeader(o[1]);
}
core.List<api.MessagePart> buildUnnamed3198() {
var o = <api.MessagePart>[];
o.add(buildMessagePart());
o.add(buildMessagePart());
return o;
}
void checkUnnamed3198(core.List<api.MessagePart> o) {
unittest.expect(o, unittest.hasLength(2));
checkMessagePart(o[0]);
checkMessagePart(o[1]);
}
core.int buildCounterMessagePart = 0;
api.MessagePart buildMessagePart() {
var o = api.MessagePart();
buildCounterMessagePart++;
if (buildCounterMessagePart < 3) {
o.body = buildMessagePartBody();
o.filename = 'foo';
o.headers = buildUnnamed3197();
o.mimeType = 'foo';
o.partId = 'foo';
o.parts = buildUnnamed3198();
}
buildCounterMessagePart--;
return o;
}
void checkMessagePart(api.MessagePart o) {
buildCounterMessagePart++;
if (buildCounterMessagePart < 3) {
checkMessagePartBody(o.body);
unittest.expect(o.filename, unittest.equals('foo'));
checkUnnamed3197(o.headers);
unittest.expect(o.mimeType, unittest.equals('foo'));
unittest.expect(o.partId, unittest.equals('foo'));
checkUnnamed3198(o.parts);
}
buildCounterMessagePart--;
}
core.int buildCounterMessagePartBody = 0;
api.MessagePartBody buildMessagePartBody() {
var o = api.MessagePartBody();
buildCounterMessagePartBody++;
if (buildCounterMessagePartBody < 3) {
o.attachmentId = 'foo';
o.data = 'foo';
o.size = 42;
}
buildCounterMessagePartBody--;
return o;
}
void checkMessagePartBody(api.MessagePartBody o) {
buildCounterMessagePartBody++;
if (buildCounterMessagePartBody < 3) {
unittest.expect(o.attachmentId, unittest.equals('foo'));
unittest.expect(o.data, unittest.equals('foo'));
unittest.expect(o.size, unittest.equals(42));
}
buildCounterMessagePartBody--;
}
core.int buildCounterMessagePartHeader = 0;
api.MessagePartHeader buildMessagePartHeader() {
var o = api.MessagePartHeader();
buildCounterMessagePartHeader++;
if (buildCounterMessagePartHeader < 3) {
o.name = 'foo';
o.value = 'foo';
}
buildCounterMessagePartHeader--;
return o;
}
void checkMessagePartHeader(api.MessagePartHeader o) {
buildCounterMessagePartHeader++;
if (buildCounterMessagePartHeader < 3) {
unittest.expect(o.name, unittest.equals('foo'));
unittest.expect(o.value, unittest.equals('foo'));
}
buildCounterMessagePartHeader--;
}
core.List<core.String> buildUnnamed3199() {
var o = <core.String>[];
o.add('foo');
o.add('foo');
return o;
}
void checkUnnamed3199(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'));
}
core.List<core.String> buildUnnamed3200() {
var o = <core.String>[];
o.add('foo');
o.add('foo');
return o;
}
void checkUnnamed3200(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'));
}
core.int buildCounterModifyMessageRequest = 0;
api.ModifyMessageRequest buildModifyMessageRequest() {
var o = api.ModifyMessageRequest();
buildCounterModifyMessageRequest++;
if (buildCounterModifyMessageRequest < 3) {
o.addLabelIds = buildUnnamed3199();
o.removeLabelIds = buildUnnamed3200();
}
buildCounterModifyMessageRequest--;
return o;
}
void checkModifyMessageRequest(api.ModifyMessageRequest o) {
buildCounterModifyMessageRequest++;
if (buildCounterModifyMessageRequest < 3) {
checkUnnamed3199(o.addLabelIds);
checkUnnamed3200(o.removeLabelIds);
}
buildCounterModifyMessageRequest--;
}
core.List<core.String> buildUnnamed3201() {
var o = <core.String>[];
o.add('foo');
o.add('foo');
return o;
}
void checkUnnamed3201(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'));
}
core.List<core.String> buildUnnamed3202() {
var o = <core.String>[];
o.add('foo');
o.add('foo');
return o;
}
void checkUnnamed3202(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'));
}
core.int buildCounterModifyThreadRequest = 0;
api.ModifyThreadRequest buildModifyThreadRequest() {
var o = api.ModifyThreadRequest();
buildCounterModifyThreadRequest++;
if (buildCounterModifyThreadRequest < 3) {
o.addLabelIds = buildUnnamed3201();
o.removeLabelIds = buildUnnamed3202();
}
buildCounterModifyThreadRequest--;
return o;
}
void checkModifyThreadRequest(api.ModifyThreadRequest o) {
buildCounterModifyThreadRequest++;
if (buildCounterModifyThreadRequest < 3) {
checkUnnamed3201(o.addLabelIds);
checkUnnamed3202(o.removeLabelIds);
}
buildCounterModifyThreadRequest--;
}
core.int buildCounterPopSettings = 0;
api.PopSettings buildPopSettings() {
var o = api.PopSettings();
buildCounterPopSettings++;
if (buildCounterPopSettings < 3) {
o.accessWindow = 'foo';
o.disposition = 'foo';
}
buildCounterPopSettings--;
return o;
}
void checkPopSettings(api.PopSettings o) {
buildCounterPopSettings++;
if (buildCounterPopSettings < 3) {
unittest.expect(o.accessWindow, unittest.equals('foo'));
unittest.expect(o.disposition, unittest.equals('foo'));
}
buildCounterPopSettings--;
}
core.int buildCounterProfile = 0;
api.Profile buildProfile() {
var o = api.Profile();
buildCounterProfile++;
if (buildCounterProfile < 3) {
o.emailAddress = 'foo';
o.historyId = 'foo';
o.messagesTotal = 42;
o.threadsTotal = 42;
}
buildCounterProfile--;
return o;
}
void checkProfile(api.Profile o) {
buildCounterProfile++;
if (buildCounterProfile < 3) {
unittest.expect(o.emailAddress, unittest.equals('foo'));
unittest.expect(o.historyId, unittest.equals('foo'));
unittest.expect(o.messagesTotal, unittest.equals(42));
unittest.expect(o.threadsTotal, unittest.equals(42));
}
buildCounterProfile--;
}
core.int buildCounterSendAs = 0;
api.SendAs buildSendAs() {
var o = api.SendAs();
buildCounterSendAs++;
if (buildCounterSendAs < 3) {
o.displayName = 'foo';
o.isDefault = true;
o.isPrimary = true;
o.replyToAddress = 'foo';
o.sendAsEmail = 'foo';
o.signature = 'foo';
o.smtpMsa = buildSmtpMsa();
o.treatAsAlias = true;
o.verificationStatus = 'foo';
}
buildCounterSendAs--;
return o;
}
void checkSendAs(api.SendAs o) {
buildCounterSendAs++;
if (buildCounterSendAs < 3) {
unittest.expect(o.displayName, unittest.equals('foo'));
unittest.expect(o.isDefault, unittest.isTrue);
unittest.expect(o.isPrimary, unittest.isTrue);
unittest.expect(o.replyToAddress, unittest.equals('foo'));
unittest.expect(o.sendAsEmail, unittest.equals('foo'));
unittest.expect(o.signature, unittest.equals('foo'));
checkSmtpMsa(o.smtpMsa);
unittest.expect(o.treatAsAlias, unittest.isTrue);
unittest.expect(o.verificationStatus, unittest.equals('foo'));
}
buildCounterSendAs--;
}
core.int buildCounterSmimeInfo = 0;
api.SmimeInfo buildSmimeInfo() {
var o = api.SmimeInfo();
buildCounterSmimeInfo++;
if (buildCounterSmimeInfo < 3) {
o.encryptedKeyPassword = 'foo';
o.expiration = 'foo';
o.id = 'foo';
o.isDefault = true;
o.issuerCn = 'foo';
o.pem = 'foo';
o.pkcs12 = 'foo';
}
buildCounterSmimeInfo--;
return o;
}
void checkSmimeInfo(api.SmimeInfo o) {
buildCounterSmimeInfo++;
if (buildCounterSmimeInfo < 3) {
unittest.expect(o.encryptedKeyPassword, unittest.equals('foo'));
unittest.expect(o.expiration, unittest.equals('foo'));
unittest.expect(o.id, unittest.equals('foo'));
unittest.expect(o.isDefault, unittest.isTrue);
unittest.expect(o.issuerCn, unittest.equals('foo'));
unittest.expect(o.pem, unittest.equals('foo'));
unittest.expect(o.pkcs12, unittest.equals('foo'));
}
buildCounterSmimeInfo--;
}
core.int buildCounterSmtpMsa = 0;
api.SmtpMsa buildSmtpMsa() {
var o = api.SmtpMsa();
buildCounterSmtpMsa++;
if (buildCounterSmtpMsa < 3) {
o.host = 'foo';
o.password = 'foo';
o.port = 42;
o.securityMode = 'foo';
o.username = 'foo';
}
buildCounterSmtpMsa--;
return o;
}
void checkSmtpMsa(api.SmtpMsa o) {
buildCounterSmtpMsa++;
if (buildCounterSmtpMsa < 3) {
unittest.expect(o.host, unittest.equals('foo'));
unittest.expect(o.password, unittest.equals('foo'));
unittest.expect(o.port, unittest.equals(42));
unittest.expect(o.securityMode, unittest.equals('foo'));
unittest.expect(o.username, unittest.equals('foo'));
}
buildCounterSmtpMsa--;
}
core.List<api.Message> buildUnnamed3203() {
var o = <api.Message>[];
o.add(buildMessage());
o.add(buildMessage());
return o;
}
void checkUnnamed3203(core.List<api.Message> o) {
unittest.expect(o, unittest.hasLength(2));
checkMessage(o[0]);
checkMessage(o[1]);
}
core.int buildCounterThread = 0;
api.Thread buildThread() {
var o = api.Thread();
buildCounterThread++;
if (buildCounterThread < 3) {
o.historyId = 'foo';
o.id = 'foo';
o.messages = buildUnnamed3203();
o.snippet = 'foo';
}
buildCounterThread--;
return o;
}
void checkThread(api.Thread o) {
buildCounterThread++;
if (buildCounterThread < 3) {
unittest.expect(o.historyId, unittest.equals('foo'));
unittest.expect(o.id, unittest.equals('foo'));
checkUnnamed3203(o.messages);
unittest.expect(o.snippet, unittest.equals('foo'));
}
buildCounterThread--;
}
core.int buildCounterVacationSettings = 0;
api.VacationSettings buildVacationSettings() {
var o = api.VacationSettings();
buildCounterVacationSettings++;
if (buildCounterVacationSettings < 3) {
o.enableAutoReply = true;
o.endTime = 'foo';
o.responseBodyHtml = 'foo';
o.responseBodyPlainText = 'foo';
o.responseSubject = 'foo';
o.restrictToContacts = true;
o.restrictToDomain = true;
o.startTime = 'foo';
}
buildCounterVacationSettings--;
return o;
}
void checkVacationSettings(api.VacationSettings o) {
buildCounterVacationSettings++;
if (buildCounterVacationSettings < 3) {
unittest.expect(o.enableAutoReply, unittest.isTrue);
unittest.expect(o.endTime, unittest.equals('foo'));
unittest.expect(o.responseBodyHtml, unittest.equals('foo'));
unittest.expect(o.responseBodyPlainText, unittest.equals('foo'));
unittest.expect(o.responseSubject, unittest.equals('foo'));
unittest.expect(o.restrictToContacts, unittest.isTrue);
unittest.expect(o.restrictToDomain, unittest.isTrue);
unittest.expect(o.startTime, unittest.equals('foo'));
}
buildCounterVacationSettings--;
}
core.List<core.String> buildUnnamed3204() {
var o = <core.String>[];
o.add('foo');
o.add('foo');
return o;
}
void checkUnnamed3204(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'));
}
core.int buildCounterWatchRequest = 0;
api.WatchRequest buildWatchRequest() {
var o = api.WatchRequest();
buildCounterWatchRequest++;
if (buildCounterWatchRequest < 3) {
o.labelFilterAction = 'foo';
o.labelIds = buildUnnamed3204();
o.topicName = 'foo';
}
buildCounterWatchRequest--;
return o;
}
void checkWatchRequest(api.WatchRequest o) {
buildCounterWatchRequest++;
if (buildCounterWatchRequest < 3) {
unittest.expect(o.labelFilterAction, unittest.equals('foo'));
checkUnnamed3204(o.labelIds);
unittest.expect(o.topicName, unittest.equals('foo'));
}
buildCounterWatchRequest--;
}
core.int buildCounterWatchResponse = 0;
api.WatchResponse buildWatchResponse() {
var o = api.WatchResponse();
buildCounterWatchResponse++;
if (buildCounterWatchResponse < 3) {
o.expiration = 'foo';
o.historyId = 'foo';
}
buildCounterWatchResponse--;
return o;
}
void checkWatchResponse(api.WatchResponse o) {
buildCounterWatchResponse++;
if (buildCounterWatchResponse < 3) {
unittest.expect(o.expiration, unittest.equals('foo'));
unittest.expect(o.historyId, unittest.equals('foo'));
}
buildCounterWatchResponse--;
}
core.List<core.String> buildUnnamed3205() {
var o = <core.String>[];
o.add('foo');
o.add('foo');
return o;
}
void checkUnnamed3205(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'));
}
core.List<core.String> buildUnnamed3206() {
var o = <core.String>[];
o.add('foo');
o.add('foo');
return o;
}
void checkUnnamed3206(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'));
}
core.List<core.String> buildUnnamed3207() {
var o = <core.String>[];
o.add('foo');
o.add('foo');
return o;
}
void checkUnnamed3207(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'));
}
core.List<core.String> buildUnnamed3208() {
var o = <core.String>[];
o.add('foo');
o.add('foo');
return o;
}
void checkUnnamed3208(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'));
}
core.List<core.String> buildUnnamed3209() {
var o = <core.String>[];
o.add('foo');
o.add('foo');
return o;
}
void checkUnnamed3209(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'));
}
void main() {
unittest.group('obj-schema-AutoForwarding', () {
unittest.test('to-json--from-json', () {
var o = buildAutoForwarding();
var od = api.AutoForwarding.fromJson(o.toJson());
checkAutoForwarding(od);
});
});
unittest.group('obj-schema-BatchDeleteMessagesRequest', () {
unittest.test('to-json--from-json', () {
var o = buildBatchDeleteMessagesRequest();
var od = api.BatchDeleteMessagesRequest.fromJson(o.toJson());
checkBatchDeleteMessagesRequest(od);
});
});
unittest.group('obj-schema-BatchModifyMessagesRequest', () {
unittest.test('to-json--from-json', () {
var o = buildBatchModifyMessagesRequest();
var od = api.BatchModifyMessagesRequest.fromJson(o.toJson());
checkBatchModifyMessagesRequest(od);
});
});
unittest.group('obj-schema-Delegate', () {
unittest.test('to-json--from-json', () {
var o = buildDelegate();
var od = api.Delegate.fromJson(o.toJson());
checkDelegate(od);
});
});
unittest.group('obj-schema-Draft', () {
unittest.test('to-json--from-json', () {
var o = buildDraft();
var od = api.Draft.fromJson(o.toJson());
checkDraft(od);
});
});
unittest.group('obj-schema-Filter', () {
unittest.test('to-json--from-json', () {
var o = buildFilter();
var od = api.Filter.fromJson(o.toJson());
checkFilter(od);
});
});
unittest.group('obj-schema-FilterAction', () {
unittest.test('to-json--from-json', () {
var o = buildFilterAction();
var od = api.FilterAction.fromJson(o.toJson());
checkFilterAction(od);
});
});
unittest.group('obj-schema-FilterCriteria', () {
unittest.test('to-json--from-json', () {
var o = buildFilterCriteria();
var od = api.FilterCriteria.fromJson(o.toJson());
checkFilterCriteria(od);
});
});
unittest.group('obj-schema-ForwardingAddress', () {
unittest.test('to-json--from-json', () {
var o = buildForwardingAddress();
var od = api.ForwardingAddress.fromJson(o.toJson());
checkForwardingAddress(od);
});
});
unittest.group('obj-schema-History', () {
unittest.test('to-json--from-json', () {
var o = buildHistory();
var od = api.History.fromJson(o.toJson());
checkHistory(od);
});
});
unittest.group('obj-schema-HistoryLabelAdded', () {
unittest.test('to-json--from-json', () {
var o = buildHistoryLabelAdded();
var od = api.HistoryLabelAdded.fromJson(o.toJson());
checkHistoryLabelAdded(od);
});
});
unittest.group('obj-schema-HistoryLabelRemoved', () {
unittest.test('to-json--from-json', () {
var o = buildHistoryLabelRemoved();
var od = api.HistoryLabelRemoved.fromJson(o.toJson());
checkHistoryLabelRemoved(od);
});
});
unittest.group('obj-schema-HistoryMessageAdded', () {
unittest.test('to-json--from-json', () {
var o = buildHistoryMessageAdded();
var od = api.HistoryMessageAdded.fromJson(o.toJson());
checkHistoryMessageAdded(od);
});
});
unittest.group('obj-schema-HistoryMessageDeleted', () {
unittest.test('to-json--from-json', () {
var o = buildHistoryMessageDeleted();
var od = api.HistoryMessageDeleted.fromJson(o.toJson());
checkHistoryMessageDeleted(od);
});
});
unittest.group('obj-schema-ImapSettings', () {
unittest.test('to-json--from-json', () {
var o = buildImapSettings();
var od = api.ImapSettings.fromJson(o.toJson());
checkImapSettings(od);
});
});
unittest.group('obj-schema-Label', () {
unittest.test('to-json--from-json', () {
var o = buildLabel();
var od = api.Label.fromJson(o.toJson());
checkLabel(od);
});
});
unittest.group('obj-schema-LabelColor', () {
unittest.test('to-json--from-json', () {
var o = buildLabelColor();
var od = api.LabelColor.fromJson(o.toJson());
checkLabelColor(od);
});
});
unittest.group('obj-schema-LanguageSettings', () {
unittest.test('to-json--from-json', () {
var o = buildLanguageSettings();
var od = api.LanguageSettings.fromJson(o.toJson());
checkLanguageSettings(od);
});
});
unittest.group('obj-schema-ListDelegatesResponse', () {
unittest.test('to-json--from-json', () {
var o = buildListDelegatesResponse();
var od = api.ListDelegatesResponse.fromJson(o.toJson());
checkListDelegatesResponse(od);
});
});
unittest.group('obj-schema-ListDraftsResponse', () {
unittest.test('to-json--from-json', () {
var o = buildListDraftsResponse();
var od = api.ListDraftsResponse.fromJson(o.toJson());
checkListDraftsResponse(od);
});
});
unittest.group('obj-schema-ListFiltersResponse', () {
unittest.test('to-json--from-json', () {
var o = buildListFiltersResponse();
var od = api.ListFiltersResponse.fromJson(o.toJson());
checkListFiltersResponse(od);
});
});
unittest.group('obj-schema-ListForwardingAddressesResponse', () {
unittest.test('to-json--from-json', () {
var o = buildListForwardingAddressesResponse();
var od = api.ListForwardingAddressesResponse.fromJson(o.toJson());
checkListForwardingAddressesResponse(od);
});
});
unittest.group('obj-schema-ListHistoryResponse', () {
unittest.test('to-json--from-json', () {
var o = buildListHistoryResponse();
var od = api.ListHistoryResponse.fromJson(o.toJson());
checkListHistoryResponse(od);
});
});
unittest.group('obj-schema-ListLabelsResponse', () {
unittest.test('to-json--from-json', () {
var o = buildListLabelsResponse();
var od = api.ListLabelsResponse.fromJson(o.toJson());
checkListLabelsResponse(od);
});
});
unittest.group('obj-schema-ListMessagesResponse', () {
unittest.test('to-json--from-json', () {
var o = buildListMessagesResponse();
var od = api.ListMessagesResponse.fromJson(o.toJson());
checkListMessagesResponse(od);
});
});
unittest.group('obj-schema-ListSendAsResponse', () {
unittest.test('to-json--from-json', () {
var o = buildListSendAsResponse();
var od = api.ListSendAsResponse.fromJson(o.toJson());
checkListSendAsResponse(od);
});
});
unittest.group('obj-schema-ListSmimeInfoResponse', () {
unittest.test('to-json--from-json', () {
var o = buildListSmimeInfoResponse();
var od = api.ListSmimeInfoResponse.fromJson(o.toJson());
checkListSmimeInfoResponse(od);
});
});
unittest.group('obj-schema-ListThreadsResponse', () {
unittest.test('to-json--from-json', () {
var o = buildListThreadsResponse();
var od = api.ListThreadsResponse.fromJson(o.toJson());
checkListThreadsResponse(od);
});
});
unittest.group('obj-schema-Message', () {
unittest.test('to-json--from-json', () {
var o = buildMessage();
var od = api.Message.fromJson(o.toJson());
checkMessage(od);
});
});
unittest.group('obj-schema-MessagePart', () {
unittest.test('to-json--from-json', () {
var o = buildMessagePart();
var od = api.MessagePart.fromJson(o.toJson());
checkMessagePart(od);
});
});
unittest.group('obj-schema-MessagePartBody', () {
unittest.test('to-json--from-json', () {
var o = buildMessagePartBody();
var od = api.MessagePartBody.fromJson(o.toJson());
checkMessagePartBody(od);
});
});
unittest.group('obj-schema-MessagePartHeader', () {
unittest.test('to-json--from-json', () {
var o = buildMessagePartHeader();
var od = api.MessagePartHeader.fromJson(o.toJson());
checkMessagePartHeader(od);
});
});
unittest.group('obj-schema-ModifyMessageRequest', () {
unittest.test('to-json--from-json', () {
var o = buildModifyMessageRequest();
var od = api.ModifyMessageRequest.fromJson(o.toJson());
checkModifyMessageRequest(od);
});
});
unittest.group('obj-schema-ModifyThreadRequest', () {
unittest.test('to-json--from-json', () {
var o = buildModifyThreadRequest();
var od = api.ModifyThreadRequest.fromJson(o.toJson());
checkModifyThreadRequest(od);
});
});
unittest.group('obj-schema-PopSettings', () {
unittest.test('to-json--from-json', () {
var o = buildPopSettings();
var od = api.PopSettings.fromJson(o.toJson());
checkPopSettings(od);
});
});
unittest.group('obj-schema-Profile', () {
unittest.test('to-json--from-json', () {
var o = buildProfile();
var od = api.Profile.fromJson(o.toJson());
checkProfile(od);
});
});
unittest.group('obj-schema-SendAs', () {
unittest.test('to-json--from-json', () {
var o = buildSendAs();
var od = api.SendAs.fromJson(o.toJson());
checkSendAs(od);
});
});
unittest.group('obj-schema-SmimeInfo', () {
unittest.test('to-json--from-json', () {
var o = buildSmimeInfo();
var od = api.SmimeInfo.fromJson(o.toJson());
checkSmimeInfo(od);
});
});
unittest.group('obj-schema-SmtpMsa', () {
unittest.test('to-json--from-json', () {
var o = buildSmtpMsa();
var od = api.SmtpMsa.fromJson(o.toJson());
checkSmtpMsa(od);
});
});
unittest.group('obj-schema-Thread', () {
unittest.test('to-json--from-json', () {
var o = buildThread();
var od = api.Thread.fromJson(o.toJson());
checkThread(od);
});
});
unittest.group('obj-schema-VacationSettings', () {
unittest.test('to-json--from-json', () {
var o = buildVacationSettings();
var od = api.VacationSettings.fromJson(o.toJson());
checkVacationSettings(od);
});
});
unittest.group('obj-schema-WatchRequest', () {
unittest.test('to-json--from-json', () {
var o = buildWatchRequest();
var od = api.WatchRequest.fromJson(o.toJson());
checkWatchRequest(od);
});
});
unittest.group('obj-schema-WatchResponse', () {
unittest.test('to-json--from-json', () {
var o = buildWatchResponse();
var od = api.WatchResponse.fromJson(o.toJson());
checkWatchResponse(od);
});
});
unittest.group('resource-UsersResourceApi', () {
unittest.test('method--getProfile', () {
var mock = HttpServerMock();
api.UsersResourceApi res = api.GmailApi(mock).users;
var arg_userId = 'foo';
var arg_$fields = 'foo';
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var path = (req.url).path;
var pathOffset = 0;
core.int index;
core.String subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(path.substring(pathOffset, pathOffset + 15),
unittest.equals("gmail/v1/users/"));
pathOffset += 15;
index = path.indexOf('/profile', pathOffset);
unittest.expect(index >= 0, unittest.isTrue);
subPart =
core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
pathOffset = index;
unittest.expect(subPart, unittest.equals('$arg_userId'));
unittest.expect(path.substring(pathOffset, pathOffset + 8),
unittest.equals("/profile"));
pathOffset += 8;
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
if (query.isNotEmpty) {
for (var part in query.split('&')) {
var keyValue = part.split('=');
addQueryParam(
core.Uri.decodeQueryComponent(keyValue[0]),
core.Uri.decodeQueryComponent(keyValue[1]),
);
}
}
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
'content-type': 'application/json; charset=utf-8',
};
var resp = convert.json.encode(buildProfile());
return async.Future.value(stringResponse(200, h, resp));
}), true);
res
.getProfile(arg_userId, $fields: arg_$fields)
.then(unittest.expectAsync1(((response) {
checkProfile(response);
})));
});
unittest.test('method--stop', () {
var mock = HttpServerMock();
api.UsersResourceApi res = api.GmailApi(mock).users;
var arg_userId = 'foo';
var arg_$fields = 'foo';
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var path = (req.url).path;
var pathOffset = 0;
core.int index;
core.String subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(path.substring(pathOffset, pathOffset + 15),
unittest.equals("gmail/v1/users/"));
pathOffset += 15;
index = path.indexOf('/stop', pathOffset);
unittest.expect(index >= 0, unittest.isTrue);
subPart =
core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
pathOffset = index;
unittest.expect(subPart, unittest.equals('$arg_userId'));
unittest.expect(path.substring(pathOffset, pathOffset + 5),
unittest.equals("/stop"));
pathOffset += 5;
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
if (query.isNotEmpty) {
for (var part in query.split('&')) {
var keyValue = part.split('=');
addQueryParam(
core.Uri.decodeQueryComponent(keyValue[0]),
core.Uri.decodeQueryComponent(keyValue[1]),
);
}
}
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
'content-type': 'application/json; charset=utf-8',
};
var resp = '';
return async.Future.value(stringResponse(200, h, resp));
}), true);
res
.stop(arg_userId, $fields: arg_$fields)
.then(unittest.expectAsync1((_) {}));
});
unittest.test('method--watch', () {
var mock = HttpServerMock();
api.UsersResourceApi res = api.GmailApi(mock).users;
var arg_request = buildWatchRequest();
var arg_userId = 'foo';
var arg_$fields = 'foo';
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var obj = api.WatchRequest.fromJson(json);
checkWatchRequest(obj);
var path = (req.url).path;
var pathOffset = 0;
core.int index;
core.String subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(path.substring(pathOffset, pathOffset + 15),
unittest.equals("gmail/v1/users/"));
pathOffset += 15;
index = path.indexOf('/watch', pathOffset);
unittest.expect(index >= 0, unittest.isTrue);
subPart =
core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
pathOffset = index;
unittest.expect(subPart, unittest.equals('$arg_userId'));
unittest.expect(path.substring(pathOffset, pathOffset + 6),
unittest.equals("/watch"));
pathOffset += 6;
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
if (query.isNotEmpty) {
for (var part in query.split('&')) {
var keyValue = part.split('=');
addQueryParam(
core.Uri.decodeQueryComponent(keyValue[0]),
core.Uri.decodeQueryComponent(keyValue[1]),
);
}
}
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
'content-type': 'application/json; charset=utf-8',
};
var resp = convert.json.encode(buildWatchResponse());
return async.Future.value(stringResponse(200, h, resp));
}), true);
res
.watch(arg_request, arg_userId, $fields: arg_$fields)
.then(unittest.expectAsync1(((response) {
checkWatchResponse(response);
})));
});
});
unittest.group('resource-UsersDraftsResourceApi', () {
unittest.test('method--create', () {
// TODO: Implement tests for media upload;
// TODO: Implement tests for media download;
var mock = HttpServerMock();
api.UsersDraftsResourceApi res = api.GmailApi(mock).users.drafts;
var arg_request = buildDraft();
var arg_userId = 'foo';
var arg_$fields = 'foo';
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var obj = api.Draft.fromJson(json);
checkDraft(obj);
var path = (req.url).path;
var pathOffset = 0;
core.int index;
core.String subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(path.substring(pathOffset, pathOffset + 15),
unittest.equals("gmail/v1/users/"));
pathOffset += 15;
index = path.indexOf('/drafts', pathOffset);
unittest.expect(index >= 0, unittest.isTrue);
subPart =
core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
pathOffset = index;
unittest.expect(subPart, unittest.equals('$arg_userId'));
unittest.expect(path.substring(pathOffset, pathOffset + 7),
unittest.equals("/drafts"));
pathOffset += 7;
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
if (query.isNotEmpty) {
for (var part in query.split('&')) {
var keyValue = part.split('=');
addQueryParam(
core.Uri.decodeQueryComponent(keyValue[0]),
core.Uri.decodeQueryComponent(keyValue[1]),
);
}
}
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
'content-type': 'application/json; charset=utf-8',
};
var resp = convert.json.encode(buildDraft());
return async.Future.value(stringResponse(200, h, resp));
}), true);
res
.create(arg_request, arg_userId, $fields: arg_$fields)
.then(unittest.expectAsync1(((response) {
checkDraft(response);
})));
});
unittest.test('method--delete', () {
var mock = HttpServerMock();
api.UsersDraftsResourceApi res = api.GmailApi(mock).users.drafts;
var arg_userId = 'foo';
var arg_id = 'foo';
var arg_$fields = 'foo';
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var path = (req.url).path;
var pathOffset = 0;
core.int index;
core.String subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(path.substring(pathOffset, pathOffset + 15),
unittest.equals("gmail/v1/users/"));
pathOffset += 15;
index = path.indexOf('/drafts/', pathOffset);
unittest.expect(index >= 0, unittest.isTrue);
subPart =
core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
pathOffset = index;
unittest.expect(subPart, unittest.equals('$arg_userId'));
unittest.expect(path.substring(pathOffset, pathOffset + 8),
unittest.equals("/drafts/"));
pathOffset += 8;
subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset));
pathOffset = path.length;
unittest.expect(subPart, unittest.equals('$arg_id'));
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
if (query.isNotEmpty) {
for (var part in query.split('&')) {
var keyValue = part.split('=');
addQueryParam(
core.Uri.decodeQueryComponent(keyValue[0]),
core.Uri.decodeQueryComponent(keyValue[1]),
);
}
}
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
'content-type': 'application/json; charset=utf-8',
};
var resp = '';
return async.Future.value(stringResponse(200, h, resp));
}), true);
res
.delete(arg_userId, arg_id, $fields: arg_$fields)
.then(unittest.expectAsync1((_) {}));
});
unittest.test('method--get', () {
var mock = HttpServerMock();
api.UsersDraftsResourceApi res = api.GmailApi(mock).users.drafts;
var arg_userId = 'foo';
var arg_id = 'foo';
var arg_format = 'foo';
var arg_$fields = 'foo';
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var path = (req.url).path;
var pathOffset = 0;
core.int index;
core.String subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(path.substring(pathOffset, pathOffset + 15),
unittest.equals("gmail/v1/users/"));
pathOffset += 15;
index = path.indexOf('/drafts/', pathOffset);
unittest.expect(index >= 0, unittest.isTrue);
subPart =
core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
pathOffset = index;
unittest.expect(subPart, unittest.equals('$arg_userId'));
unittest.expect(path.substring(pathOffset, pathOffset + 8),
unittest.equals("/drafts/"));
pathOffset += 8;
subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset));
pathOffset = path.length;
unittest.expect(subPart, unittest.equals('$arg_id'));
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
if (query.isNotEmpty) {
for (var part in query.split('&')) {
var keyValue = part.split('=');
addQueryParam(
core.Uri.decodeQueryComponent(keyValue[0]),
core.Uri.decodeQueryComponent(keyValue[1]),
);
}
}
unittest.expect(queryMap["format"].first, unittest.equals(arg_format));
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
'content-type': 'application/json; charset=utf-8',
};
var resp = convert.json.encode(buildDraft());
return async.Future.value(stringResponse(200, h, resp));
}), true);
res
.get(arg_userId, arg_id, format: arg_format, $fields: arg_$fields)
.then(unittest.expectAsync1(((response) {
checkDraft(response);
})));
});
unittest.test('method--list', () {
var mock = HttpServerMock();
api.UsersDraftsResourceApi res = api.GmailApi(mock).users.drafts;
var arg_userId = 'foo';
var arg_includeSpamTrash = true;
var arg_maxResults = 42;
var arg_pageToken = 'foo';
var arg_q = 'foo';
var arg_$fields = 'foo';
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var path = (req.url).path;
var pathOffset = 0;
core.int index;
core.String subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(path.substring(pathOffset, pathOffset + 15),
unittest.equals("gmail/v1/users/"));
pathOffset += 15;
index = path.indexOf('/drafts', pathOffset);
unittest.expect(index >= 0, unittest.isTrue);
subPart =
core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
pathOffset = index;
unittest.expect(subPart, unittest.equals('$arg_userId'));
unittest.expect(path.substring(pathOffset, pathOffset + 7),
unittest.equals("/drafts"));
pathOffset += 7;
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
if (query.isNotEmpty) {
for (var part in query.split('&')) {
var keyValue = part.split('=');
addQueryParam(
core.Uri.decodeQueryComponent(keyValue[0]),
core.Uri.decodeQueryComponent(keyValue[1]),
);
}
}
unittest.expect(queryMap["includeSpamTrash"].first,
unittest.equals("$arg_includeSpamTrash"));
unittest.expect(core.int.parse(queryMap["maxResults"].first),
unittest.equals(arg_maxResults));
unittest.expect(
queryMap["pageToken"].first, unittest.equals(arg_pageToken));
unittest.expect(queryMap["q"].first, unittest.equals(arg_q));
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
'content-type': 'application/json; charset=utf-8',
};
var resp = convert.json.encode(buildListDraftsResponse());
return async.Future.value(stringResponse(200, h, resp));
}), true);
res
.list(arg_userId,
includeSpamTrash: arg_includeSpamTrash,
maxResults: arg_maxResults,
pageToken: arg_pageToken,
q: arg_q,
$fields: arg_$fields)
.then(unittest.expectAsync1(((response) {
checkListDraftsResponse(response);
})));
});
unittest.test('method--send', () {
// TODO: Implement tests for media upload;
// TODO: Implement tests for media download;
var mock = HttpServerMock();
api.UsersDraftsResourceApi res = api.GmailApi(mock).users.drafts;
var arg_request = buildDraft();
var arg_userId = 'foo';
var arg_$fields = 'foo';
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var obj = api.Draft.fromJson(json);
checkDraft(obj);
var path = (req.url).path;
var pathOffset = 0;
core.int index;
core.String subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(path.substring(pathOffset, pathOffset + 15),
unittest.equals("gmail/v1/users/"));
pathOffset += 15;
index = path.indexOf('/drafts/send', pathOffset);
unittest.expect(index >= 0, unittest.isTrue);
subPart =
core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
pathOffset = index;
unittest.expect(subPart, unittest.equals('$arg_userId'));
unittest.expect(path.substring(pathOffset, pathOffset + 12),
unittest.equals("/drafts/send"));
pathOffset += 12;
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
if (query.isNotEmpty) {
for (var part in query.split('&')) {
var keyValue = part.split('=');
addQueryParam(
core.Uri.decodeQueryComponent(keyValue[0]),
core.Uri.decodeQueryComponent(keyValue[1]),
);
}
}
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
'content-type': 'application/json; charset=utf-8',
};
var resp = convert.json.encode(buildMessage());
return async.Future.value(stringResponse(200, h, resp));
}), true);
res
.send(arg_request, arg_userId, $fields: arg_$fields)
.then(unittest.expectAsync1(((response) {
checkMessage(response);
})));
});
unittest.test('method--update', () {
// TODO: Implement tests for media upload;
// TODO: Implement tests for media download;
var mock = HttpServerMock();
api.UsersDraftsResourceApi res = api.GmailApi(mock).users.drafts;
var arg_request = buildDraft();
var arg_userId = 'foo';
var arg_id = 'foo';
var arg_$fields = 'foo';
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var obj = api.Draft.fromJson(json);
checkDraft(obj);
var path = (req.url).path;
var pathOffset = 0;
core.int index;
core.String subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(path.substring(pathOffset, pathOffset + 15),
unittest.equals("gmail/v1/users/"));
pathOffset += 15;
index = path.indexOf('/drafts/', pathOffset);
unittest.expect(index >= 0, unittest.isTrue);
subPart =
core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
pathOffset = index;
unittest.expect(subPart, unittest.equals('$arg_userId'));
unittest.expect(path.substring(pathOffset, pathOffset + 8),
unittest.equals("/drafts/"));
pathOffset += 8;
subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset));
pathOffset = path.length;
unittest.expect(subPart, unittest.equals('$arg_id'));
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
if (query.isNotEmpty) {
for (var part in query.split('&')) {
var keyValue = part.split('=');
addQueryParam(
core.Uri.decodeQueryComponent(keyValue[0]),
core.Uri.decodeQueryComponent(keyValue[1]),
);
}
}
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
'content-type': 'application/json; charset=utf-8',
};
var resp = convert.json.encode(buildDraft());
return async.Future.value(stringResponse(200, h, resp));
}), true);
res
.update(arg_request, arg_userId, arg_id, $fields: arg_$fields)
.then(unittest.expectAsync1(((response) {
checkDraft(response);
})));
});
});
unittest.group('resource-UsersHistoryResourceApi', () {
unittest.test('method--list', () {
var mock = HttpServerMock();
api.UsersHistoryResourceApi res = api.GmailApi(mock).users.history;
var arg_userId = 'foo';
var arg_historyTypes = buildUnnamed3205();
var arg_labelId = 'foo';
var arg_maxResults = 42;
var arg_pageToken = 'foo';
var arg_startHistoryId = 'foo';
var arg_$fields = 'foo';
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var path = (req.url).path;
var pathOffset = 0;
core.int index;
core.String subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(path.substring(pathOffset, pathOffset + 15),
unittest.equals("gmail/v1/users/"));
pathOffset += 15;
index = path.indexOf('/history', pathOffset);
unittest.expect(index >= 0, unittest.isTrue);
subPart =
core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
pathOffset = index;
unittest.expect(subPart, unittest.equals('$arg_userId'));
unittest.expect(path.substring(pathOffset, pathOffset + 8),
unittest.equals("/history"));
pathOffset += 8;
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
if (query.isNotEmpty) {
for (var part in query.split('&')) {
var keyValue = part.split('=');
addQueryParam(
core.Uri.decodeQueryComponent(keyValue[0]),
core.Uri.decodeQueryComponent(keyValue[1]),
);
}
}
unittest.expect(
queryMap["historyTypes"], unittest.equals(arg_historyTypes));
unittest.expect(
queryMap["labelId"].first, unittest.equals(arg_labelId));
unittest.expect(core.int.parse(queryMap["maxResults"].first),
unittest.equals(arg_maxResults));
unittest.expect(
queryMap["pageToken"].first, unittest.equals(arg_pageToken));
unittest.expect(queryMap["startHistoryId"].first,
unittest.equals(arg_startHistoryId));
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
'content-type': 'application/json; charset=utf-8',
};
var resp = convert.json.encode(buildListHistoryResponse());
return async.Future.value(stringResponse(200, h, resp));
}), true);
res
.list(arg_userId,
historyTypes: arg_historyTypes,
labelId: arg_labelId,
maxResults: arg_maxResults,
pageToken: arg_pageToken,
startHistoryId: arg_startHistoryId,
$fields: arg_$fields)
.then(unittest.expectAsync1(((response) {
checkListHistoryResponse(response);
})));
});
});
unittest.group('resource-UsersLabelsResourceApi', () {
unittest.test('method--create', () {
var mock = HttpServerMock();
api.UsersLabelsResourceApi res = api.GmailApi(mock).users.labels;
var arg_request = buildLabel();
var arg_userId = 'foo';
var arg_$fields = 'foo';
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var obj = api.Label.fromJson(json);
checkLabel(obj);
var path = (req.url).path;
var pathOffset = 0;
core.int index;
core.String subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(path.substring(pathOffset, pathOffset + 15),
unittest.equals("gmail/v1/users/"));
pathOffset += 15;
index = path.indexOf('/labels', pathOffset);
unittest.expect(index >= 0, unittest.isTrue);
subPart =
core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
pathOffset = index;
unittest.expect(subPart, unittest.equals('$arg_userId'));
unittest.expect(path.substring(pathOffset, pathOffset + 7),
unittest.equals("/labels"));
pathOffset += 7;
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
if (query.isNotEmpty) {
for (var part in query.split('&')) {
var keyValue = part.split('=');
addQueryParam(
core.Uri.decodeQueryComponent(keyValue[0]),
core.Uri.decodeQueryComponent(keyValue[1]),
);
}
}
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
'content-type': 'application/json; charset=utf-8',
};
var resp = convert.json.encode(buildLabel());
return async.Future.value(stringResponse(200, h, resp));
}), true);
res
.create(arg_request, arg_userId, $fields: arg_$fields)
.then(unittest.expectAsync1(((response) {
checkLabel(response);
})));
});
unittest.test('method--delete', () {
var mock = HttpServerMock();
api.UsersLabelsResourceApi res = api.GmailApi(mock).users.labels;
var arg_userId = 'foo';
var arg_id = 'foo';
var arg_$fields = 'foo';
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var path = (req.url).path;
var pathOffset = 0;
core.int index;
core.String subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(path.substring(pathOffset, pathOffset + 15),
unittest.equals("gmail/v1/users/"));
pathOffset += 15;
index = path.indexOf('/labels/', pathOffset);
unittest.expect(index >= 0, unittest.isTrue);
subPart =
core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
pathOffset = index;
unittest.expect(subPart, unittest.equals('$arg_userId'));
unittest.expect(path.substring(pathOffset, pathOffset + 8),
unittest.equals("/labels/"));
pathOffset += 8;
subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset));
pathOffset = path.length;
unittest.expect(subPart, unittest.equals('$arg_id'));
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
if (query.isNotEmpty) {
for (var part in query.split('&')) {
var keyValue = part.split('=');
addQueryParam(
core.Uri.decodeQueryComponent(keyValue[0]),
core.Uri.decodeQueryComponent(keyValue[1]),
);
}
}
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
'content-type': 'application/json; charset=utf-8',
};
var resp = '';
return async.Future.value(stringResponse(200, h, resp));
}), true);
res
.delete(arg_userId, arg_id, $fields: arg_$fields)
.then(unittest.expectAsync1((_) {}));
});
unittest.test('method--get', () {
var mock = HttpServerMock();
api.UsersLabelsResourceApi res = api.GmailApi(mock).users.labels;
var arg_userId = 'foo';
var arg_id = 'foo';
var arg_$fields = 'foo';
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var path = (req.url).path;
var pathOffset = 0;
core.int index;
core.String subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(path.substring(pathOffset, pathOffset + 15),
unittest.equals("gmail/v1/users/"));
pathOffset += 15;
index = path.indexOf('/labels/', pathOffset);
unittest.expect(index >= 0, unittest.isTrue);
subPart =
core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
pathOffset = index;
unittest.expect(subPart, unittest.equals('$arg_userId'));
unittest.expect(path.substring(pathOffset, pathOffset + 8),
unittest.equals("/labels/"));
pathOffset += 8;
subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset));
pathOffset = path.length;
unittest.expect(subPart, unittest.equals('$arg_id'));
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
if (query.isNotEmpty) {
for (var part in query.split('&')) {
var keyValue = part.split('=');
addQueryParam(
core.Uri.decodeQueryComponent(keyValue[0]),
core.Uri.decodeQueryComponent(keyValue[1]),
);
}
}
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
'content-type': 'application/json; charset=utf-8',
};
var resp = convert.json.encode(buildLabel());
return async.Future.value(stringResponse(200, h, resp));
}), true);
res
.get(arg_userId, arg_id, $fields: arg_$fields)
.then(unittest.expectAsync1(((response) {
checkLabel(response);
})));
});
unittest.test('method--list', () {
var mock = HttpServerMock();
api.UsersLabelsResourceApi res = api.GmailApi(mock).users.labels;
var arg_userId = 'foo';
var arg_$fields = 'foo';
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var path = (req.url).path;
var pathOffset = 0;
core.int index;
core.String subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(path.substring(pathOffset, pathOffset + 15),
unittest.equals("gmail/v1/users/"));
pathOffset += 15;
index = path.indexOf('/labels', pathOffset);
unittest.expect(index >= 0, unittest.isTrue);
subPart =
core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
pathOffset = index;
unittest.expect(subPart, unittest.equals('$arg_userId'));
unittest.expect(path.substring(pathOffset, pathOffset + 7),
unittest.equals("/labels"));
pathOffset += 7;
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
if (query.isNotEmpty) {
for (var part in query.split('&')) {
var keyValue = part.split('=');
addQueryParam(
core.Uri.decodeQueryComponent(keyValue[0]),
core.Uri.decodeQueryComponent(keyValue[1]),
);
}
}
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
'content-type': 'application/json; charset=utf-8',
};
var resp = convert.json.encode(buildListLabelsResponse());
return async.Future.value(stringResponse(200, h, resp));
}), true);
res
.list(arg_userId, $fields: arg_$fields)
.then(unittest.expectAsync1(((response) {
checkListLabelsResponse(response);
})));
});
unittest.test('method--patch', () {
var mock = HttpServerMock();
api.UsersLabelsResourceApi res = api.GmailApi(mock).users.labels;
var arg_request = buildLabel();
var arg_userId = 'foo';
var arg_id = 'foo';
var arg_$fields = 'foo';
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var obj = api.Label.fromJson(json);
checkLabel(obj);
var path = (req.url).path;
var pathOffset = 0;
core.int index;
core.String subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(path.substring(pathOffset, pathOffset + 15),
unittest.equals("gmail/v1/users/"));
pathOffset += 15;
index = path.indexOf('/labels/', pathOffset);
unittest.expect(index >= 0, unittest.isTrue);
subPart =
core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
pathOffset = index;
unittest.expect(subPart, unittest.equals('$arg_userId'));
unittest.expect(path.substring(pathOffset, pathOffset + 8),
unittest.equals("/labels/"));
pathOffset += 8;
subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset));
pathOffset = path.length;
unittest.expect(subPart, unittest.equals('$arg_id'));
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
if (query.isNotEmpty) {
for (var part in query.split('&')) {
var keyValue = part.split('=');
addQueryParam(
core.Uri.decodeQueryComponent(keyValue[0]),
core.Uri.decodeQueryComponent(keyValue[1]),
);
}
}
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
'content-type': 'application/json; charset=utf-8',
};
var resp = convert.json.encode(buildLabel());
return async.Future.value(stringResponse(200, h, resp));
}), true);
res
.patch(arg_request, arg_userId, arg_id, $fields: arg_$fields)
.then(unittest.expectAsync1(((response) {
checkLabel(response);
})));
});
unittest.test('method--update', () {
var mock = HttpServerMock();
api.UsersLabelsResourceApi res = api.GmailApi(mock).users.labels;
var arg_request = buildLabel();
var arg_userId = 'foo';
var arg_id = 'foo';
var arg_$fields = 'foo';
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var obj = api.Label.fromJson(json);
checkLabel(obj);
var path = (req.url).path;
var pathOffset = 0;
core.int index;
core.String subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(path.substring(pathOffset, pathOffset + 15),
unittest.equals("gmail/v1/users/"));
pathOffset += 15;
index = path.indexOf('/labels/', pathOffset);
unittest.expect(index >= 0, unittest.isTrue);
subPart =
core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
pathOffset = index;
unittest.expect(subPart, unittest.equals('$arg_userId'));
unittest.expect(path.substring(pathOffset, pathOffset + 8),
unittest.equals("/labels/"));
pathOffset += 8;
subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset));
pathOffset = path.length;
unittest.expect(subPart, unittest.equals('$arg_id'));
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
if (query.isNotEmpty) {
for (var part in query.split('&')) {
var keyValue = part.split('=');
addQueryParam(
core.Uri.decodeQueryComponent(keyValue[0]),
core.Uri.decodeQueryComponent(keyValue[1]),
);
}
}
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
'content-type': 'application/json; charset=utf-8',
};
var resp = convert.json.encode(buildLabel());
return async.Future.value(stringResponse(200, h, resp));
}), true);
res
.update(arg_request, arg_userId, arg_id, $fields: arg_$fields)
.then(unittest.expectAsync1(((response) {
checkLabel(response);
})));
});
});
unittest.group('resource-UsersMessagesResourceApi', () {
unittest.test('method--batchDelete', () {
var mock = HttpServerMock();
api.UsersMessagesResourceApi res = api.GmailApi(mock).users.messages;
var arg_request = buildBatchDeleteMessagesRequest();
var arg_userId = 'foo';
var arg_$fields = 'foo';
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var obj = api.BatchDeleteMessagesRequest.fromJson(json);
checkBatchDeleteMessagesRequest(obj);
var path = (req.url).path;
var pathOffset = 0;
core.int index;
core.String subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(path.substring(pathOffset, pathOffset + 15),
unittest.equals("gmail/v1/users/"));
pathOffset += 15;
index = path.indexOf('/messages/batchDelete', pathOffset);
unittest.expect(index >= 0, unittest.isTrue);
subPart =
core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
pathOffset = index;
unittest.expect(subPart, unittest.equals('$arg_userId'));
unittest.expect(path.substring(pathOffset, pathOffset + 21),
unittest.equals("/messages/batchDelete"));
pathOffset += 21;
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
if (query.isNotEmpty) {
for (var part in query.split('&')) {
var keyValue = part.split('=');
addQueryParam(
core.Uri.decodeQueryComponent(keyValue[0]),
core.Uri.decodeQueryComponent(keyValue[1]),
);
}
}
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
'content-type': 'application/json; charset=utf-8',
};
var resp = '';
return async.Future.value(stringResponse(200, h, resp));
}), true);
res
.batchDelete(arg_request, arg_userId, $fields: arg_$fields)
.then(unittest.expectAsync1((_) {}));
});
unittest.test('method--batchModify', () {
var mock = HttpServerMock();
api.UsersMessagesResourceApi res = api.GmailApi(mock).users.messages;
var arg_request = buildBatchModifyMessagesRequest();
var arg_userId = 'foo';
var arg_$fields = 'foo';
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var obj = api.BatchModifyMessagesRequest.fromJson(json);
checkBatchModifyMessagesRequest(obj);
var path = (req.url).path;
var pathOffset = 0;
core.int index;
core.String subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(path.substring(pathOffset, pathOffset + 15),
unittest.equals("gmail/v1/users/"));
pathOffset += 15;
index = path.indexOf('/messages/batchModify', pathOffset);
unittest.expect(index >= 0, unittest.isTrue);
subPart =
core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
pathOffset = index;
unittest.expect(subPart, unittest.equals('$arg_userId'));
unittest.expect(path.substring(pathOffset, pathOffset + 21),
unittest.equals("/messages/batchModify"));
pathOffset += 21;
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
if (query.isNotEmpty) {
for (var part in query.split('&')) {
var keyValue = part.split('=');
addQueryParam(
core.Uri.decodeQueryComponent(keyValue[0]),
core.Uri.decodeQueryComponent(keyValue[1]),
);
}
}
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
'content-type': 'application/json; charset=utf-8',
};
var resp = '';
return async.Future.value(stringResponse(200, h, resp));
}), true);
res
.batchModify(arg_request, arg_userId, $fields: arg_$fields)
.then(unittest.expectAsync1((_) {}));
});
unittest.test('method--delete', () {
var mock = HttpServerMock();
api.UsersMessagesResourceApi res = api.GmailApi(mock).users.messages;
var arg_userId = 'foo';
var arg_id = 'foo';
var arg_$fields = 'foo';
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var path = (req.url).path;
var pathOffset = 0;
core.int index;
core.String subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(path.substring(pathOffset, pathOffset + 15),
unittest.equals("gmail/v1/users/"));
pathOffset += 15;
index = path.indexOf('/messages/', pathOffset);
unittest.expect(index >= 0, unittest.isTrue);
subPart =
core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
pathOffset = index;
unittest.expect(subPart, unittest.equals('$arg_userId'));
unittest.expect(path.substring(pathOffset, pathOffset + 10),
unittest.equals("/messages/"));
pathOffset += 10;
subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset));
pathOffset = path.length;
unittest.expect(subPart, unittest.equals('$arg_id'));
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
if (query.isNotEmpty) {
for (var part in query.split('&')) {
var keyValue = part.split('=');
addQueryParam(
core.Uri.decodeQueryComponent(keyValue[0]),
core.Uri.decodeQueryComponent(keyValue[1]),
);
}
}
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
'content-type': 'application/json; charset=utf-8',
};
var resp = '';
return async.Future.value(stringResponse(200, h, resp));
}), true);
res
.delete(arg_userId, arg_id, $fields: arg_$fields)
.then(unittest.expectAsync1((_) {}));
});
unittest.test('method--get', () {
var mock = HttpServerMock();
api.UsersMessagesResourceApi res = api.GmailApi(mock).users.messages;
var arg_userId = 'foo';
var arg_id = 'foo';
var arg_format = 'foo';
var arg_metadataHeaders = buildUnnamed3206();
var arg_$fields = 'foo';
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var path = (req.url).path;
var pathOffset = 0;
core.int index;
core.String subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(path.substring(pathOffset, pathOffset + 15),
unittest.equals("gmail/v1/users/"));
pathOffset += 15;
index = path.indexOf('/messages/', pathOffset);
unittest.expect(index >= 0, unittest.isTrue);
subPart =
core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
pathOffset = index;
unittest.expect(subPart, unittest.equals('$arg_userId'));
unittest.expect(path.substring(pathOffset, pathOffset + 10),
unittest.equals("/messages/"));
pathOffset += 10;
subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset));
pathOffset = path.length;
unittest.expect(subPart, unittest.equals('$arg_id'));
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
if (query.isNotEmpty) {
for (var part in query.split('&')) {
var keyValue = part.split('=');
addQueryParam(
core.Uri.decodeQueryComponent(keyValue[0]),
core.Uri.decodeQueryComponent(keyValue[1]),
);
}
}
unittest.expect(queryMap["format"].first, unittest.equals(arg_format));
unittest.expect(
queryMap["metadataHeaders"], unittest.equals(arg_metadataHeaders));
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
'content-type': 'application/json; charset=utf-8',
};
var resp = convert.json.encode(buildMessage());
return async.Future.value(stringResponse(200, h, resp));
}), true);
res
.get(arg_userId, arg_id,
format: arg_format,
metadataHeaders: arg_metadataHeaders,
$fields: arg_$fields)
.then(unittest.expectAsync1(((response) {
checkMessage(response);
})));
});
unittest.test('method--import', () {
// TODO: Implement tests for media upload;
// TODO: Implement tests for media download;
var mock = HttpServerMock();
api.UsersMessagesResourceApi res = api.GmailApi(mock).users.messages;
var arg_request = buildMessage();
var arg_userId = 'foo';
var arg_deleted = true;
var arg_internalDateSource = 'foo';
var arg_neverMarkSpam = true;
var arg_processForCalendar = true;
var arg_$fields = 'foo';
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var obj = api.Message.fromJson(json);
checkMessage(obj);
var path = (req.url).path;
var pathOffset = 0;
core.int index;
core.String subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(path.substring(pathOffset, pathOffset + 15),
unittest.equals("gmail/v1/users/"));
pathOffset += 15;
index = path.indexOf('/messages/import', pathOffset);
unittest.expect(index >= 0, unittest.isTrue);
subPart =
core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
pathOffset = index;
unittest.expect(subPart, unittest.equals('$arg_userId'));
unittest.expect(path.substring(pathOffset, pathOffset + 16),
unittest.equals("/messages/import"));
pathOffset += 16;
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
if (query.isNotEmpty) {
for (var part in query.split('&')) {
var keyValue = part.split('=');
addQueryParam(
core.Uri.decodeQueryComponent(keyValue[0]),
core.Uri.decodeQueryComponent(keyValue[1]),
);
}
}
unittest.expect(
queryMap["deleted"].first, unittest.equals("$arg_deleted"));
unittest.expect(queryMap["internalDateSource"].first,
unittest.equals(arg_internalDateSource));
unittest.expect(queryMap["neverMarkSpam"].first,
unittest.equals("$arg_neverMarkSpam"));
unittest.expect(queryMap["processForCalendar"].first,
unittest.equals("$arg_processForCalendar"));
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
'content-type': 'application/json; charset=utf-8',
};
var resp = convert.json.encode(buildMessage());
return async.Future.value(stringResponse(200, h, resp));
}), true);
res
.import(arg_request, arg_userId,
deleted: arg_deleted,
internalDateSource: arg_internalDateSource,
neverMarkSpam: arg_neverMarkSpam,
processForCalendar: arg_processForCalendar,
$fields: arg_$fields)
.then(unittest.expectAsync1(((response) {
checkMessage(response);
})));
});
unittest.test('method--insert', () {
// TODO: Implement tests for media upload;
// TODO: Implement tests for media download;
var mock = HttpServerMock();
api.UsersMessagesResourceApi res = api.GmailApi(mock).users.messages;
var arg_request = buildMessage();
var arg_userId = 'foo';
var arg_deleted = true;
var arg_internalDateSource = 'foo';
var arg_$fields = 'foo';
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var obj = api.Message.fromJson(json);
checkMessage(obj);
var path = (req.url).path;
var pathOffset = 0;
core.int index;
core.String subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(path.substring(pathOffset, pathOffset + 15),
unittest.equals("gmail/v1/users/"));
pathOffset += 15;
index = path.indexOf('/messages', pathOffset);
unittest.expect(index >= 0, unittest.isTrue);
subPart =
core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
pathOffset = index;
unittest.expect(subPart, unittest.equals('$arg_userId'));
unittest.expect(path.substring(pathOffset, pathOffset + 9),
unittest.equals("/messages"));
pathOffset += 9;
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
if (query.isNotEmpty) {
for (var part in query.split('&')) {
var keyValue = part.split('=');
addQueryParam(
core.Uri.decodeQueryComponent(keyValue[0]),
core.Uri.decodeQueryComponent(keyValue[1]),
);
}
}
unittest.expect(
queryMap["deleted"].first, unittest.equals("$arg_deleted"));
unittest.expect(queryMap["internalDateSource"].first,
unittest.equals(arg_internalDateSource));
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
'content-type': 'application/json; charset=utf-8',
};
var resp = convert.json.encode(buildMessage());
return async.Future.value(stringResponse(200, h, resp));
}), true);
res
.insert(arg_request, arg_userId,
deleted: arg_deleted,
internalDateSource: arg_internalDateSource,
$fields: arg_$fields)
.then(unittest.expectAsync1(((response) {
checkMessage(response);
})));
});
unittest.test('method--list', () {
var mock = HttpServerMock();
api.UsersMessagesResourceApi res = api.GmailApi(mock).users.messages;
var arg_userId = 'foo';
var arg_includeSpamTrash = true;
var arg_labelIds = buildUnnamed3207();
var arg_maxResults = 42;
var arg_pageToken = 'foo';
var arg_q = 'foo';
var arg_$fields = 'foo';
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var path = (req.url).path;
var pathOffset = 0;
core.int index;
core.String subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(path.substring(pathOffset, pathOffset + 15),
unittest.equals("gmail/v1/users/"));
pathOffset += 15;
index = path.indexOf('/messages', pathOffset);
unittest.expect(index >= 0, unittest.isTrue);
subPart =
core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
pathOffset = index;
unittest.expect(subPart, unittest.equals('$arg_userId'));
unittest.expect(path.substring(pathOffset, pathOffset + 9),
unittest.equals("/messages"));
pathOffset += 9;
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
if (query.isNotEmpty) {
for (var part in query.split('&')) {
var keyValue = part.split('=');
addQueryParam(
core.Uri.decodeQueryComponent(keyValue[0]),
core.Uri.decodeQueryComponent(keyValue[1]),
);
}
}
unittest.expect(queryMap["includeSpamTrash"].first,
unittest.equals("$arg_includeSpamTrash"));
unittest.expect(queryMap["labelIds"], unittest.equals(arg_labelIds));
unittest.expect(core.int.parse(queryMap["maxResults"].first),
unittest.equals(arg_maxResults));
unittest.expect(
queryMap["pageToken"].first, unittest.equals(arg_pageToken));
unittest.expect(queryMap["q"].first, unittest.equals(arg_q));
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
'content-type': 'application/json; charset=utf-8',
};
var resp = convert.json.encode(buildListMessagesResponse());
return async.Future.value(stringResponse(200, h, resp));
}), true);
res
.list(arg_userId,
includeSpamTrash: arg_includeSpamTrash,
labelIds: arg_labelIds,
maxResults: arg_maxResults,
pageToken: arg_pageToken,
q: arg_q,
$fields: arg_$fields)
.then(unittest.expectAsync1(((response) {
checkListMessagesResponse(response);
})));
});
unittest.test('method--modify', () {
var mock = HttpServerMock();
api.UsersMessagesResourceApi res = api.GmailApi(mock).users.messages;
var arg_request = buildModifyMessageRequest();
var arg_userId = 'foo';
var arg_id = 'foo';
var arg_$fields = 'foo';
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var obj = api.ModifyMessageRequest.fromJson(json);
checkModifyMessageRequest(obj);
var path = (req.url).path;
var pathOffset = 0;
core.int index;
core.String subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(path.substring(pathOffset, pathOffset + 15),
unittest.equals("gmail/v1/users/"));
pathOffset += 15;
index = path.indexOf('/messages/', pathOffset);
unittest.expect(index >= 0, unittest.isTrue);
subPart =
core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
pathOffset = index;
unittest.expect(subPart, unittest.equals('$arg_userId'));
unittest.expect(path.substring(pathOffset, pathOffset + 10),
unittest.equals("/messages/"));
pathOffset += 10;
index = path.indexOf('/modify', pathOffset);
unittest.expect(index >= 0, unittest.isTrue);
subPart =
core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
pathOffset = index;
unittest.expect(subPart, unittest.equals('$arg_id'));
unittest.expect(path.substring(pathOffset, pathOffset + 7),
unittest.equals("/modify"));
pathOffset += 7;
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
if (query.isNotEmpty) {
for (var part in query.split('&')) {
var keyValue = part.split('=');
addQueryParam(
core.Uri.decodeQueryComponent(keyValue[0]),
core.Uri.decodeQueryComponent(keyValue[1]),
);
}
}
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
'content-type': 'application/json; charset=utf-8',
};
var resp = convert.json.encode(buildMessage());
return async.Future.value(stringResponse(200, h, resp));
}), true);
res
.modify(arg_request, arg_userId, arg_id, $fields: arg_$fields)
.then(unittest.expectAsync1(((response) {
checkMessage(response);
})));
});
unittest.test('method--send', () {
// TODO: Implement tests for media upload;
// TODO: Implement tests for media download;
var mock = HttpServerMock();
api.UsersMessagesResourceApi res = api.GmailApi(mock).users.messages;
var arg_request = buildMessage();
var arg_userId = 'foo';
var arg_$fields = 'foo';
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var obj = api.Message.fromJson(json);
checkMessage(obj);
var path = (req.url).path;
var pathOffset = 0;
core.int index;
core.String subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(path.substring(pathOffset, pathOffset + 15),
unittest.equals("gmail/v1/users/"));
pathOffset += 15;
index = path.indexOf('/messages/send', pathOffset);
unittest.expect(index >= 0, unittest.isTrue);
subPart =
core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
pathOffset = index;
unittest.expect(subPart, unittest.equals('$arg_userId'));
unittest.expect(path.substring(pathOffset, pathOffset + 14),
unittest.equals("/messages/send"));
pathOffset += 14;
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
if (query.isNotEmpty) {
for (var part in query.split('&')) {
var keyValue = part.split('=');
addQueryParam(
core.Uri.decodeQueryComponent(keyValue[0]),
core.Uri.decodeQueryComponent(keyValue[1]),
);
}
}
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
'content-type': 'application/json; charset=utf-8',
};
var resp = convert.json.encode(buildMessage());
return async.Future.value(stringResponse(200, h, resp));
}), true);
res
.send(arg_request, arg_userId, $fields: arg_$fields)
.then(unittest.expectAsync1(((response) {
checkMessage(response);
})));
});
unittest.test('method--trash', () {
var mock = HttpServerMock();
api.UsersMessagesResourceApi res = api.GmailApi(mock).users.messages;
var arg_userId = 'foo';
var arg_id = 'foo';
var arg_$fields = 'foo';
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var path = (req.url).path;
var pathOffset = 0;
core.int index;
core.String subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(path.substring(pathOffset, pathOffset + 15),
unittest.equals("gmail/v1/users/"));
pathOffset += 15;
index = path.indexOf('/messages/', pathOffset);
unittest.expect(index >= 0, unittest.isTrue);
subPart =
core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
pathOffset = index;
unittest.expect(subPart, unittest.equals('$arg_userId'));
unittest.expect(path.substring(pathOffset, pathOffset + 10),
unittest.equals("/messages/"));
pathOffset += 10;
index = path.indexOf('/trash', pathOffset);
unittest.expect(index >= 0, unittest.isTrue);
subPart =
core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
pathOffset = index;
unittest.expect(subPart, unittest.equals('$arg_id'));
unittest.expect(path.substring(pathOffset, pathOffset + 6),
unittest.equals("/trash"));
pathOffset += 6;
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
if (query.isNotEmpty) {
for (var part in query.split('&')) {
var keyValue = part.split('=');
addQueryParam(
core.Uri.decodeQueryComponent(keyValue[0]),
core.Uri.decodeQueryComponent(keyValue[1]),
);
}
}
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
'content-type': 'application/json; charset=utf-8',
};
var resp = convert.json.encode(buildMessage());
return async.Future.value(stringResponse(200, h, resp));
}), true);
res
.trash(arg_userId, arg_id, $fields: arg_$fields)
.then(unittest.expectAsync1(((response) {
checkMessage(response);
})));
});
unittest.test('method--untrash', () {
var mock = HttpServerMock();
api.UsersMessagesResourceApi res = api.GmailApi(mock).users.messages;
var arg_userId = 'foo';
var arg_id = 'foo';
var arg_$fields = 'foo';
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var path = (req.url).path;
var pathOffset = 0;
core.int index;
core.String subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(path.substring(pathOffset, pathOffset + 15),
unittest.equals("gmail/v1/users/"));
pathOffset += 15;
index = path.indexOf('/messages/', pathOffset);
unittest.expect(index >= 0, unittest.isTrue);
subPart =
core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
pathOffset = index;
unittest.expect(subPart, unittest.equals('$arg_userId'));
unittest.expect(path.substring(pathOffset, pathOffset + 10),
unittest.equals("/messages/"));
pathOffset += 10;
index = path.indexOf('/untrash', pathOffset);
unittest.expect(index >= 0, unittest.isTrue);
subPart =
core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
pathOffset = index;
unittest.expect(subPart, unittest.equals('$arg_id'));
unittest.expect(path.substring(pathOffset, pathOffset + 8),
unittest.equals("/untrash"));
pathOffset += 8;
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
if (query.isNotEmpty) {
for (var part in query.split('&')) {
var keyValue = part.split('=');
addQueryParam(
core.Uri.decodeQueryComponent(keyValue[0]),
core.Uri.decodeQueryComponent(keyValue[1]),
);
}
}
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
'content-type': 'application/json; charset=utf-8',
};
var resp = convert.json.encode(buildMessage());
return async.Future.value(stringResponse(200, h, resp));
}), true);
res
.untrash(arg_userId, arg_id, $fields: arg_$fields)
.then(unittest.expectAsync1(((response) {
checkMessage(response);
})));
});
});
unittest.group('resource-UsersMessagesAttachmentsResourceApi', () {
unittest.test('method--get', () {
var mock = HttpServerMock();
api.UsersMessagesAttachmentsResourceApi res =
api.GmailApi(mock).users.messages.attachments;
var arg_userId = 'foo';
var arg_messageId = 'foo';
var arg_id = 'foo';
var arg_$fields = 'foo';
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var path = (req.url).path;
var pathOffset = 0;
core.int index;
core.String subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(path.substring(pathOffset, pathOffset + 15),
unittest.equals("gmail/v1/users/"));
pathOffset += 15;
index = path.indexOf('/messages/', pathOffset);
unittest.expect(index >= 0, unittest.isTrue);
subPart =
core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
pathOffset = index;
unittest.expect(subPart, unittest.equals('$arg_userId'));
unittest.expect(path.substring(pathOffset, pathOffset + 10),
unittest.equals("/messages/"));
pathOffset += 10;
index = path.indexOf('/attachments/', pathOffset);
unittest.expect(index >= 0, unittest.isTrue);
subPart =
core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
pathOffset = index;
unittest.expect(subPart, unittest.equals('$arg_messageId'));
unittest.expect(path.substring(pathOffset, pathOffset + 13),
unittest.equals("/attachments/"));
pathOffset += 13;
subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset));
pathOffset = path.length;
unittest.expect(subPart, unittest.equals('$arg_id'));
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
if (query.isNotEmpty) {
for (var part in query.split('&')) {
var keyValue = part.split('=');
addQueryParam(
core.Uri.decodeQueryComponent(keyValue[0]),
core.Uri.decodeQueryComponent(keyValue[1]),
);
}
}
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
'content-type': 'application/json; charset=utf-8',
};
var resp = convert.json.encode(buildMessagePartBody());
return async.Future.value(stringResponse(200, h, resp));
}), true);
res
.get(arg_userId, arg_messageId, arg_id, $fields: arg_$fields)
.then(unittest.expectAsync1(((response) {
checkMessagePartBody(response);
})));
});
});
unittest.group('resource-UsersSettingsResourceApi', () {
unittest.test('method--getAutoForwarding', () {
var mock = HttpServerMock();
api.UsersSettingsResourceApi res = api.GmailApi(mock).users.settings;
var arg_userId = 'foo';
var arg_$fields = 'foo';
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var path = (req.url).path;
var pathOffset = 0;
core.int index;
core.String subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(path.substring(pathOffset, pathOffset + 15),
unittest.equals("gmail/v1/users/"));
pathOffset += 15;
index = path.indexOf('/settings/autoForwarding', pathOffset);
unittest.expect(index >= 0, unittest.isTrue);
subPart =
core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
pathOffset = index;
unittest.expect(subPart, unittest.equals('$arg_userId'));
unittest.expect(path.substring(pathOffset, pathOffset + 24),
unittest.equals("/settings/autoForwarding"));
pathOffset += 24;
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
if (query.isNotEmpty) {
for (var part in query.split('&')) {
var keyValue = part.split('=');
addQueryParam(
core.Uri.decodeQueryComponent(keyValue[0]),
core.Uri.decodeQueryComponent(keyValue[1]),
);
}
}
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
'content-type': 'application/json; charset=utf-8',
};
var resp = convert.json.encode(buildAutoForwarding());
return async.Future.value(stringResponse(200, h, resp));
}), true);
res
.getAutoForwarding(arg_userId, $fields: arg_$fields)
.then(unittest.expectAsync1(((response) {
checkAutoForwarding(response);
})));
});
unittest.test('method--getImap', () {
var mock = HttpServerMock();
api.UsersSettingsResourceApi res = api.GmailApi(mock).users.settings;
var arg_userId = 'foo';
var arg_$fields = 'foo';
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var path = (req.url).path;
var pathOffset = 0;
core.int index;
core.String subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(path.substring(pathOffset, pathOffset + 15),
unittest.equals("gmail/v1/users/"));
pathOffset += 15;
index = path.indexOf('/settings/imap', pathOffset);
unittest.expect(index >= 0, unittest.isTrue);
subPart =
core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
pathOffset = index;
unittest.expect(subPart, unittest.equals('$arg_userId'));
unittest.expect(path.substring(pathOffset, pathOffset + 14),
unittest.equals("/settings/imap"));
pathOffset += 14;
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
if (query.isNotEmpty) {
for (var part in query.split('&')) {
var keyValue = part.split('=');
addQueryParam(
core.Uri.decodeQueryComponent(keyValue[0]),
core.Uri.decodeQueryComponent(keyValue[1]),
);
}
}
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
'content-type': 'application/json; charset=utf-8',
};
var resp = convert.json.encode(buildImapSettings());
return async.Future.value(stringResponse(200, h, resp));
}), true);
res
.getImap(arg_userId, $fields: arg_$fields)
.then(unittest.expectAsync1(((response) {
checkImapSettings(response);
})));
});
unittest.test('method--getLanguage', () {
var mock = HttpServerMock();
api.UsersSettingsResourceApi res = api.GmailApi(mock).users.settings;
var arg_userId = 'foo';
var arg_$fields = 'foo';
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var path = (req.url).path;
var pathOffset = 0;
core.int index;
core.String subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(path.substring(pathOffset, pathOffset + 15),
unittest.equals("gmail/v1/users/"));
pathOffset += 15;
index = path.indexOf('/settings/language', pathOffset);
unittest.expect(index >= 0, unittest.isTrue);
subPart =
core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
pathOffset = index;
unittest.expect(subPart, unittest.equals('$arg_userId'));
unittest.expect(path.substring(pathOffset, pathOffset + 18),
unittest.equals("/settings/language"));
pathOffset += 18;
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
if (query.isNotEmpty) {
for (var part in query.split('&')) {
var keyValue = part.split('=');
addQueryParam(
core.Uri.decodeQueryComponent(keyValue[0]),
core.Uri.decodeQueryComponent(keyValue[1]),
);
}
}
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
'content-type': 'application/json; charset=utf-8',
};
var resp = convert.json.encode(buildLanguageSettings());
return async.Future.value(stringResponse(200, h, resp));
}), true);
res
.getLanguage(arg_userId, $fields: arg_$fields)
.then(unittest.expectAsync1(((response) {
checkLanguageSettings(response);
})));
});
unittest.test('method--getPop', () {
var mock = HttpServerMock();
api.UsersSettingsResourceApi res = api.GmailApi(mock).users.settings;
var arg_userId = 'foo';
var arg_$fields = 'foo';
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var path = (req.url).path;
var pathOffset = 0;
core.int index;
core.String subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(path.substring(pathOffset, pathOffset + 15),
unittest.equals("gmail/v1/users/"));
pathOffset += 15;
index = path.indexOf('/settings/pop', pathOffset);
unittest.expect(index >= 0, unittest.isTrue);
subPart =
core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
pathOffset = index;
unittest.expect(subPart, unittest.equals('$arg_userId'));
unittest.expect(path.substring(pathOffset, pathOffset + 13),
unittest.equals("/settings/pop"));
pathOffset += 13;
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
if (query.isNotEmpty) {
for (var part in query.split('&')) {
var keyValue = part.split('=');
addQueryParam(
core.Uri.decodeQueryComponent(keyValue[0]),
core.Uri.decodeQueryComponent(keyValue[1]),
);
}
}
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
'content-type': 'application/json; charset=utf-8',
};
var resp = convert.json.encode(buildPopSettings());
return async.Future.value(stringResponse(200, h, resp));
}), true);
res
.getPop(arg_userId, $fields: arg_$fields)
.then(unittest.expectAsync1(((response) {
checkPopSettings(response);
})));
});
unittest.test('method--getVacation', () {
var mock = HttpServerMock();
api.UsersSettingsResourceApi res = api.GmailApi(mock).users.settings;
var arg_userId = 'foo';
var arg_$fields = 'foo';
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var path = (req.url).path;
var pathOffset = 0;
core.int index;
core.String subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(path.substring(pathOffset, pathOffset + 15),
unittest.equals("gmail/v1/users/"));
pathOffset += 15;
index = path.indexOf('/settings/vacation', pathOffset);
unittest.expect(index >= 0, unittest.isTrue);
subPart =
core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
pathOffset = index;
unittest.expect(subPart, unittest.equals('$arg_userId'));
unittest.expect(path.substring(pathOffset, pathOffset + 18),
unittest.equals("/settings/vacation"));
pathOffset += 18;
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
if (query.isNotEmpty) {
for (var part in query.split('&')) {
var keyValue = part.split('=');
addQueryParam(
core.Uri.decodeQueryComponent(keyValue[0]),
core.Uri.decodeQueryComponent(keyValue[1]),
);
}
}
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
'content-type': 'application/json; charset=utf-8',
};
var resp = convert.json.encode(buildVacationSettings());
return async.Future.value(stringResponse(200, h, resp));
}), true);
res
.getVacation(arg_userId, $fields: arg_$fields)
.then(unittest.expectAsync1(((response) {
checkVacationSettings(response);
})));
});
unittest.test('method--updateAutoForwarding', () {
var mock = HttpServerMock();
api.UsersSettingsResourceApi res = api.GmailApi(mock).users.settings;
var arg_request = buildAutoForwarding();
var arg_userId = 'foo';
var arg_$fields = 'foo';
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var obj = api.AutoForwarding.fromJson(json);
checkAutoForwarding(obj);
var path = (req.url).path;
var pathOffset = 0;
core.int index;
core.String subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(path.substring(pathOffset, pathOffset + 15),
unittest.equals("gmail/v1/users/"));
pathOffset += 15;
index = path.indexOf('/settings/autoForwarding', pathOffset);
unittest.expect(index >= 0, unittest.isTrue);
subPart =
core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
pathOffset = index;
unittest.expect(subPart, unittest.equals('$arg_userId'));
unittest.expect(path.substring(pathOffset, pathOffset + 24),
unittest.equals("/settings/autoForwarding"));
pathOffset += 24;
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
if (query.isNotEmpty) {
for (var part in query.split('&')) {
var keyValue = part.split('=');
addQueryParam(
core.Uri.decodeQueryComponent(keyValue[0]),
core.Uri.decodeQueryComponent(keyValue[1]),
);
}
}
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
'content-type': 'application/json; charset=utf-8',
};
var resp = convert.json.encode(buildAutoForwarding());
return async.Future.value(stringResponse(200, h, resp));
}), true);
res
.updateAutoForwarding(arg_request, arg_userId, $fields: arg_$fields)
.then(unittest.expectAsync1(((response) {
checkAutoForwarding(response);
})));
});
unittest.test('method--updateImap', () {
var mock = HttpServerMock();
api.UsersSettingsResourceApi res = api.GmailApi(mock).users.settings;
var arg_request = buildImapSettings();
var arg_userId = 'foo';
var arg_$fields = 'foo';
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var obj = api.ImapSettings.fromJson(json);
checkImapSettings(obj);
var path = (req.url).path;
var pathOffset = 0;
core.int index;
core.String subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(path.substring(pathOffset, pathOffset + 15),
unittest.equals("gmail/v1/users/"));
pathOffset += 15;
index = path.indexOf('/settings/imap', pathOffset);
unittest.expect(index >= 0, unittest.isTrue);
subPart =
core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
pathOffset = index;
unittest.expect(subPart, unittest.equals('$arg_userId'));
unittest.expect(path.substring(pathOffset, pathOffset + 14),
unittest.equals("/settings/imap"));
pathOffset += 14;
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
if (query.isNotEmpty) {
for (var part in query.split('&')) {
var keyValue = part.split('=');
addQueryParam(
core.Uri.decodeQueryComponent(keyValue[0]),
core.Uri.decodeQueryComponent(keyValue[1]),
);
}
}
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
'content-type': 'application/json; charset=utf-8',
};
var resp = convert.json.encode(buildImapSettings());
return async.Future.value(stringResponse(200, h, resp));
}), true);
res
.updateImap(arg_request, arg_userId, $fields: arg_$fields)
.then(unittest.expectAsync1(((response) {
checkImapSettings(response);
})));
});
unittest.test('method--updateLanguage', () {
var mock = HttpServerMock();
api.UsersSettingsResourceApi res = api.GmailApi(mock).users.settings;
var arg_request = buildLanguageSettings();
var arg_userId = 'foo';
var arg_$fields = 'foo';
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var obj = api.LanguageSettings.fromJson(json);
checkLanguageSettings(obj);
var path = (req.url).path;
var pathOffset = 0;
core.int index;
core.String subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(path.substring(pathOffset, pathOffset + 15),
unittest.equals("gmail/v1/users/"));
pathOffset += 15;
index = path.indexOf('/settings/language', pathOffset);
unittest.expect(index >= 0, unittest.isTrue);
subPart =
core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
pathOffset = index;
unittest.expect(subPart, unittest.equals('$arg_userId'));
unittest.expect(path.substring(pathOffset, pathOffset + 18),
unittest.equals("/settings/language"));
pathOffset += 18;
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
if (query.isNotEmpty) {
for (var part in query.split('&')) {
var keyValue = part.split('=');
addQueryParam(
core.Uri.decodeQueryComponent(keyValue[0]),
core.Uri.decodeQueryComponent(keyValue[1]),
);
}
}
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
'content-type': 'application/json; charset=utf-8',
};
var resp = convert.json.encode(buildLanguageSettings());
return async.Future.value(stringResponse(200, h, resp));
}), true);
res
.updateLanguage(arg_request, arg_userId, $fields: arg_$fields)
.then(unittest.expectAsync1(((response) {
checkLanguageSettings(response);
})));
});
unittest.test('method--updatePop', () {
var mock = HttpServerMock();
api.UsersSettingsResourceApi res = api.GmailApi(mock).users.settings;
var arg_request = buildPopSettings();
var arg_userId = 'foo';
var arg_$fields = 'foo';
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var obj = api.PopSettings.fromJson(json);
checkPopSettings(obj);
var path = (req.url).path;
var pathOffset = 0;
core.int index;
core.String subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(path.substring(pathOffset, pathOffset + 15),
unittest.equals("gmail/v1/users/"));
pathOffset += 15;
index = path.indexOf('/settings/pop', pathOffset);
unittest.expect(index >= 0, unittest.isTrue);
subPart =
core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
pathOffset = index;
unittest.expect(subPart, unittest.equals('$arg_userId'));
unittest.expect(path.substring(pathOffset, pathOffset + 13),
unittest.equals("/settings/pop"));
pathOffset += 13;
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
if (query.isNotEmpty) {
for (var part in query.split('&')) {
var keyValue = part.split('=');
addQueryParam(
core.Uri.decodeQueryComponent(keyValue[0]),
core.Uri.decodeQueryComponent(keyValue[1]),
);
}
}
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
'content-type': 'application/json; charset=utf-8',
};
var resp = convert.json.encode(buildPopSettings());
return async.Future.value(stringResponse(200, h, resp));
}), true);
res
.updatePop(arg_request, arg_userId, $fields: arg_$fields)
.then(unittest.expectAsync1(((response) {
checkPopSettings(response);
})));
});
unittest.test('method--updateVacation', () {
var mock = HttpServerMock();
api.UsersSettingsResourceApi res = api.GmailApi(mock).users.settings;
var arg_request = buildVacationSettings();
var arg_userId = 'foo';
var arg_$fields = 'foo';
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var obj = api.VacationSettings.fromJson(json);
checkVacationSettings(obj);
var path = (req.url).path;
var pathOffset = 0;
core.int index;
core.String subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(path.substring(pathOffset, pathOffset + 15),
unittest.equals("gmail/v1/users/"));
pathOffset += 15;
index = path.indexOf('/settings/vacation', pathOffset);
unittest.expect(index >= 0, unittest.isTrue);
subPart =
core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
pathOffset = index;
unittest.expect(subPart, unittest.equals('$arg_userId'));
unittest.expect(path.substring(pathOffset, pathOffset + 18),
unittest.equals("/settings/vacation"));
pathOffset += 18;
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
if (query.isNotEmpty) {
for (var part in query.split('&')) {
var keyValue = part.split('=');
addQueryParam(
core.Uri.decodeQueryComponent(keyValue[0]),
core.Uri.decodeQueryComponent(keyValue[1]),
);
}
}
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
'content-type': 'application/json; charset=utf-8',
};
var resp = convert.json.encode(buildVacationSettings());
return async.Future.value(stringResponse(200, h, resp));
}), true);
res
.updateVacation(arg_request, arg_userId, $fields: arg_$fields)
.then(unittest.expectAsync1(((response) {
checkVacationSettings(response);
})));
});
});
unittest.group('resource-UsersSettingsDelegatesResourceApi', () {
unittest.test('method--create', () {
var mock = HttpServerMock();
api.UsersSettingsDelegatesResourceApi res =
api.GmailApi(mock).users.settings.delegates;
var arg_request = buildDelegate();
var arg_userId = 'foo';
var arg_$fields = 'foo';
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var obj = api.Delegate.fromJson(json);
checkDelegate(obj);
var path = (req.url).path;
var pathOffset = 0;
core.int index;
core.String subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(path.substring(pathOffset, pathOffset + 15),
unittest.equals("gmail/v1/users/"));
pathOffset += 15;
index = path.indexOf('/settings/delegates', pathOffset);
unittest.expect(index >= 0, unittest.isTrue);
subPart =
core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
pathOffset = index;
unittest.expect(subPart, unittest.equals('$arg_userId'));
unittest.expect(path.substring(pathOffset, pathOffset + 19),
unittest.equals("/settings/delegates"));
pathOffset += 19;
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
if (query.isNotEmpty) {
for (var part in query.split('&')) {
var keyValue = part.split('=');
addQueryParam(
core.Uri.decodeQueryComponent(keyValue[0]),
core.Uri.decodeQueryComponent(keyValue[1]),
);
}
}
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
'content-type': 'application/json; charset=utf-8',
};
var resp = convert.json.encode(buildDelegate());
return async.Future.value(stringResponse(200, h, resp));
}), true);
res
.create(arg_request, arg_userId, $fields: arg_$fields)
.then(unittest.expectAsync1(((response) {
checkDelegate(response);
})));
});
unittest.test('method--delete', () {
var mock = HttpServerMock();
api.UsersSettingsDelegatesResourceApi res =
api.GmailApi(mock).users.settings.delegates;
var arg_userId = 'foo';
var arg_delegateEmail = 'foo';
var arg_$fields = 'foo';
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var path = (req.url).path;
var pathOffset = 0;
core.int index;
core.String subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(path.substring(pathOffset, pathOffset + 15),
unittest.equals("gmail/v1/users/"));
pathOffset += 15;
index = path.indexOf('/settings/delegates/', pathOffset);
unittest.expect(index >= 0, unittest.isTrue);
subPart =
core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
pathOffset = index;
unittest.expect(subPart, unittest.equals('$arg_userId'));
unittest.expect(path.substring(pathOffset, pathOffset + 20),
unittest.equals("/settings/delegates/"));
pathOffset += 20;
subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset));
pathOffset = path.length;
unittest.expect(subPart, unittest.equals('$arg_delegateEmail'));
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
if (query.isNotEmpty) {
for (var part in query.split('&')) {
var keyValue = part.split('=');
addQueryParam(
core.Uri.decodeQueryComponent(keyValue[0]),
core.Uri.decodeQueryComponent(keyValue[1]),
);
}
}
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
'content-type': 'application/json; charset=utf-8',
};
var resp = '';
return async.Future.value(stringResponse(200, h, resp));
}), true);
res
.delete(arg_userId, arg_delegateEmail, $fields: arg_$fields)
.then(unittest.expectAsync1((_) {}));
});
unittest.test('method--get', () {
var mock = HttpServerMock();
api.UsersSettingsDelegatesResourceApi res =
api.GmailApi(mock).users.settings.delegates;
var arg_userId = 'foo';
var arg_delegateEmail = 'foo';
var arg_$fields = 'foo';
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var path = (req.url).path;
var pathOffset = 0;
core.int index;
core.String subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(path.substring(pathOffset, pathOffset + 15),
unittest.equals("gmail/v1/users/"));
pathOffset += 15;
index = path.indexOf('/settings/delegates/', pathOffset);
unittest.expect(index >= 0, unittest.isTrue);
subPart =
core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
pathOffset = index;
unittest.expect(subPart, unittest.equals('$arg_userId'));
unittest.expect(path.substring(pathOffset, pathOffset + 20),
unittest.equals("/settings/delegates/"));
pathOffset += 20;
subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset));
pathOffset = path.length;
unittest.expect(subPart, unittest.equals('$arg_delegateEmail'));
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
if (query.isNotEmpty) {
for (var part in query.split('&')) {
var keyValue = part.split('=');
addQueryParam(
core.Uri.decodeQueryComponent(keyValue[0]),
core.Uri.decodeQueryComponent(keyValue[1]),
);
}
}
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
'content-type': 'application/json; charset=utf-8',
};
var resp = convert.json.encode(buildDelegate());
return async.Future.value(stringResponse(200, h, resp));
}), true);
res
.get(arg_userId, arg_delegateEmail, $fields: arg_$fields)
.then(unittest.expectAsync1(((response) {
checkDelegate(response);
})));
});
unittest.test('method--list', () {
var mock = HttpServerMock();
api.UsersSettingsDelegatesResourceApi res =
api.GmailApi(mock).users.settings.delegates;
var arg_userId = 'foo';
var arg_$fields = 'foo';
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var path = (req.url).path;
var pathOffset = 0;
core.int index;
core.String subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(path.substring(pathOffset, pathOffset + 15),
unittest.equals("gmail/v1/users/"));
pathOffset += 15;
index = path.indexOf('/settings/delegates', pathOffset);
unittest.expect(index >= 0, unittest.isTrue);
subPart =
core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
pathOffset = index;
unittest.expect(subPart, unittest.equals('$arg_userId'));
unittest.expect(path.substring(pathOffset, pathOffset + 19),
unittest.equals("/settings/delegates"));
pathOffset += 19;
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
if (query.isNotEmpty) {
for (var part in query.split('&')) {
var keyValue = part.split('=');
addQueryParam(
core.Uri.decodeQueryComponent(keyValue[0]),
core.Uri.decodeQueryComponent(keyValue[1]),
);
}
}
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
'content-type': 'application/json; charset=utf-8',
};
var resp = convert.json.encode(buildListDelegatesResponse());
return async.Future.value(stringResponse(200, h, resp));
}), true);
res
.list(arg_userId, $fields: arg_$fields)
.then(unittest.expectAsync1(((response) {
checkListDelegatesResponse(response);
})));
});
});
unittest.group('resource-UsersSettingsFiltersResourceApi', () {
unittest.test('method--create', () {
var mock = HttpServerMock();
api.UsersSettingsFiltersResourceApi res =
api.GmailApi(mock).users.settings.filters;
var arg_request = buildFilter();
var arg_userId = 'foo';
var arg_$fields = 'foo';
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var obj = api.Filter.fromJson(json);
checkFilter(obj);
var path = (req.url).path;
var pathOffset = 0;
core.int index;
core.String subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(path.substring(pathOffset, pathOffset + 15),
unittest.equals("gmail/v1/users/"));
pathOffset += 15;
index = path.indexOf('/settings/filters', pathOffset);
unittest.expect(index >= 0, unittest.isTrue);
subPart =
core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
pathOffset = index;
unittest.expect(subPart, unittest.equals('$arg_userId'));
unittest.expect(path.substring(pathOffset, pathOffset + 17),
unittest.equals("/settings/filters"));
pathOffset += 17;
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
if (query.isNotEmpty) {
for (var part in query.split('&')) {
var keyValue = part.split('=');
addQueryParam(
core.Uri.decodeQueryComponent(keyValue[0]),
core.Uri.decodeQueryComponent(keyValue[1]),
);
}
}
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
'content-type': 'application/json; charset=utf-8',
};
var resp = convert.json.encode(buildFilter());
return async.Future.value(stringResponse(200, h, resp));
}), true);
res
.create(arg_request, arg_userId, $fields: arg_$fields)
.then(unittest.expectAsync1(((response) {
checkFilter(response);
})));
});
unittest.test('method--delete', () {
var mock = HttpServerMock();
api.UsersSettingsFiltersResourceApi res =
api.GmailApi(mock).users.settings.filters;
var arg_userId = 'foo';
var arg_id = 'foo';
var arg_$fields = 'foo';
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var path = (req.url).path;
var pathOffset = 0;
core.int index;
core.String subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(path.substring(pathOffset, pathOffset + 15),
unittest.equals("gmail/v1/users/"));
pathOffset += 15;
index = path.indexOf('/settings/filters/', pathOffset);
unittest.expect(index >= 0, unittest.isTrue);
subPart =
core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
pathOffset = index;
unittest.expect(subPart, unittest.equals('$arg_userId'));
unittest.expect(path.substring(pathOffset, pathOffset + 18),
unittest.equals("/settings/filters/"));
pathOffset += 18;
subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset));
pathOffset = path.length;
unittest.expect(subPart, unittest.equals('$arg_id'));
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
if (query.isNotEmpty) {
for (var part in query.split('&')) {
var keyValue = part.split('=');
addQueryParam(
core.Uri.decodeQueryComponent(keyValue[0]),
core.Uri.decodeQueryComponent(keyValue[1]),
);
}
}
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
'content-type': 'application/json; charset=utf-8',
};
var resp = '';
return async.Future.value(stringResponse(200, h, resp));
}), true);
res
.delete(arg_userId, arg_id, $fields: arg_$fields)
.then(unittest.expectAsync1((_) {}));
});
unittest.test('method--get', () {
var mock = HttpServerMock();
api.UsersSettingsFiltersResourceApi res =
api.GmailApi(mock).users.settings.filters;
var arg_userId = 'foo';
var arg_id = 'foo';
var arg_$fields = 'foo';
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var path = (req.url).path;
var pathOffset = 0;
core.int index;
core.String subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(path.substring(pathOffset, pathOffset + 15),
unittest.equals("gmail/v1/users/"));
pathOffset += 15;
index = path.indexOf('/settings/filters/', pathOffset);
unittest.expect(index >= 0, unittest.isTrue);
subPart =
core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
pathOffset = index;
unittest.expect(subPart, unittest.equals('$arg_userId'));
unittest.expect(path.substring(pathOffset, pathOffset + 18),
unittest.equals("/settings/filters/"));
pathOffset += 18;
subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset));
pathOffset = path.length;
unittest.expect(subPart, unittest.equals('$arg_id'));
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
if (query.isNotEmpty) {
for (var part in query.split('&')) {
var keyValue = part.split('=');
addQueryParam(
core.Uri.decodeQueryComponent(keyValue[0]),
core.Uri.decodeQueryComponent(keyValue[1]),
);
}
}
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
'content-type': 'application/json; charset=utf-8',
};
var resp = convert.json.encode(buildFilter());
return async.Future.value(stringResponse(200, h, resp));
}), true);
res
.get(arg_userId, arg_id, $fields: arg_$fields)
.then(unittest.expectAsync1(((response) {
checkFilter(response);
})));
});
unittest.test('method--list', () {
var mock = HttpServerMock();
api.UsersSettingsFiltersResourceApi res =
api.GmailApi(mock).users.settings.filters;
var arg_userId = 'foo';
var arg_$fields = 'foo';
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var path = (req.url).path;
var pathOffset = 0;
core.int index;
core.String subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(path.substring(pathOffset, pathOffset + 15),
unittest.equals("gmail/v1/users/"));
pathOffset += 15;
index = path.indexOf('/settings/filters', pathOffset);
unittest.expect(index >= 0, unittest.isTrue);
subPart =
core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
pathOffset = index;
unittest.expect(subPart, unittest.equals('$arg_userId'));
unittest.expect(path.substring(pathOffset, pathOffset + 17),
unittest.equals("/settings/filters"));
pathOffset += 17;
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
if (query.isNotEmpty) {
for (var part in query.split('&')) {
var keyValue = part.split('=');
addQueryParam(
core.Uri.decodeQueryComponent(keyValue[0]),
core.Uri.decodeQueryComponent(keyValue[1]),
);
}
}
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
'content-type': 'application/json; charset=utf-8',
};
var resp = convert.json.encode(buildListFiltersResponse());
return async.Future.value(stringResponse(200, h, resp));
}), true);
res
.list(arg_userId, $fields: arg_$fields)
.then(unittest.expectAsync1(((response) {
checkListFiltersResponse(response);
})));
});
});
unittest.group('resource-UsersSettingsForwardingAddressesResourceApi', () {
unittest.test('method--create', () {
var mock = HttpServerMock();
api.UsersSettingsForwardingAddressesResourceApi res =
api.GmailApi(mock).users.settings.forwardingAddresses;
var arg_request = buildForwardingAddress();
var arg_userId = 'foo';
var arg_$fields = 'foo';
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var obj = api.ForwardingAddress.fromJson(json);
checkForwardingAddress(obj);
var path = (req.url).path;
var pathOffset = 0;
core.int index;
core.String subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(path.substring(pathOffset, pathOffset + 15),
unittest.equals("gmail/v1/users/"));
pathOffset += 15;
index = path.indexOf('/settings/forwardingAddresses', pathOffset);
unittest.expect(index >= 0, unittest.isTrue);
subPart =
core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
pathOffset = index;
unittest.expect(subPart, unittest.equals('$arg_userId'));
unittest.expect(path.substring(pathOffset, pathOffset + 29),
unittest.equals("/settings/forwardingAddresses"));
pathOffset += 29;
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
if (query.isNotEmpty) {
for (var part in query.split('&')) {
var keyValue = part.split('=');
addQueryParam(
core.Uri.decodeQueryComponent(keyValue[0]),
core.Uri.decodeQueryComponent(keyValue[1]),
);
}
}
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
'content-type': 'application/json; charset=utf-8',
};
var resp = convert.json.encode(buildForwardingAddress());
return async.Future.value(stringResponse(200, h, resp));
}), true);
res
.create(arg_request, arg_userId, $fields: arg_$fields)
.then(unittest.expectAsync1(((response) {
checkForwardingAddress(response);
})));
});
unittest.test('method--delete', () {
var mock = HttpServerMock();
api.UsersSettingsForwardingAddressesResourceApi res =
api.GmailApi(mock).users.settings.forwardingAddresses;
var arg_userId = 'foo';
var arg_forwardingEmail = 'foo';
var arg_$fields = 'foo';
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var path = (req.url).path;
var pathOffset = 0;
core.int index;
core.String subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(path.substring(pathOffset, pathOffset + 15),
unittest.equals("gmail/v1/users/"));
pathOffset += 15;
index = path.indexOf('/settings/forwardingAddresses/', pathOffset);
unittest.expect(index >= 0, unittest.isTrue);
subPart =
core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
pathOffset = index;
unittest.expect(subPart, unittest.equals('$arg_userId'));
unittest.expect(path.substring(pathOffset, pathOffset + 30),
unittest.equals("/settings/forwardingAddresses/"));
pathOffset += 30;
subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset));
pathOffset = path.length;
unittest.expect(subPart, unittest.equals('$arg_forwardingEmail'));
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
if (query.isNotEmpty) {
for (var part in query.split('&')) {
var keyValue = part.split('=');
addQueryParam(
core.Uri.decodeQueryComponent(keyValue[0]),
core.Uri.decodeQueryComponent(keyValue[1]),
);
}
}
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
'content-type': 'application/json; charset=utf-8',
};
var resp = '';
return async.Future.value(stringResponse(200, h, resp));
}), true);
res
.delete(arg_userId, arg_forwardingEmail, $fields: arg_$fields)
.then(unittest.expectAsync1((_) {}));
});
unittest.test('method--get', () {
var mock = HttpServerMock();
api.UsersSettingsForwardingAddressesResourceApi res =
api.GmailApi(mock).users.settings.forwardingAddresses;
var arg_userId = 'foo';
var arg_forwardingEmail = 'foo';
var arg_$fields = 'foo';
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var path = (req.url).path;
var pathOffset = 0;
core.int index;
core.String subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(path.substring(pathOffset, pathOffset + 15),
unittest.equals("gmail/v1/users/"));
pathOffset += 15;
index = path.indexOf('/settings/forwardingAddresses/', pathOffset);
unittest.expect(index >= 0, unittest.isTrue);
subPart =
core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
pathOffset = index;
unittest.expect(subPart, unittest.equals('$arg_userId'));
unittest.expect(path.substring(pathOffset, pathOffset + 30),
unittest.equals("/settings/forwardingAddresses/"));
pathOffset += 30;
subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset));
pathOffset = path.length;
unittest.expect(subPart, unittest.equals('$arg_forwardingEmail'));
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
if (query.isNotEmpty) {
for (var part in query.split('&')) {
var keyValue = part.split('=');
addQueryParam(
core.Uri.decodeQueryComponent(keyValue[0]),
core.Uri.decodeQueryComponent(keyValue[1]),
);
}
}
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
'content-type': 'application/json; charset=utf-8',
};
var resp = convert.json.encode(buildForwardingAddress());
return async.Future.value(stringResponse(200, h, resp));
}), true);
res
.get(arg_userId, arg_forwardingEmail, $fields: arg_$fields)
.then(unittest.expectAsync1(((response) {
checkForwardingAddress(response);
})));
});
unittest.test('method--list', () {
var mock = HttpServerMock();
api.UsersSettingsForwardingAddressesResourceApi res =
api.GmailApi(mock).users.settings.forwardingAddresses;
var arg_userId = 'foo';
var arg_$fields = 'foo';
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var path = (req.url).path;
var pathOffset = 0;
core.int index;
core.String subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(path.substring(pathOffset, pathOffset + 15),
unittest.equals("gmail/v1/users/"));
pathOffset += 15;
index = path.indexOf('/settings/forwardingAddresses', pathOffset);
unittest.expect(index >= 0, unittest.isTrue);
subPart =
core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
pathOffset = index;
unittest.expect(subPart, unittest.equals('$arg_userId'));
unittest.expect(path.substring(pathOffset, pathOffset + 29),
unittest.equals("/settings/forwardingAddresses"));
pathOffset += 29;
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
if (query.isNotEmpty) {
for (var part in query.split('&')) {
var keyValue = part.split('=');
addQueryParam(
core.Uri.decodeQueryComponent(keyValue[0]),
core.Uri.decodeQueryComponent(keyValue[1]),
);
}
}
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
'content-type': 'application/json; charset=utf-8',
};
var resp = convert.json.encode(buildListForwardingAddressesResponse());
return async.Future.value(stringResponse(200, h, resp));
}), true);
res
.list(arg_userId, $fields: arg_$fields)
.then(unittest.expectAsync1(((response) {
checkListForwardingAddressesResponse(response);
})));
});
});
unittest.group('resource-UsersSettingsSendAsResourceApi', () {
unittest.test('method--create', () {
var mock = HttpServerMock();
api.UsersSettingsSendAsResourceApi res =
api.GmailApi(mock).users.settings.sendAs;
var arg_request = buildSendAs();
var arg_userId = 'foo';
var arg_$fields = 'foo';
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var obj = api.SendAs.fromJson(json);
checkSendAs(obj);
var path = (req.url).path;
var pathOffset = 0;
core.int index;
core.String subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(path.substring(pathOffset, pathOffset + 15),
unittest.equals("gmail/v1/users/"));
pathOffset += 15;
index = path.indexOf('/settings/sendAs', pathOffset);
unittest.expect(index >= 0, unittest.isTrue);
subPart =
core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
pathOffset = index;
unittest.expect(subPart, unittest.equals('$arg_userId'));
unittest.expect(path.substring(pathOffset, pathOffset + 16),
unittest.equals("/settings/sendAs"));
pathOffset += 16;
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
if (query.isNotEmpty) {
for (var part in query.split('&')) {
var keyValue = part.split('=');
addQueryParam(
core.Uri.decodeQueryComponent(keyValue[0]),
core.Uri.decodeQueryComponent(keyValue[1]),
);
}
}
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
'content-type': 'application/json; charset=utf-8',
};
var resp = convert.json.encode(buildSendAs());
return async.Future.value(stringResponse(200, h, resp));
}), true);
res
.create(arg_request, arg_userId, $fields: arg_$fields)
.then(unittest.expectAsync1(((response) {
checkSendAs(response);
})));
});
unittest.test('method--delete', () {
var mock = HttpServerMock();
api.UsersSettingsSendAsResourceApi res =
api.GmailApi(mock).users.settings.sendAs;
var arg_userId = 'foo';
var arg_sendAsEmail = 'foo';
var arg_$fields = 'foo';
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var path = (req.url).path;
var pathOffset = 0;
core.int index;
core.String subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(path.substring(pathOffset, pathOffset + 15),
unittest.equals("gmail/v1/users/"));
pathOffset += 15;
index = path.indexOf('/settings/sendAs/', pathOffset);
unittest.expect(index >= 0, unittest.isTrue);
subPart =
core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
pathOffset = index;
unittest.expect(subPart, unittest.equals('$arg_userId'));
unittest.expect(path.substring(pathOffset, pathOffset + 17),
unittest.equals("/settings/sendAs/"));
pathOffset += 17;
subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset));
pathOffset = path.length;
unittest.expect(subPart, unittest.equals('$arg_sendAsEmail'));
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
if (query.isNotEmpty) {
for (var part in query.split('&')) {
var keyValue = part.split('=');
addQueryParam(
core.Uri.decodeQueryComponent(keyValue[0]),
core.Uri.decodeQueryComponent(keyValue[1]),
);
}
}
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
'content-type': 'application/json; charset=utf-8',
};
var resp = '';
return async.Future.value(stringResponse(200, h, resp));
}), true);
res
.delete(arg_userId, arg_sendAsEmail, $fields: arg_$fields)
.then(unittest.expectAsync1((_) {}));
});
unittest.test('method--get', () {
var mock = HttpServerMock();
api.UsersSettingsSendAsResourceApi res =
api.GmailApi(mock).users.settings.sendAs;
var arg_userId = 'foo';
var arg_sendAsEmail = 'foo';
var arg_$fields = 'foo';
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var path = (req.url).path;
var pathOffset = 0;
core.int index;
core.String subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(path.substring(pathOffset, pathOffset + 15),
unittest.equals("gmail/v1/users/"));
pathOffset += 15;
index = path.indexOf('/settings/sendAs/', pathOffset);
unittest.expect(index >= 0, unittest.isTrue);
subPart =
core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
pathOffset = index;
unittest.expect(subPart, unittest.equals('$arg_userId'));
unittest.expect(path.substring(pathOffset, pathOffset + 17),
unittest.equals("/settings/sendAs/"));
pathOffset += 17;
subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset));
pathOffset = path.length;
unittest.expect(subPart, unittest.equals('$arg_sendAsEmail'));
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
if (query.isNotEmpty) {
for (var part in query.split('&')) {
var keyValue = part.split('=');
addQueryParam(
core.Uri.decodeQueryComponent(keyValue[0]),
core.Uri.decodeQueryComponent(keyValue[1]),
);
}
}
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
'content-type': 'application/json; charset=utf-8',
};
var resp = convert.json.encode(buildSendAs());
return async.Future.value(stringResponse(200, h, resp));
}), true);
res
.get(arg_userId, arg_sendAsEmail, $fields: arg_$fields)
.then(unittest.expectAsync1(((response) {
checkSendAs(response);
})));
});
unittest.test('method--list', () {
var mock = HttpServerMock();
api.UsersSettingsSendAsResourceApi res =
api.GmailApi(mock).users.settings.sendAs;
var arg_userId = 'foo';
var arg_$fields = 'foo';
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var path = (req.url).path;
var pathOffset = 0;
core.int index;
core.String subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(path.substring(pathOffset, pathOffset + 15),
unittest.equals("gmail/v1/users/"));
pathOffset += 15;
index = path.indexOf('/settings/sendAs', pathOffset);
unittest.expect(index >= 0, unittest.isTrue);
subPart =
core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
pathOffset = index;
unittest.expect(subPart, unittest.equals('$arg_userId'));
unittest.expect(path.substring(pathOffset, pathOffset + 16),
unittest.equals("/settings/sendAs"));
pathOffset += 16;
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
if (query.isNotEmpty) {
for (var part in query.split('&')) {
var keyValue = part.split('=');
addQueryParam(
core.Uri.decodeQueryComponent(keyValue[0]),
core.Uri.decodeQueryComponent(keyValue[1]),
);
}
}
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
'content-type': 'application/json; charset=utf-8',
};
var resp = convert.json.encode(buildListSendAsResponse());
return async.Future.value(stringResponse(200, h, resp));
}), true);
res
.list(arg_userId, $fields: arg_$fields)
.then(unittest.expectAsync1(((response) {
checkListSendAsResponse(response);
})));
});
unittest.test('method--patch', () {
var mock = HttpServerMock();
api.UsersSettingsSendAsResourceApi res =
api.GmailApi(mock).users.settings.sendAs;
var arg_request = buildSendAs();
var arg_userId = 'foo';
var arg_sendAsEmail = 'foo';
var arg_$fields = 'foo';
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var obj = api.SendAs.fromJson(json);
checkSendAs(obj);
var path = (req.url).path;
var pathOffset = 0;
core.int index;
core.String subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(path.substring(pathOffset, pathOffset + 15),
unittest.equals("gmail/v1/users/"));
pathOffset += 15;
index = path.indexOf('/settings/sendAs/', pathOffset);
unittest.expect(index >= 0, unittest.isTrue);
subPart =
core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
pathOffset = index;
unittest.expect(subPart, unittest.equals('$arg_userId'));
unittest.expect(path.substring(pathOffset, pathOffset + 17),
unittest.equals("/settings/sendAs/"));
pathOffset += 17;
subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset));
pathOffset = path.length;
unittest.expect(subPart, unittest.equals('$arg_sendAsEmail'));
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
if (query.isNotEmpty) {
for (var part in query.split('&')) {
var keyValue = part.split('=');
addQueryParam(
core.Uri.decodeQueryComponent(keyValue[0]),
core.Uri.decodeQueryComponent(keyValue[1]),
);
}
}
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
'content-type': 'application/json; charset=utf-8',
};
var resp = convert.json.encode(buildSendAs());
return async.Future.value(stringResponse(200, h, resp));
}), true);
res
.patch(arg_request, arg_userId, arg_sendAsEmail, $fields: arg_$fields)
.then(unittest.expectAsync1(((response) {
checkSendAs(response);
})));
});
unittest.test('method--update', () {
var mock = HttpServerMock();
api.UsersSettingsSendAsResourceApi res =
api.GmailApi(mock).users.settings.sendAs;
var arg_request = buildSendAs();
var arg_userId = 'foo';
var arg_sendAsEmail = 'foo';
var arg_$fields = 'foo';
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var obj = api.SendAs.fromJson(json);
checkSendAs(obj);
var path = (req.url).path;
var pathOffset = 0;
core.int index;
core.String subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(path.substring(pathOffset, pathOffset + 15),
unittest.equals("gmail/v1/users/"));
pathOffset += 15;
index = path.indexOf('/settings/sendAs/', pathOffset);
unittest.expect(index >= 0, unittest.isTrue);
subPart =
core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
pathOffset = index;
unittest.expect(subPart, unittest.equals('$arg_userId'));
unittest.expect(path.substring(pathOffset, pathOffset + 17),
unittest.equals("/settings/sendAs/"));
pathOffset += 17;
subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset));
pathOffset = path.length;
unittest.expect(subPart, unittest.equals('$arg_sendAsEmail'));
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
if (query.isNotEmpty) {
for (var part in query.split('&')) {
var keyValue = part.split('=');
addQueryParam(
core.Uri.decodeQueryComponent(keyValue[0]),
core.Uri.decodeQueryComponent(keyValue[1]),
);
}
}
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
'content-type': 'application/json; charset=utf-8',
};
var resp = convert.json.encode(buildSendAs());
return async.Future.value(stringResponse(200, h, resp));
}), true);
res
.update(arg_request, arg_userId, arg_sendAsEmail,
$fields: arg_$fields)
.then(unittest.expectAsync1(((response) {
checkSendAs(response);
})));
});
unittest.test('method--verify', () {
var mock = HttpServerMock();
api.UsersSettingsSendAsResourceApi res =
api.GmailApi(mock).users.settings.sendAs;
var arg_userId = 'foo';
var arg_sendAsEmail = 'foo';
var arg_$fields = 'foo';
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var path = (req.url).path;
var pathOffset = 0;
core.int index;
core.String subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(path.substring(pathOffset, pathOffset + 15),
unittest.equals("gmail/v1/users/"));
pathOffset += 15;
index = path.indexOf('/settings/sendAs/', pathOffset);
unittest.expect(index >= 0, unittest.isTrue);
subPart =
core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
pathOffset = index;
unittest.expect(subPart, unittest.equals('$arg_userId'));
unittest.expect(path.substring(pathOffset, pathOffset + 17),
unittest.equals("/settings/sendAs/"));
pathOffset += 17;
index = path.indexOf('/verify', pathOffset);
unittest.expect(index >= 0, unittest.isTrue);
subPart =
core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
pathOffset = index;
unittest.expect(subPart, unittest.equals('$arg_sendAsEmail'));
unittest.expect(path.substring(pathOffset, pathOffset + 7),
unittest.equals("/verify"));
pathOffset += 7;
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
if (query.isNotEmpty) {
for (var part in query.split('&')) {
var keyValue = part.split('=');
addQueryParam(
core.Uri.decodeQueryComponent(keyValue[0]),
core.Uri.decodeQueryComponent(keyValue[1]),
);
}
}
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
'content-type': 'application/json; charset=utf-8',
};
var resp = '';
return async.Future.value(stringResponse(200, h, resp));
}), true);
res
.verify(arg_userId, arg_sendAsEmail, $fields: arg_$fields)
.then(unittest.expectAsync1((_) {}));
});
});
unittest.group('resource-UsersSettingsSendAsSmimeInfoResourceApi', () {
unittest.test('method--delete', () {
var mock = HttpServerMock();
api.UsersSettingsSendAsSmimeInfoResourceApi res =
api.GmailApi(mock).users.settings.sendAs.smimeInfo;
var arg_userId = 'foo';
var arg_sendAsEmail = 'foo';
var arg_id = 'foo';
var arg_$fields = 'foo';
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var path = (req.url).path;
var pathOffset = 0;
core.int index;
core.String subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(path.substring(pathOffset, pathOffset + 15),
unittest.equals("gmail/v1/users/"));
pathOffset += 15;
index = path.indexOf('/settings/sendAs/', pathOffset);
unittest.expect(index >= 0, unittest.isTrue);
subPart =
core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
pathOffset = index;
unittest.expect(subPart, unittest.equals('$arg_userId'));
unittest.expect(path.substring(pathOffset, pathOffset + 17),
unittest.equals("/settings/sendAs/"));
pathOffset += 17;
index = path.indexOf('/smimeInfo/', pathOffset);
unittest.expect(index >= 0, unittest.isTrue);
subPart =
core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
pathOffset = index;
unittest.expect(subPart, unittest.equals('$arg_sendAsEmail'));
unittest.expect(path.substring(pathOffset, pathOffset + 11),
unittest.equals("/smimeInfo/"));
pathOffset += 11;
subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset));
pathOffset = path.length;
unittest.expect(subPart, unittest.equals('$arg_id'));
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
if (query.isNotEmpty) {
for (var part in query.split('&')) {
var keyValue = part.split('=');
addQueryParam(
core.Uri.decodeQueryComponent(keyValue[0]),
core.Uri.decodeQueryComponent(keyValue[1]),
);
}
}
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
'content-type': 'application/json; charset=utf-8',
};
var resp = '';
return async.Future.value(stringResponse(200, h, resp));
}), true);
res
.delete(arg_userId, arg_sendAsEmail, arg_id, $fields: arg_$fields)
.then(unittest.expectAsync1((_) {}));
});
unittest.test('method--get', () {
var mock = HttpServerMock();
api.UsersSettingsSendAsSmimeInfoResourceApi res =
api.GmailApi(mock).users.settings.sendAs.smimeInfo;
var arg_userId = 'foo';
var arg_sendAsEmail = 'foo';
var arg_id = 'foo';
var arg_$fields = 'foo';
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var path = (req.url).path;
var pathOffset = 0;
core.int index;
core.String subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(path.substring(pathOffset, pathOffset + 15),
unittest.equals("gmail/v1/users/"));
pathOffset += 15;
index = path.indexOf('/settings/sendAs/', pathOffset);
unittest.expect(index >= 0, unittest.isTrue);
subPart =
core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
pathOffset = index;
unittest.expect(subPart, unittest.equals('$arg_userId'));
unittest.expect(path.substring(pathOffset, pathOffset + 17),
unittest.equals("/settings/sendAs/"));
pathOffset += 17;
index = path.indexOf('/smimeInfo/', pathOffset);
unittest.expect(index >= 0, unittest.isTrue);
subPart =
core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
pathOffset = index;
unittest.expect(subPart, unittest.equals('$arg_sendAsEmail'));
unittest.expect(path.substring(pathOffset, pathOffset + 11),
unittest.equals("/smimeInfo/"));
pathOffset += 11;
subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset));
pathOffset = path.length;
unittest.expect(subPart, unittest.equals('$arg_id'));
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
if (query.isNotEmpty) {
for (var part in query.split('&')) {
var keyValue = part.split('=');
addQueryParam(
core.Uri.decodeQueryComponent(keyValue[0]),
core.Uri.decodeQueryComponent(keyValue[1]),
);
}
}
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
'content-type': 'application/json; charset=utf-8',
};
var resp = convert.json.encode(buildSmimeInfo());
return async.Future.value(stringResponse(200, h, resp));
}), true);
res
.get(arg_userId, arg_sendAsEmail, arg_id, $fields: arg_$fields)
.then(unittest.expectAsync1(((response) {
checkSmimeInfo(response);
})));
});
unittest.test('method--insert', () {
var mock = HttpServerMock();
api.UsersSettingsSendAsSmimeInfoResourceApi res =
api.GmailApi(mock).users.settings.sendAs.smimeInfo;
var arg_request = buildSmimeInfo();
var arg_userId = 'foo';
var arg_sendAsEmail = 'foo';
var arg_$fields = 'foo';
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var obj = api.SmimeInfo.fromJson(json);
checkSmimeInfo(obj);
var path = (req.url).path;
var pathOffset = 0;
core.int index;
core.String subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(path.substring(pathOffset, pathOffset + 15),
unittest.equals("gmail/v1/users/"));
pathOffset += 15;
index = path.indexOf('/settings/sendAs/', pathOffset);
unittest.expect(index >= 0, unittest.isTrue);
subPart =
core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
pathOffset = index;
unittest.expect(subPart, unittest.equals('$arg_userId'));
unittest.expect(path.substring(pathOffset, pathOffset + 17),
unittest.equals("/settings/sendAs/"));
pathOffset += 17;
index = path.indexOf('/smimeInfo', pathOffset);
unittest.expect(index >= 0, unittest.isTrue);
subPart =
core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
pathOffset = index;
unittest.expect(subPart, unittest.equals('$arg_sendAsEmail'));
unittest.expect(path.substring(pathOffset, pathOffset + 10),
unittest.equals("/smimeInfo"));
pathOffset += 10;
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
if (query.isNotEmpty) {
for (var part in query.split('&')) {
var keyValue = part.split('=');
addQueryParam(
core.Uri.decodeQueryComponent(keyValue[0]),
core.Uri.decodeQueryComponent(keyValue[1]),
);
}
}
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
'content-type': 'application/json; charset=utf-8',
};
var resp = convert.json.encode(buildSmimeInfo());
return async.Future.value(stringResponse(200, h, resp));
}), true);
res
.insert(arg_request, arg_userId, arg_sendAsEmail,
$fields: arg_$fields)
.then(unittest.expectAsync1(((response) {
checkSmimeInfo(response);
})));
});
unittest.test('method--list', () {
var mock = HttpServerMock();
api.UsersSettingsSendAsSmimeInfoResourceApi res =
api.GmailApi(mock).users.settings.sendAs.smimeInfo;
var arg_userId = 'foo';
var arg_sendAsEmail = 'foo';
var arg_$fields = 'foo';
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var path = (req.url).path;
var pathOffset = 0;
core.int index;
core.String subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(path.substring(pathOffset, pathOffset + 15),
unittest.equals("gmail/v1/users/"));
pathOffset += 15;
index = path.indexOf('/settings/sendAs/', pathOffset);
unittest.expect(index >= 0, unittest.isTrue);
subPart =
core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
pathOffset = index;
unittest.expect(subPart, unittest.equals('$arg_userId'));
unittest.expect(path.substring(pathOffset, pathOffset + 17),
unittest.equals("/settings/sendAs/"));
pathOffset += 17;
index = path.indexOf('/smimeInfo', pathOffset);
unittest.expect(index >= 0, unittest.isTrue);
subPart =
core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
pathOffset = index;
unittest.expect(subPart, unittest.equals('$arg_sendAsEmail'));
unittest.expect(path.substring(pathOffset, pathOffset + 10),
unittest.equals("/smimeInfo"));
pathOffset += 10;
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
if (query.isNotEmpty) {
for (var part in query.split('&')) {
var keyValue = part.split('=');
addQueryParam(
core.Uri.decodeQueryComponent(keyValue[0]),
core.Uri.decodeQueryComponent(keyValue[1]),
);
}
}
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
'content-type': 'application/json; charset=utf-8',
};
var resp = convert.json.encode(buildListSmimeInfoResponse());
return async.Future.value(stringResponse(200, h, resp));
}), true);
res
.list(arg_userId, arg_sendAsEmail, $fields: arg_$fields)
.then(unittest.expectAsync1(((response) {
checkListSmimeInfoResponse(response);
})));
});
unittest.test('method--setDefault', () {
var mock = HttpServerMock();
api.UsersSettingsSendAsSmimeInfoResourceApi res =
api.GmailApi(mock).users.settings.sendAs.smimeInfo;
var arg_userId = 'foo';
var arg_sendAsEmail = 'foo';
var arg_id = 'foo';
var arg_$fields = 'foo';
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var path = (req.url).path;
var pathOffset = 0;
core.int index;
core.String subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(path.substring(pathOffset, pathOffset + 15),
unittest.equals("gmail/v1/users/"));
pathOffset += 15;
index = path.indexOf('/settings/sendAs/', pathOffset);
unittest.expect(index >= 0, unittest.isTrue);
subPart =
core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
pathOffset = index;
unittest.expect(subPart, unittest.equals('$arg_userId'));
unittest.expect(path.substring(pathOffset, pathOffset + 17),
unittest.equals("/settings/sendAs/"));
pathOffset += 17;
index = path.indexOf('/smimeInfo/', pathOffset);
unittest.expect(index >= 0, unittest.isTrue);
subPart =
core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
pathOffset = index;
unittest.expect(subPart, unittest.equals('$arg_sendAsEmail'));
unittest.expect(path.substring(pathOffset, pathOffset + 11),
unittest.equals("/smimeInfo/"));
pathOffset += 11;
index = path.indexOf('/setDefault', pathOffset);
unittest.expect(index >= 0, unittest.isTrue);
subPart =
core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
pathOffset = index;
unittest.expect(subPart, unittest.equals('$arg_id'));
unittest.expect(path.substring(pathOffset, pathOffset + 11),
unittest.equals("/setDefault"));
pathOffset += 11;
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
if (query.isNotEmpty) {
for (var part in query.split('&')) {
var keyValue = part.split('=');
addQueryParam(
core.Uri.decodeQueryComponent(keyValue[0]),
core.Uri.decodeQueryComponent(keyValue[1]),
);
}
}
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
'content-type': 'application/json; charset=utf-8',
};
var resp = '';
return async.Future.value(stringResponse(200, h, resp));
}), true);
res
.setDefault(arg_userId, arg_sendAsEmail, arg_id, $fields: arg_$fields)
.then(unittest.expectAsync1((_) {}));
});
});
unittest.group('resource-UsersThreadsResourceApi', () {
unittest.test('method--delete', () {
var mock = HttpServerMock();
api.UsersThreadsResourceApi res = api.GmailApi(mock).users.threads;
var arg_userId = 'foo';
var arg_id = 'foo';
var arg_$fields = 'foo';
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var path = (req.url).path;
var pathOffset = 0;
core.int index;
core.String subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(path.substring(pathOffset, pathOffset + 15),
unittest.equals("gmail/v1/users/"));
pathOffset += 15;
index = path.indexOf('/threads/', pathOffset);
unittest.expect(index >= 0, unittest.isTrue);
subPart =
core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
pathOffset = index;
unittest.expect(subPart, unittest.equals('$arg_userId'));
unittest.expect(path.substring(pathOffset, pathOffset + 9),
unittest.equals("/threads/"));
pathOffset += 9;
subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset));
pathOffset = path.length;
unittest.expect(subPart, unittest.equals('$arg_id'));
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
if (query.isNotEmpty) {
for (var part in query.split('&')) {
var keyValue = part.split('=');
addQueryParam(
core.Uri.decodeQueryComponent(keyValue[0]),
core.Uri.decodeQueryComponent(keyValue[1]),
);
}
}
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
'content-type': 'application/json; charset=utf-8',
};
var resp = '';
return async.Future.value(stringResponse(200, h, resp));
}), true);
res
.delete(arg_userId, arg_id, $fields: arg_$fields)
.then(unittest.expectAsync1((_) {}));
});
unittest.test('method--get', () {
var mock = HttpServerMock();
api.UsersThreadsResourceApi res = api.GmailApi(mock).users.threads;
var arg_userId = 'foo';
var arg_id = 'foo';
var arg_format = 'foo';
var arg_metadataHeaders = buildUnnamed3208();
var arg_$fields = 'foo';
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var path = (req.url).path;
var pathOffset = 0;
core.int index;
core.String subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(path.substring(pathOffset, pathOffset + 15),
unittest.equals("gmail/v1/users/"));
pathOffset += 15;
index = path.indexOf('/threads/', pathOffset);
unittest.expect(index >= 0, unittest.isTrue);
subPart =
core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
pathOffset = index;
unittest.expect(subPart, unittest.equals('$arg_userId'));
unittest.expect(path.substring(pathOffset, pathOffset + 9),
unittest.equals("/threads/"));
pathOffset += 9;
subPart = core.Uri.decodeQueryComponent(path.substring(pathOffset));
pathOffset = path.length;
unittest.expect(subPart, unittest.equals('$arg_id'));
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
if (query.isNotEmpty) {
for (var part in query.split('&')) {
var keyValue = part.split('=');
addQueryParam(
core.Uri.decodeQueryComponent(keyValue[0]),
core.Uri.decodeQueryComponent(keyValue[1]),
);
}
}
unittest.expect(queryMap["format"].first, unittest.equals(arg_format));
unittest.expect(
queryMap["metadataHeaders"], unittest.equals(arg_metadataHeaders));
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
'content-type': 'application/json; charset=utf-8',
};
var resp = convert.json.encode(buildThread());
return async.Future.value(stringResponse(200, h, resp));
}), true);
res
.get(arg_userId, arg_id,
format: arg_format,
metadataHeaders: arg_metadataHeaders,
$fields: arg_$fields)
.then(unittest.expectAsync1(((response) {
checkThread(response);
})));
});
unittest.test('method--list', () {
var mock = HttpServerMock();
api.UsersThreadsResourceApi res = api.GmailApi(mock).users.threads;
var arg_userId = 'foo';
var arg_includeSpamTrash = true;
var arg_labelIds = buildUnnamed3209();
var arg_maxResults = 42;
var arg_pageToken = 'foo';
var arg_q = 'foo';
var arg_$fields = 'foo';
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var path = (req.url).path;
var pathOffset = 0;
core.int index;
core.String subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(path.substring(pathOffset, pathOffset + 15),
unittest.equals("gmail/v1/users/"));
pathOffset += 15;
index = path.indexOf('/threads', pathOffset);
unittest.expect(index >= 0, unittest.isTrue);
subPart =
core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
pathOffset = index;
unittest.expect(subPart, unittest.equals('$arg_userId'));
unittest.expect(path.substring(pathOffset, pathOffset + 8),
unittest.equals("/threads"));
pathOffset += 8;
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
if (query.isNotEmpty) {
for (var part in query.split('&')) {
var keyValue = part.split('=');
addQueryParam(
core.Uri.decodeQueryComponent(keyValue[0]),
core.Uri.decodeQueryComponent(keyValue[1]),
);
}
}
unittest.expect(queryMap["includeSpamTrash"].first,
unittest.equals("$arg_includeSpamTrash"));
unittest.expect(queryMap["labelIds"], unittest.equals(arg_labelIds));
unittest.expect(core.int.parse(queryMap["maxResults"].first),
unittest.equals(arg_maxResults));
unittest.expect(
queryMap["pageToken"].first, unittest.equals(arg_pageToken));
unittest.expect(queryMap["q"].first, unittest.equals(arg_q));
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
'content-type': 'application/json; charset=utf-8',
};
var resp = convert.json.encode(buildListThreadsResponse());
return async.Future.value(stringResponse(200, h, resp));
}), true);
res
.list(arg_userId,
includeSpamTrash: arg_includeSpamTrash,
labelIds: arg_labelIds,
maxResults: arg_maxResults,
pageToken: arg_pageToken,
q: arg_q,
$fields: arg_$fields)
.then(unittest.expectAsync1(((response) {
checkListThreadsResponse(response);
})));
});
unittest.test('method--modify', () {
var mock = HttpServerMock();
api.UsersThreadsResourceApi res = api.GmailApi(mock).users.threads;
var arg_request = buildModifyThreadRequest();
var arg_userId = 'foo';
var arg_id = 'foo';
var arg_$fields = 'foo';
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var obj = api.ModifyThreadRequest.fromJson(json);
checkModifyThreadRequest(obj);
var path = (req.url).path;
var pathOffset = 0;
core.int index;
core.String subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(path.substring(pathOffset, pathOffset + 15),
unittest.equals("gmail/v1/users/"));
pathOffset += 15;
index = path.indexOf('/threads/', pathOffset);
unittest.expect(index >= 0, unittest.isTrue);
subPart =
core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
pathOffset = index;
unittest.expect(subPart, unittest.equals('$arg_userId'));
unittest.expect(path.substring(pathOffset, pathOffset + 9),
unittest.equals("/threads/"));
pathOffset += 9;
index = path.indexOf('/modify', pathOffset);
unittest.expect(index >= 0, unittest.isTrue);
subPart =
core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
pathOffset = index;
unittest.expect(subPart, unittest.equals('$arg_id'));
unittest.expect(path.substring(pathOffset, pathOffset + 7),
unittest.equals("/modify"));
pathOffset += 7;
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
if (query.isNotEmpty) {
for (var part in query.split('&')) {
var keyValue = part.split('=');
addQueryParam(
core.Uri.decodeQueryComponent(keyValue[0]),
core.Uri.decodeQueryComponent(keyValue[1]),
);
}
}
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
'content-type': 'application/json; charset=utf-8',
};
var resp = convert.json.encode(buildThread());
return async.Future.value(stringResponse(200, h, resp));
}), true);
res
.modify(arg_request, arg_userId, arg_id, $fields: arg_$fields)
.then(unittest.expectAsync1(((response) {
checkThread(response);
})));
});
unittest.test('method--trash', () {
var mock = HttpServerMock();
api.UsersThreadsResourceApi res = api.GmailApi(mock).users.threads;
var arg_userId = 'foo';
var arg_id = 'foo';
var arg_$fields = 'foo';
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var path = (req.url).path;
var pathOffset = 0;
core.int index;
core.String subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(path.substring(pathOffset, pathOffset + 15),
unittest.equals("gmail/v1/users/"));
pathOffset += 15;
index = path.indexOf('/threads/', pathOffset);
unittest.expect(index >= 0, unittest.isTrue);
subPart =
core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
pathOffset = index;
unittest.expect(subPart, unittest.equals('$arg_userId'));
unittest.expect(path.substring(pathOffset, pathOffset + 9),
unittest.equals("/threads/"));
pathOffset += 9;
index = path.indexOf('/trash', pathOffset);
unittest.expect(index >= 0, unittest.isTrue);
subPart =
core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
pathOffset = index;
unittest.expect(subPart, unittest.equals('$arg_id'));
unittest.expect(path.substring(pathOffset, pathOffset + 6),
unittest.equals("/trash"));
pathOffset += 6;
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
if (query.isNotEmpty) {
for (var part in query.split('&')) {
var keyValue = part.split('=');
addQueryParam(
core.Uri.decodeQueryComponent(keyValue[0]),
core.Uri.decodeQueryComponent(keyValue[1]),
);
}
}
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
'content-type': 'application/json; charset=utf-8',
};
var resp = convert.json.encode(buildThread());
return async.Future.value(stringResponse(200, h, resp));
}), true);
res
.trash(arg_userId, arg_id, $fields: arg_$fields)
.then(unittest.expectAsync1(((response) {
checkThread(response);
})));
});
unittest.test('method--untrash', () {
var mock = HttpServerMock();
api.UsersThreadsResourceApi res = api.GmailApi(mock).users.threads;
var arg_userId = 'foo';
var arg_id = 'foo';
var arg_$fields = 'foo';
mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
var path = (req.url).path;
var pathOffset = 0;
core.int index;
core.String subPart;
unittest.expect(
path.substring(pathOffset, pathOffset + 1), unittest.equals("/"));
pathOffset += 1;
unittest.expect(path.substring(pathOffset, pathOffset + 15),
unittest.equals("gmail/v1/users/"));
pathOffset += 15;
index = path.indexOf('/threads/', pathOffset);
unittest.expect(index >= 0, unittest.isTrue);
subPart =
core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
pathOffset = index;
unittest.expect(subPart, unittest.equals('$arg_userId'));
unittest.expect(path.substring(pathOffset, pathOffset + 9),
unittest.equals("/threads/"));
pathOffset += 9;
index = path.indexOf('/untrash', pathOffset);
unittest.expect(index >= 0, unittest.isTrue);
subPart =
core.Uri.decodeQueryComponent(path.substring(pathOffset, index));
pathOffset = index;
unittest.expect(subPart, unittest.equals('$arg_id'));
unittest.expect(path.substring(pathOffset, pathOffset + 8),
unittest.equals("/untrash"));
pathOffset += 8;
var query = (req.url).query;
var queryOffset = 0;
var queryMap = <core.String, core.List<core.String>>{};
void addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v);
if (query.isNotEmpty) {
for (var part in query.split('&')) {
var keyValue = part.split('=');
addQueryParam(
core.Uri.decodeQueryComponent(keyValue[0]),
core.Uri.decodeQueryComponent(keyValue[1]),
);
}
}
unittest.expect(queryMap["fields"].first, unittest.equals(arg_$fields));
var h = {
'content-type': 'application/json; charset=utf-8',
};
var resp = convert.json.encode(buildThread());
return async.Future.value(stringResponse(200, h, resp));
}), true);
res
.untrash(arg_userId, arg_id, $fields: arg_$fields)
.then(unittest.expectAsync1(((response) {
checkThread(response);
})));
});
});
}