mirror of
https://github.com/deltachat/deltachat-core.git
synced 2025-10-04 18:29:19 +02:00
add contact handling and tests, complete get_contacts() API with flags,query
This commit is contained in:
parent
d24a1b5375
commit
9d22585cea
3 changed files with 35 additions and 8 deletions
|
@ -15,7 +15,7 @@ class TestOfflineAccount:
|
|||
with pytest.raises(ValueError):
|
||||
ac1.get_self_contact()
|
||||
|
||||
def test_contacts(self, acfactory):
|
||||
def test_contact_attr(self, acfactory):
|
||||
ac1 = acfactory.get_offline_account()
|
||||
contact1 = ac1.create_contact(email="some1@hello.com", name="some1")
|
||||
assert contact1.id
|
||||
|
@ -24,6 +24,19 @@ class TestOfflineAccount:
|
|||
assert not contact1.is_blocked
|
||||
assert not contact1.is_verified
|
||||
|
||||
def test_contact_get_contacts(self, acfactory):
|
||||
ac1 = acfactory.get_offline_account()
|
||||
contact1 = ac1.create_contact(email="some1@hello.com", name="some1")
|
||||
contacts = ac1.get_contacts()
|
||||
assert len(contacts) == 1
|
||||
assert contact1 in contacts
|
||||
|
||||
assert not ac1.get_contacts(query="some2")
|
||||
assert ac1.get_contacts(query="some1")
|
||||
assert not ac1.get_contacts(only_verified=True)
|
||||
contacts = ac1.get_contacts(with_self=True)
|
||||
assert len(contacts) == 2
|
||||
|
||||
def test_chat(self, acfactory):
|
||||
ac1 = acfactory.get_offline_account()
|
||||
contact1 = ac1.create_contact("some1@hello.com", name="some1")
|
||||
|
@ -100,4 +113,3 @@ class TestOnlineAccount:
|
|||
assert msg.text == "msg1"
|
||||
messages = msg.chat.get_messages()
|
||||
assert msg in messages, (msg, messages)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue