mirror of
https://github.com/chatmail/core.git
synced 2026-04-02 05:22:14 +03:00
python bindings for archive and py tests
This commit is contained in:
@@ -424,13 +424,33 @@ class Chat(object):
|
||||
:returns: True if archived.
|
||||
"""
|
||||
return lib.dc_chat_get_archived(self._dc_chat) == 1
|
||||
|
||||
|
||||
def is_pinned(self):
|
||||
"""return True if this chat is pinned.
|
||||
:returns: True if pinned.
|
||||
"""
|
||||
return lib.dc_chat_get_archived(self._dc_chat) == 2
|
||||
|
||||
def archive(self):
|
||||
"""archive the chat.
|
||||
"""
|
||||
lib.dc_archive_chat(self._dc_context, self.id, 1)
|
||||
|
||||
def unarchive(self):
|
||||
"""unarchive the chat.
|
||||
"""
|
||||
lib.dc_archive_chat(self._dc_context, self.id, 0)
|
||||
|
||||
def pin(self):
|
||||
"""pin the chat.
|
||||
"""
|
||||
lib.dc_archive_chat(self._dc_context, self.id, 2)
|
||||
|
||||
def unpin(self):
|
||||
"""unpin the chat. (same as unarchive)
|
||||
"""
|
||||
self.unarchive()
|
||||
|
||||
def enable_sending_locations(self, seconds):
|
||||
"""enable sending locations for this chat.
|
||||
|
||||
|
||||
@@ -426,6 +426,17 @@ class TestOfflineChat:
|
||||
chat.remove_contact(contacts[3])
|
||||
assert len(chat.get_contacts()) == 9
|
||||
|
||||
def test_archive_and_pin_chat(self, ac1):
|
||||
chat = ac1.create_group_chat(name="title1")
|
||||
|
||||
assert not chat.is_archived()
|
||||
chat.archive()
|
||||
assert chat.is_archived()
|
||||
chat.unarchive()
|
||||
assert not chat.is_archived()
|
||||
chat.pin()
|
||||
assert chat.is_pinned()
|
||||
|
||||
|
||||
class TestOnlineAccount:
|
||||
@pytest.mark.ignored
|
||||
|
||||
Reference in New Issue
Block a user