Tidy up account info sender mailbox implementation
This finishes conversion from the old approach (primary+aliase list) to the new (a single ordered list). API is simplified a bit, and some convenience properties are added.
This commit is contained in:
parent
9f95a80d65
commit
fa5ecf0c22
12 changed files with 164 additions and 203 deletions
|
|
@ -10,10 +10,10 @@ class Geary.AccountInformationTest : TestCase {
|
|||
|
||||
public AccountInformationTest() {
|
||||
base("Geary.AccountInformationTest");
|
||||
add_test("has_email_address", has_email_address);
|
||||
add_test("test_sender_mailboxes", test_sender_mailboxes);
|
||||
}
|
||||
|
||||
public void has_email_address() throws GLib.Error {
|
||||
public void test_sender_mailboxes() throws GLib.Error {
|
||||
AccountInformation test = new AccountInformation(
|
||||
"test",
|
||||
ServiceProvider.OTHER,
|
||||
|
|
@ -21,24 +21,29 @@ class Geary.AccountInformationTest : TestCase {
|
|||
new MockServiceInformation()
|
||||
);
|
||||
|
||||
test.primary_mailbox = (new RFC822.MailboxAddress(null, "test1@example.com"));
|
||||
test.add_alternate_mailbox(new RFC822.MailboxAddress(null, "test2@example.com"));
|
||||
test.add_alternate_mailbox(new RFC822.MailboxAddress(null, "test3@example.com"));
|
||||
test.append_sender(new RFC822.MailboxAddress(null, "test1@example.com"));
|
||||
assert_false(test.has_sender_aliases);
|
||||
|
||||
test.append_sender(new RFC822.MailboxAddress(null, "test2@example.com"));
|
||||
test.append_sender(new RFC822.MailboxAddress(null, "test3@example.com"));
|
||||
assert_true(test.has_sender_aliases);
|
||||
|
||||
assert_true(test.primary_mailbox.equal_to(
|
||||
new RFC822.MailboxAddress(null, "test1@example.com")));
|
||||
assert_true(
|
||||
test.has_email_address(new RFC822.MailboxAddress(null, "test1@example.com")),
|
||||
test.has_sender_mailbox(new RFC822.MailboxAddress(null, "test1@example.com")),
|
||||
"Primary address not found"
|
||||
);
|
||||
assert_true(
|
||||
test.has_email_address(new RFC822.MailboxAddress(null, "test2@example.com")),
|
||||
test.has_sender_mailbox(new RFC822.MailboxAddress(null, "test2@example.com")),
|
||||
"First alt address not found"
|
||||
);
|
||||
assert_true(
|
||||
test.has_email_address(new RFC822.MailboxAddress(null, "test3@example.com")),
|
||||
test.has_sender_mailbox(new RFC822.MailboxAddress(null, "test3@example.com")),
|
||||
"Second alt address not found"
|
||||
);
|
||||
assert_false(
|
||||
test.has_email_address(new RFC822.MailboxAddress(null, "unknowne@example.com")),
|
||||
test.has_sender_mailbox(new RFC822.MailboxAddress(null, "unknowne@example.com")),
|
||||
"Unknown address found"
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue