mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 20:57:21 +00:00
Add uid
attribute to imap_content
event data (#114432)
* Add uid to imap event * Add ´uid´ to tests * Update test_init.py
This commit is contained in:
parent
5b4452a579
commit
54c5f18aac
@ -264,6 +264,7 @@ class ImapDataUpdateCoordinator(DataUpdateCoordinator[int | None]):
|
|||||||
"sender": message.sender,
|
"sender": message.sender,
|
||||||
"subject": message.subject,
|
"subject": message.subject,
|
||||||
"headers": message.headers,
|
"headers": message.headers,
|
||||||
|
"uid": last_message_uid,
|
||||||
}
|
}
|
||||||
if self.custom_event_template is not None:
|
if self.custom_event_template is not None:
|
||||||
try:
|
try:
|
||||||
|
@ -164,6 +164,7 @@ async def test_receiving_message_successfully(
|
|||||||
assert data["folder"] == "INBOX"
|
assert data["folder"] == "INBOX"
|
||||||
assert data["sender"] == "john.doe@example.com"
|
assert data["sender"] == "john.doe@example.com"
|
||||||
assert data["subject"] == "Test subject"
|
assert data["subject"] == "Test subject"
|
||||||
|
assert data["uid"] == "1"
|
||||||
assert "Test body" in data["text"]
|
assert "Test body" in data["text"]
|
||||||
assert (
|
assert (
|
||||||
valid_date
|
valid_date
|
||||||
@ -213,6 +214,7 @@ async def test_receiving_message_with_invalid_encoding(
|
|||||||
assert data["sender"] == "john.doe@example.com"
|
assert data["sender"] == "john.doe@example.com"
|
||||||
assert data["subject"] == "Test subject"
|
assert data["subject"] == "Test subject"
|
||||||
assert data["text"] == TEST_BADLY_ENCODED_CONTENT
|
assert data["text"] == TEST_BADLY_ENCODED_CONTENT
|
||||||
|
assert data["uid"] == "1"
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize("imap_search", [TEST_SEARCH_RESPONSE])
|
@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["text"] == "Test body\r\n"
|
||||||
assert data["headers"]["Return-Path"] == ("<john.doe@example.com>",)
|
assert data["headers"]["Return-Path"] == ("<john.doe@example.com>",)
|
||||||
assert data["headers"]["Delivered-To"] == ("notify@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"])
|
@pytest.mark.parametrize("imap_has_capability", [True, False], ids=["push", "poll"])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user