Fix almost all test failures. One of the failures is real, though.

This commit is contained in:
Hocuri
2025-01-06 14:50:40 +01:00
parent 84456e510b
commit 9b7e740926
3 changed files with 9 additions and 8 deletions

View File

@@ -4677,7 +4677,7 @@ mod tests {
{ {
"id": 10, "id": 10,
"type": 100, "type": 100,
"name": "~bob", "name": "bob",
"archived": false, "archived": false,
"param": "", "param": "",
"gossiped_timestamp": 0, "gossiped_timestamp": 0,
@@ -4975,7 +4975,7 @@ mod tests {
// This is the name that will be sent outside. // This is the name that will be sent outside.
assert_eq!(alice_bob_contact.get_authname(), "Bob"); assert_eq!(alice_bob_contact.get_authname(), "Bob");
assert_eq!(alice_bob_contact.get_display_name(), "~robert"); assert_eq!(alice_bob_contact.get_display_name(), "robert");
} }
// Create and promote a group. // Create and promote a group.

View File

@@ -727,7 +727,7 @@ mod tests {
let test_id = Contact::create(&t, "Bob Nickname", "bob@example.org").await?; let test_id = Contact::create(&t, "Bob Nickname", "bob@example.org").await?;
assert_eq!(contact_id, test_id); assert_eq!(contact_id, test_id);
let chat = Chat::load_from_db(&t, chat_id).await?; let chat = Chat::load_from_db(&t, chat_id).await?;
assert_eq!(chat.get_name(), "~Bob Nickname"); assert_eq!(chat.get_name(), "Bob Nickname");
let chats = Chatlist::try_load(&t, 0, Some("bob@example.org"), None).await?; let chats = Chatlist::try_load(&t, 0, Some("bob@example.org"), None).await?;
assert_eq!(chats.len(), 0); // email-addresses are searchable in contacts, not in chats assert_eq!(chats.len(), 0); // email-addresses are searchable in contacts, not in chats
let chats = Chatlist::try_load(&t, 0, Some("Bob Nickname"), None).await?; let chats = Chatlist::try_load(&t, 0, Some("Bob Nickname"), None).await?;

View File

@@ -2110,6 +2110,7 @@ mod tests {
#[tokio::test(flavor = "multi_thread", worker_threads = 2)] #[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_add_or_lookup() { async fn test_add_or_lookup() {
// add some contacts, this also tests add_address_book() // add some contacts, this also tests add_address_book()
// TODO it's unsure whether we should put a ~ in front of these.
let t = TestContext::new().await; let t = TestContext::new().await;
let book = concat!( let book = concat!(
" Name one \n one@eins.org \n", " Name one \n one@eins.org \n",
@@ -2138,7 +2139,7 @@ mod tests {
assert_eq!(contact.get_authname(), "bla foo"); assert_eq!(contact.get_authname(), "bla foo");
assert_eq!(contact.get_display_name(), "~Name one"); assert_eq!(contact.get_display_name(), "~Name one");
assert_eq!(contact.get_addr(), "one@eins.org"); assert_eq!(contact.get_addr(), "one@eins.org");
assert_eq!(contact.get_name_n_addr(), "Name one (one@eins.org)"); assert_eq!(contact.get_name_n_addr(), "~Name one (one@eins.org)");
// modify first added contact // modify first added contact
let (contact_id_test, sth_modified) = Contact::add_or_lookup( let (contact_id_test, sth_modified) = Contact::add_or_lookup(
@@ -2185,7 +2186,7 @@ mod tests {
assert_eq!(contact_id, contact_id_test); assert_eq!(contact_id, contact_id_test);
assert_eq!(sth_modified, Modifier::Modified); assert_eq!(sth_modified, Modifier::Modified);
let contact = Contact::get_by_id(&t, contact_id).await.unwrap(); let contact = Contact::get_by_id(&t, contact_id).await.unwrap();
assert_eq!(contact.get_name_n_addr(), "m. serious (three@drei.sam)"); assert_eq!(contact.get_name_n_addr(), "~m. serious (three@drei.sam)");
assert!(!contact.is_blocked()); assert!(!contact.is_blocked());
// manually edit name of third contact (does not changed authorized name) // manually edit name of third contact (does not changed authorized name)
@@ -2217,9 +2218,9 @@ mod tests {
assert_eq!(sth_modified, Modifier::None); assert_eq!(sth_modified, Modifier::None);
let contact = Contact::get_by_id(&t, contact_id).await.unwrap(); let contact = Contact::get_by_id(&t, contact_id).await.unwrap();
assert_eq!(contact.get_name(), "Wonderland, Alice"); assert_eq!(contact.get_name(), "Wonderland, Alice");
assert_eq!(contact.get_display_name(), "Wonderland, Alice"); assert_eq!(contact.get_display_name(), "~Wonderland, Alice");
assert_eq!(contact.get_addr(), "alice@w.de"); assert_eq!(contact.get_addr(), "alice@w.de");
assert_eq!(contact.get_name_n_addr(), "Wonderland, Alice (alice@w.de)"); assert_eq!(contact.get_name_n_addr(), "~Wonderland, Alice (alice@w.de)");
// check SELF // check SELF
let contact = Contact::get_by_id(&t, ContactId::SELF).await.unwrap(); let contact = Contact::get_by_id(&t, ContactId::SELF).await.unwrap();
@@ -2304,7 +2305,7 @@ mod tests {
) )
.await?; .await?;
let chat_id = t.get_last_msg().await.get_chat_id(); let chat_id = t.get_last_msg().await.get_chat_id();
assert_eq!(Chat::load_from_db(&t, chat_id).await?.name, "Foo Flobby"); assert_eq!(Chat::load_from_db(&t, chat_id).await?.name, "~Foo Flobby");
let chatlist = Chatlist::try_load(&t, 0, Some("Flobbyfoo"), None).await?; let chatlist = Chatlist::try_load(&t, 0, Some("Flobbyfoo"), None).await?;
assert_eq!(chatlist.len(), 0); assert_eq!(chatlist.len(), 0);
let chatlist = Chatlist::try_load(&t, 0, Some("Foo Flobby"), None).await?; let chatlist = Chatlist::try_load(&t, 0, Some("Foo Flobby"), None).await?;