geary/test/mock/mock-credentials-mediator.vala
Michael Gratton 2030b2dec7 test: Break out engine mock objects into their own name-space
Engine mocks don't need to be in the `Geary` namespace, and including
them there makes it difficult to use them in client tests, so put them
all in their own name-space and corresponding directory.
2020-08-13 19:51:33 +10:00

45 lines
1.5 KiB
Vala

/*
* Copyright 2017 Michael Gratton <mike@vee.net>
*
* This software is licensed under the GNU Lesser General Public License
* (version 2.1 or later). See the COPYING file in this distribution.
*/
public class Mock.CredentialsMediator :
GLib.Object,
Geary.CredentialsMediator,
ValaUnit.TestAssertions,
ValaUnit.MockObject {
protected Gee.Queue<ValaUnit.ExpectedCall> expected {
get; set; default = new Gee.LinkedList<ValaUnit.ExpectedCall>();
}
public virtual async bool load_token(Geary.AccountInformation account,
Geary.ServiceInformation service,
GLib.Cancellable? cancellable)
throws GLib.Error {
return object_call<bool>("load_token", { service, cancellable }, false);
}
/**
* Prompt the user to enter passwords for the given services.
*
* Set the out parameters for the services to the values entered
* by the user (out parameters for services not being prompted for
* are ignored). Return false if the user tried to cancel the
* interaction, or true if they tried to proceed.
*/
public virtual async bool prompt_token(Geary.AccountInformation account,
Geary.ServiceInformation service,
GLib.Cancellable? cancellable)
throws GLib.Error {
return boolean_call(
"prompt_token",
{ account, service, cancellable },
false
);
}
}