mirror of
https://github.com/chatmail/core.git
synced 2026-05-02 04:46:29 +03:00
add failing test for receiving authnames
This commit is contained in:
committed by
Alexander Krotov
parent
a31c6d82c9
commit
de52c2da80
@@ -1265,6 +1265,63 @@ mod tests {
|
|||||||
assert!(!contact.is_blocked());
|
assert!(!contact.is_blocked());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_remote_authnames() {
|
||||||
|
let t = dummy_context();
|
||||||
|
|
||||||
|
let (contact_id, sth_modified) = Contact::add_or_lookup(
|
||||||
|
&t.ctx,
|
||||||
|
"bob1",
|
||||||
|
"bob@example.org",
|
||||||
|
Origin::IncomingUnknownFrom,
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
assert!(contact_id > DC_CONTACT_ID_LAST_SPECIAL);
|
||||||
|
assert_eq!(sth_modified, Modifier::Created);
|
||||||
|
let contact = Contact::load_from_db(&t.ctx, contact_id).unwrap();
|
||||||
|
assert_eq!(contact.get_authname(), "bob1");
|
||||||
|
assert_eq!(contact.get_name(), "bob1");
|
||||||
|
assert_eq!(contact.get_display_name(), "bob1");
|
||||||
|
|
||||||
|
let (contact_id, sth_modified) = Contact::add_or_lookup(
|
||||||
|
&t.ctx,
|
||||||
|
"bob2",
|
||||||
|
"bob@example.org",
|
||||||
|
Origin::IncomingUnknownFrom,
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
assert!(contact_id > DC_CONTACT_ID_LAST_SPECIAL);
|
||||||
|
assert_eq!(sth_modified, Modifier::Modified);
|
||||||
|
let contact = Contact::load_from_db(&t.ctx, contact_id).unwrap();
|
||||||
|
assert_eq!(contact.get_authname(), "bob2");
|
||||||
|
assert_eq!(contact.get_name(), "bob2");
|
||||||
|
assert_eq!(contact.get_display_name(), "bob2");
|
||||||
|
|
||||||
|
let (contact_id, sth_modified) =
|
||||||
|
Contact::add_or_lookup(&t.ctx, "bob3", "bob@example.org", Origin::ManuallyCreated)
|
||||||
|
.unwrap();
|
||||||
|
assert!(contact_id > DC_CONTACT_ID_LAST_SPECIAL);
|
||||||
|
assert_eq!(sth_modified, Modifier::Modified);
|
||||||
|
let contact = Contact::load_from_db(&t.ctx, contact_id).unwrap();
|
||||||
|
assert_eq!(contact.get_authname(), "bob2");
|
||||||
|
assert_eq!(contact.get_name(), "bob3");
|
||||||
|
assert_eq!(contact.get_display_name(), "bob3");
|
||||||
|
|
||||||
|
let (contact_id, sth_modified) = Contact::add_or_lookup(
|
||||||
|
&t.ctx,
|
||||||
|
"bob4",
|
||||||
|
"bob@example.org",
|
||||||
|
Origin::IncomingUnknownFrom,
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
assert!(contact_id > DC_CONTACT_ID_LAST_SPECIAL);
|
||||||
|
assert_eq!(sth_modified, Modifier::Modified);
|
||||||
|
let contact = Contact::load_from_db(&t.ctx, contact_id).unwrap();
|
||||||
|
assert_eq!(contact.get_authname(), "bob4");
|
||||||
|
assert_eq!(contact.get_name(), "bob3");
|
||||||
|
assert_eq!(contact.get_display_name(), "bob3");
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_addr_cmp() {
|
fn test_addr_cmp() {
|
||||||
assert!(addr_cmp("AA@AA.ORG", "aa@aa.ORG"));
|
assert!(addr_cmp("AA@AA.ORG", "aa@aa.ORG"));
|
||||||
|
|||||||
Reference in New Issue
Block a user