From 2cbf2d8f652b8c37b953d81c89711ca280b562df Mon Sep 17 00:00:00 2001 From: holger krekel Date: Mon, 20 Jul 2020 15:08:00 +0200 Subject: [PATCH] fix bug reported by @adbenitez --- python/CHANGELOG | 4 +++- python/src/deltachat/account.py | 1 - python/tests/test_account.py | 5 +++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/python/CHANGELOG b/python/CHANGELOG index 19e50f72e..5190bfab4 100644 --- a/python/CHANGELOG +++ b/python/CHANGELOG @@ -1,9 +1,11 @@ -1.40.x +1.40.1 --------------- - emit "ac_member_removed" event (with 'actor' being the removed contact) for when a user leaves a group. +- fix create_contact(addr) when addr is the self-contact. + 1.40.0 --------------- diff --git a/python/src/deltachat/account.py b/python/src/deltachat/account.py index f2b7b1cff..e8e7dd04d 100644 --- a/python/src/deltachat/account.py +++ b/python/src/deltachat/account.py @@ -246,7 +246,6 @@ class Account(object): addr = as_dc_charpointer(addr) name = as_dc_charpointer(name) contact_id = lib.dc_create_contact(self._dc_context, name, addr) - assert contact_id > const.DC_CHAT_ID_LAST_SPECIAL, contact_id return Contact(self, contact_id) def delete_contact(self, contact): diff --git a/python/tests/test_account.py b/python/tests/test_account.py index 8613f813e..b340caa2d 100644 --- a/python/tests/test_account.py +++ b/python/tests/test_account.py @@ -129,6 +129,11 @@ class TestOfflineContact: assert not contact1.is_blocked() assert not contact1.is_verified() + def test_create_self_contact(self, acfactory): + ac1 = acfactory.get_configured_offline_account() + contact1 = ac1.create_contact(ac1.get_config("addr")) + assert contact1.id == 1 + def test_get_contacts_and_delete(self, acfactory): ac1 = acfactory.get_configured_offline_account() contact1 = ac1.create_contact("some1@example.org", name="some1")