Add `uid` attribute to `imap_content` event data (#114432)

* Add uid to imap event

* Add ´uid´ to tests

* Update test_init.py
pull/114447/head
Luca Angemi 2024-03-29 14:04:24 +00:00 committed by GitHub
parent 5b4452a579
commit 54c5f18aac
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 0 deletions

View File

@ -264,6 +264,7 @@ class ImapDataUpdateCoordinator(DataUpdateCoordinator[int | None]):
"sender": message.sender,
"subject": message.subject,
"headers": message.headers,
"uid": last_message_uid,
}
if self.custom_event_template is not None:
try:

View File

@ -164,6 +164,7 @@ async def test_receiving_message_successfully(
assert data["folder"] == "INBOX"
assert data["sender"] == "john.doe@example.com"
assert data["subject"] == "Test subject"
assert data["uid"] == "1"
assert "Test body" in data["text"]
assert (
valid_date
@ -213,6 +214,7 @@ async def test_receiving_message_with_invalid_encoding(
assert data["sender"] == "john.doe@example.com"
assert data["subject"] == "Test subject"
assert data["text"] == TEST_BADLY_ENCODED_CONTENT
assert data["uid"] == "1"
@pytest.mark.parametrize("imap_search", [TEST_SEARCH_RESPONSE])
@ -251,6 +253,7 @@ async def test_receiving_message_no_subject_to_from(
assert data["text"] == "Test body\r\n"
assert data["headers"]["Return-Path"] == ("<john.doe@example.com>",)
assert data["headers"]["Delivered-To"] == ("notify@example.com",)
assert data["uid"] == "1"
@pytest.mark.parametrize("imap_has_capability", [True, False], ids=["push", "poll"])