test: Check headers absense straightforwardly

In the `test` cfg, introduce `MimeMessage::headers_removed` hash set and `header_exists()` function
returning whether the header exists in any part of the parsed message. `get_header()` shouldn't be
used in tests for checking absense of headers because it returns `None` for removed ("ignored")
headers.
This commit is contained in:
iequidoo
2025-04-12 03:58:26 -03:00
committed by iequidoo
parent 0e3277bc5a
commit 49c300d2ac
4 changed files with 61 additions and 25 deletions

View File

@@ -2553,10 +2553,8 @@ async fn test_broadcast() -> Result<()> {
let sent_msg = alice.pop_sent_msg().await;
let msg = bob.parse_msg(&sent_msg).await;
assert!(msg.was_encrypted());
assert!(msg
.get_header(HeaderDef::ChatGroupMemberTimestamps)
.is_none());
assert!(msg.get_header(HeaderDef::AutocryptGossip).is_none());
assert!(!msg.header_exists(HeaderDef::ChatGroupMemberTimestamps));
assert!(!msg.header_exists(HeaderDef::AutocryptGossip));
let msg = bob.recv_msg(&sent_msg).await;
assert_eq!(msg.get_text(), "ola!");
assert_eq!(msg.subject, "Broadcast list");