From e525c42c7d31baf13edf2ed65177fcee759a04df Mon Sep 17 00:00:00 2001 From: Floris Bruynooghe Date: Sun, 9 Feb 2020 19:11:30 +0100 Subject: [PATCH] Unmute should also raise exceptions And tests should not care about return values. --- python/src/deltachat/chat.py | 6 ++++-- python/tests/test_account.py | 6 +++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/python/src/deltachat/chat.py b/python/src/deltachat/chat.py index 4ad437bbf..c2517f156 100644 --- a/python/src/deltachat/chat.py +++ b/python/src/deltachat/chat.py @@ -114,9 +114,11 @@ class Chat(object): def unmute(self): """ 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): """ Returns the number of seconds until the mute of this chat is lifted. diff --git a/python/tests/test_account.py b/python/tests/test_account.py index 4d99683ad..19ed817fc 100644 --- a/python/tests/test_account.py +++ b/python/tests/test_account.py @@ -223,11 +223,11 @@ class TestOfflineChat: def test_mute(self, ac1): chat = ac1.create_group_chat(name="title1") assert not chat.is_muted() - assert chat.mute() + chat.mute() assert chat.is_muted() - assert chat.unmute() + chat.unmute() assert not chat.is_muted() - assert chat.mute(50) + chat.mute(50) assert chat.is_muted() with pytest.raises(ValueError): chat.mute(-51)