2019-06-10 08:43:40 +10:00
|
|
|
/*
|
|
|
|
|
* Copyright 2019 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.
|
|
|
|
|
*/
|
|
|
|
|
|
2020-08-10 16:13:57 +10:00
|
|
|
internal class Mock.ContactStore : GLib.Object,
|
|
|
|
|
Geary.ContactStore, ValaUnit.TestAssertions, ValaUnit.MockObject {
|
2019-06-10 08:43:40 +10:00
|
|
|
|
2020-05-09 16:04:22 +10:00
|
|
|
protected Gee.Queue<ValaUnit.ExpectedCall> expected {
|
|
|
|
|
get; set; default = new Gee.LinkedList<ValaUnit.ExpectedCall>();
|
2019-06-10 08:43:40 +10:00
|
|
|
}
|
|
|
|
|
|
2020-08-10 16:13:57 +10:00
|
|
|
public async Geary.Contact? get_by_rfc822(Geary.RFC822.MailboxAddress address,
|
|
|
|
|
GLib.Cancellable? cancellable)
|
2019-06-10 08:43:40 +10:00
|
|
|
throws GLib.Error {
|
2020-08-10 16:13:57 +10:00
|
|
|
return object_call<Geary.Contact?>(
|
2019-06-12 07:43:02 +10:00
|
|
|
"get_by_rfc822", { address, cancellable }, null
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-10 16:13:57 +10:00
|
|
|
public async Gee.Collection<Geary.Contact> search(string query,
|
|
|
|
|
uint min_importance,
|
|
|
|
|
uint limit,
|
|
|
|
|
GLib.Cancellable? cancellable)
|
2019-06-12 07:43:02 +10:00
|
|
|
throws GLib.Error {
|
2020-08-10 16:13:57 +10:00
|
|
|
return object_call<Gee.Collection<Geary.Contact>>(
|
2019-06-12 07:43:02 +10:00
|
|
|
"search",
|
|
|
|
|
{
|
|
|
|
|
box_arg(query),
|
|
|
|
|
uint_arg(min_importance),
|
|
|
|
|
uint_arg(limit),
|
|
|
|
|
cancellable
|
|
|
|
|
},
|
2020-08-10 16:13:57 +10:00
|
|
|
Gee.Collection.empty<Geary.Contact>()
|
2019-06-12 07:43:02 +10:00
|
|
|
);
|
2019-06-10 08:43:40 +10:00
|
|
|
}
|
|
|
|
|
|
2020-08-10 16:13:57 +10:00
|
|
|
public async void update_contacts(Gee.Collection<Geary.Contact> updated,
|
2019-06-10 08:43:40 +10:00
|
|
|
GLib.Cancellable? cancellable)
|
|
|
|
|
throws GLib.Error {
|
|
|
|
|
void_call("update_contacts", { updated, cancellable });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|