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

@@ -893,10 +893,7 @@ async fn test_dont_remove_self() -> Result<()> {
let mime_message = MimeMessage::from_bytes(alice, sent.payload.as_bytes(), None)
.await
.unwrap();
assert_eq!(
mime_message.get_header(HeaderDef::ChatGroupPastMembers),
None
);
assert!(!mime_message.header_exists(HeaderDef::ChatGroupPastMembers));
assert_eq!(
mime_message.chat_group_member_timestamps().unwrap().len(),
1 // There is a timestamp for Bob, not for Alice