In practice, the same mediator is always being used for both services, and by removing it from ServiceInformation we can provide default instances for both IMAP and SMTP, meaning we can load account config before service config, making handling loading for both much tidier.
52 lines
1.8 KiB
Vala
52 lines
1.8 KiB
Vala
/*
|
|
* Copyright 2018 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.
|
|
*/
|
|
|
|
class Geary.AccountInformationTest : TestCase {
|
|
|
|
|
|
public AccountInformationTest() {
|
|
base("Geary.AccountInformationTest");
|
|
add_test("test_sender_mailboxes", test_sender_mailboxes);
|
|
}
|
|
|
|
public void test_sender_mailboxes() throws GLib.Error {
|
|
AccountInformation test = new AccountInformation(
|
|
"test",
|
|
ServiceProvider.OTHER,
|
|
new MockCredentialsMediator(),
|
|
new RFC822.MailboxAddress(null, "test1@example.com")
|
|
);
|
|
|
|
assert_true(test.primary_mailbox.equal_to(
|
|
new RFC822.MailboxAddress(null, "test1@example.com")));
|
|
assert_false(test.has_sender_aliases);
|
|
|
|
test.append_sender(new RFC822.MailboxAddress(null, "test2@example.com"));
|
|
assert_true(test.has_sender_aliases);
|
|
|
|
test.append_sender(new RFC822.MailboxAddress(null, "test3@example.com"));
|
|
assert_true(test.has_sender_aliases);
|
|
|
|
assert_true(
|
|
test.has_sender_mailbox(new RFC822.MailboxAddress(null, "test1@example.com")),
|
|
"Primary address not found"
|
|
);
|
|
assert_true(
|
|
test.has_sender_mailbox(new RFC822.MailboxAddress(null, "test2@example.com")),
|
|
"First alt address not found"
|
|
);
|
|
assert_true(
|
|
test.has_sender_mailbox(new RFC822.MailboxAddress(null, "test3@example.com")),
|
|
"Second alt address not found"
|
|
);
|
|
assert_false(
|
|
test.has_sender_mailbox(new RFC822.MailboxAddress(null, "unknowne@example.com")),
|
|
"Unknown address found"
|
|
);
|
|
}
|
|
|
|
}
|