fix some more python test

This commit is contained in:
dignifiedquire
2020-03-25 13:48:02 +01:00
parent 69f1e1753c
commit 3871c5a4a0
2 changed files with 8 additions and 8 deletions

View File

@@ -279,11 +279,11 @@ def lp():
return Printer()
def wait_configuration_progress(account, min_target, max_target=1001):
def wait_configuration_progress(account, min_target, max_target=1001, check_error=True):
min_target = min(min_target, max_target)
while 1:
evt_name, data1, data2 = \
account._evlogger.get_matching("DC_EVENT_CONFIGURE_PROGRESS")
account._evlogger.get_matching("DC_EVENT_CONFIGURE_PROGRESS", check_error=check_error)
if data1 >= min_target and data1 <= max_target:
print("** CONFIG PROGRESS {}".format(min_target), account)
break

View File

@@ -1465,22 +1465,22 @@ class TestOnlineConfigureFails:
ac1, configdict = acfactory.get_online_config()
ac1.configure(addr=configdict["addr"], mail_pw="123")
wait_configuration_progress(ac1, 500)
ev1 = ac1._evlogger.get_matching("DC_EVENT_ERROR_NETWORK")
ev1 = ac1._evlogger.get_matching("DC_EVENT_ERROR_NETWORK", check_error=False)
assert "cannot login" in ev1[2].lower()
wait_configuration_progress(ac1, 0, 0)
wait_configuration_progress(ac1, 0, 0, check_error=False)
def test_invalid_user(self, acfactory):
ac1, configdict = acfactory.get_online_config()
ac1.configure(addr="x" + configdict["addr"], mail_pw=configdict["mail_pw"])
wait_configuration_progress(ac1, 500)
ev1 = ac1._evlogger.get_matching("DC_EVENT_ERROR_NETWORK")
ev1 = ac1._evlogger.get_matching("DC_EVENT_ERROR_NETWORK", check_error=False)
assert "cannot login" in ev1[2].lower()
wait_configuration_progress(ac1, 0, 0)
wait_configuration_progress(ac1, 0, 0, check_error=False)
def test_invalid_domain(self, acfactory):
ac1, configdict = acfactory.get_online_config()
ac1.configure(addr=configdict["addr"] + "x", mail_pw=configdict["mail_pw"])
wait_configuration_progress(ac1, 500)
wait_configuration_progress(ac1, 500, check_error=False)
ev1 = ac1._evlogger.get_matching("DC_EVENT_ERROR_NETWORK")
assert "could not connect" in ev1[2].lower()
wait_configuration_progress(ac1, 0, 0)
wait_configuration_progress(ac1, 0, 0, check_error=False)