mirror of
https://github.com/chatmail/core.git
synced 2026-04-17 21:46:35 +03:00
Unmute should also raise exceptions
And tests should not care about return values.
This commit is contained in:
@@ -114,9 +114,11 @@ class Chat(object):
|
|||||||
def unmute(self):
|
def unmute(self):
|
||||||
""" unmutes the chat
|
""" unmutes the chat
|
||||||
|
|
||||||
:returns:
|
:returns: None
|
||||||
"""
|
"""
|
||||||
return bool(lib.dc_set_chat_mute_duration(self._dc_context, self.id, 0))
|
ret = lib.dc_set_chat_mute_duration(self._dc_context, self.id, 0)
|
||||||
|
if not bool(ret):
|
||||||
|
raise ValueError("Failed to unmute chat")
|
||||||
|
|
||||||
def get_mute_duration(self):
|
def get_mute_duration(self):
|
||||||
""" Returns the number of seconds until the mute of this chat is lifted.
|
""" Returns the number of seconds until the mute of this chat is lifted.
|
||||||
|
|||||||
@@ -223,11 +223,11 @@ class TestOfflineChat:
|
|||||||
def test_mute(self, ac1):
|
def test_mute(self, ac1):
|
||||||
chat = ac1.create_group_chat(name="title1")
|
chat = ac1.create_group_chat(name="title1")
|
||||||
assert not chat.is_muted()
|
assert not chat.is_muted()
|
||||||
assert chat.mute()
|
chat.mute()
|
||||||
assert chat.is_muted()
|
assert chat.is_muted()
|
||||||
assert chat.unmute()
|
chat.unmute()
|
||||||
assert not chat.is_muted()
|
assert not chat.is_muted()
|
||||||
assert chat.mute(50)
|
chat.mute(50)
|
||||||
assert chat.is_muted()
|
assert chat.is_muted()
|
||||||
with pytest.raises(ValueError):
|
with pytest.raises(ValueError):
|
||||||
chat.mute(-51)
|
chat.mute(-51)
|
||||||
|
|||||||
Reference in New Issue
Block a user