mirror of
https://github.com/chatmail/core.git
synced 2026-04-29 11:26:29 +03:00
api(deltachat-rpc-client): add Message.exists()
This commit is contained in:
@@ -60,6 +60,10 @@ class Message:
|
|||||||
"""Mark the message as seen."""
|
"""Mark the message as seen."""
|
||||||
self._rpc.markseen_msgs(self.account.id, [self.id])
|
self._rpc.markseen_msgs(self.account.id, [self.id])
|
||||||
|
|
||||||
|
def exists(self) -> bool:
|
||||||
|
"""Return True if the message exists."""
|
||||||
|
return bool(self._rpc.get_existing_msg_ids(self.account.id, [self.id]))
|
||||||
|
|
||||||
def continue_autocrypt_key_transfer(self, setup_code: str) -> None:
|
def continue_autocrypt_key_transfer(self, setup_code: str) -> None:
|
||||||
"""Continue the Autocrypt Setup Message key transfer.
|
"""Continue the Autocrypt Setup Message key transfer.
|
||||||
|
|
||||||
|
|||||||
@@ -993,3 +993,22 @@ def test_background_fetch(acfactory, dc):
|
|||||||
snapshot = messages[-1].get_snapshot()
|
snapshot = messages[-1].get_snapshot()
|
||||||
if snapshot.text == "Hello again!":
|
if snapshot.text == "Hello again!":
|
||||||
break
|
break
|
||||||
|
|
||||||
|
|
||||||
|
def test_message_exists(acfactory):
|
||||||
|
ac1, ac2 = acfactory.get_online_accounts(2)
|
||||||
|
chat = ac1.create_chat(ac2)
|
||||||
|
message1 = chat.send_text("Hello!")
|
||||||
|
message2 = chat.send_text("Hello again!")
|
||||||
|
assert message1.exists()
|
||||||
|
assert message2.exists()
|
||||||
|
|
||||||
|
ac1.delete_messages([message1])
|
||||||
|
assert not message1.exists()
|
||||||
|
assert message2.exists()
|
||||||
|
|
||||||
|
# There is no error when checking if
|
||||||
|
# the message exists for deleted account.
|
||||||
|
ac1.remove()
|
||||||
|
assert not message1.exists()
|
||||||
|
assert not message2.exists()
|
||||||
|
|||||||
Reference in New Issue
Block a user