address @hocuri comment -- remove as_contact() as it's synonym with create_contact

and the latter is already an established API and conveys better that a contact
object will be created if it doesn't exist.
This commit is contained in:
holger krekel
2020-06-09 13:14:22 +02:00
parent 0bb4ef0bd9
commit 0c8f951d8f
4 changed files with 19 additions and 22 deletions

View File

@@ -105,8 +105,8 @@ class TestOfflineAccountBasic:
class TestOfflineContact:
def test_contact_attr(self, acfactory):
ac1 = acfactory.get_configured_offline_account()
contact1 = ac1.create_contact(addr="some1@hello.com", name="some1")
contact2 = ac1.create_contact(addr="some1@hello.com", name="some1")
contact1 = ac1.create_contact("some1@hello.com", name="some1")
contact2 = ac1.create_contact("some1@hello.com", name="some1")
str(contact1)
repr(contact1)
assert contact1 == contact2
@@ -118,7 +118,7 @@ class TestOfflineContact:
def test_get_contacts_and_delete(self, acfactory):
ac1 = acfactory.get_configured_offline_account()
contact1 = ac1.create_contact(addr="some1@hello.com", name="some1")
contact1 = ac1.create_contact("some1@hello.com", name="some1")
contacts = ac1.get_contacts()
assert len(contacts) == 1
assert contact1 in contacts
@@ -133,7 +133,7 @@ class TestOfflineContact:
def test_get_contacts_and_delete_fails(self, acfactory):
ac1 = acfactory.get_configured_offline_account()
contact1 = ac1.create_contact(addr="some1@example.com", name="some1")
contact1 = ac1.create_contact("some1@example.com", name="some1")
msg = contact1.create_chat().send_text("one message")
assert not ac1.delete_contact(contact1)
assert not msg.filemime
@@ -802,7 +802,7 @@ class TestOnlineAccount:
lp.sec("ac1: creating group chat, and forward own message")
group = ac1.create_group_chat("newgroup2")
group.add_contact(ac1.create_contact(ac2.get_config("addr")))
group.add_contact(ac2)
ac1.forward_messages([msg_out], group)
# wait for other account to receive
@@ -1485,7 +1485,7 @@ class TestOnlineAccount:
assert locations[0].accuracy == 0.5
assert locations[0].timestamp > now
contact = ac2.create_contact(ac1.get_config("addr"))
contact = ac2.create_contact(ac1)
locations2 = chat2.get_locations(contact=contact)
assert len(locations2) == 1
assert locations2 == locations

View File

@@ -69,7 +69,7 @@ def test_sig():
def test_markseen_invalid_message_ids(acfactory):
ac1 = acfactory.get_configured_offline_account()
contact1 = ac1.create_contact(addr="some1@example.com", name="some1")
contact1 = ac1.create_contact("some1@example.com", name="some1")
chat = contact1.create_chat()
chat.send_text("one messae")
ac1._evtracker.get_matching("DC_EVENT_MSGS_CHANGED")