mirror of
https://github.com/deltachat/deltachat-core.git
synced 2025-10-04 10:19:16 +02:00
make some tests run also in offline mode and thus on travis
This commit is contained in:
parent
13d23be7da
commit
dead1d1a87
2 changed files with 18 additions and 9 deletions
|
@ -28,13 +28,21 @@ def acfactory(pytestconfig, tmpdir, request):
|
||||||
name, value = part.split("=")
|
name, value = part.split("=")
|
||||||
d[name] = value
|
d[name] = value
|
||||||
self.configlist.append(d)
|
self.configlist.append(d)
|
||||||
self.count = 0
|
self.live_count = 0
|
||||||
|
self.offline_count = 0
|
||||||
|
|
||||||
|
def get_offline_account(self):
|
||||||
|
self.offline_count += 1
|
||||||
|
tmpdb = tmpdir.join("offlinedb%d" % self.offline_count)
|
||||||
|
ac = Account(tmpdb.strpath, _logid="ac{}".format(self.offline_count))
|
||||||
|
ac._evlogger.set_timeout(2)
|
||||||
|
return ac
|
||||||
|
|
||||||
def get_live_account(self, started=True):
|
def get_live_account(self, started=True):
|
||||||
|
self.live_count += 1
|
||||||
configdict = self.configlist.pop(0)
|
configdict = self.configlist.pop(0)
|
||||||
tmpdb = tmpdir.join("testdb%d" % self.count)
|
tmpdb = tmpdir.join("livedb%d" % self.live_count)
|
||||||
ac = Account(tmpdb.strpath, _logid="ac{}".format(self.count+1))
|
ac = Account(tmpdb.strpath, _logid="ac{}".format(self.live_count))
|
||||||
self.count += 1
|
|
||||||
ac._evlogger.set_timeout(10)
|
ac._evlogger.set_timeout(10)
|
||||||
ac.set_config(**configdict)
|
ac.set_config(**configdict)
|
||||||
if started:
|
if started:
|
||||||
|
|
|
@ -3,16 +3,15 @@ import time
|
||||||
from deltachat.capi import lib
|
from deltachat.capi import lib
|
||||||
|
|
||||||
|
|
||||||
class TestLive:
|
class TestOfflineAccount:
|
||||||
|
|
||||||
def test_selfcontact(self, acfactory):
|
def test_selfcontact(self, acfactory):
|
||||||
ac1 = acfactory.get_live_account(started=False)
|
ac1 = acfactory.get_offline_account()
|
||||||
me = ac1.get_self_contact()
|
me = ac1.get_self_contact()
|
||||||
assert me.display_name
|
assert me.display_name
|
||||||
# assert me.addr # xxx why is this empty?
|
# assert me.addr # xxx why is this empty?
|
||||||
|
|
||||||
def test_contacts(self, acfactory):
|
def test_contacts(self, acfactory):
|
||||||
ac1 = acfactory.get_live_account(started=False)
|
ac1 = acfactory.get_offline_account()
|
||||||
contact1 = ac1.create_contact(email="some1@hello.com", name="some1")
|
contact1 = ac1.create_contact(email="some1@hello.com", name="some1")
|
||||||
assert contact1.id
|
assert contact1.id
|
||||||
assert contact1.addr == "some1@hello.com"
|
assert contact1.addr == "some1@hello.com"
|
||||||
|
@ -21,11 +20,13 @@ class TestLive:
|
||||||
assert not contact1.is_verified
|
assert not contact1.is_verified
|
||||||
|
|
||||||
def test_chat(self, acfactory):
|
def test_chat(self, acfactory):
|
||||||
ac1 = acfactory.get_live_account(started=False)
|
ac1 = acfactory.get_offline_account()
|
||||||
contact1 = ac1.create_contact("some1@hello.com", name="some1")
|
contact1 = ac1.create_contact("some1@hello.com", name="some1")
|
||||||
chat = ac1.create_chat_by_contact(contact1)
|
chat = ac1.create_chat_by_contact(contact1)
|
||||||
assert chat.id
|
assert chat.id
|
||||||
|
|
||||||
|
|
||||||
|
class TestOnlineAccount:
|
||||||
def wait_successful_IMAP_SMTP_connection(self, account):
|
def wait_successful_IMAP_SMTP_connection(self, account):
|
||||||
imap_ok = smtp_ok = False
|
imap_ok = smtp_ok = False
|
||||||
while not imap_ok or not smtp_ok:
|
while not imap_ok or not smtp_ok:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue