use new URL format and service provided by mailadm

This commit is contained in:
holger krekel
2020-02-11 20:42:40 +01:00
parent 8b4edc46a7
commit 5c17ec5f01
2 changed files with 12 additions and 13 deletions

View File

@@ -52,20 +52,21 @@ Python packages before running the tests::
pytest -v tests pytest -v tests
running "live" tests (experimental) running "live" tests with temporary accounts
----------------------------------- ---------------------------------------------
If you want to run "liveconfig" functional tests you can set If you want to run "liveconfig" functional tests you can set
``DCC_PY_LIVECONFIG`` to: ``DCC_NEW_TMP_EMAIL`` to:
- a particular https-url that you can ask for from the delta - a particular https-url that you can ask for from the delta
chat devs. chat devs. This is implemented on the server side via
the [mailadm](https://github.com/deltachat/mailadm) command line tool.
- or the path of a file that contains two lines, each describing - or the path of a file that contains two lines, each describing
via "addr=... mail_pw=..." a test account login that will via "addr=... mail_pw=..." a test account login that will
be used for the live tests. be used for the live tests.
With ``DCC_PY_LIVECONFIG`` set pytest invocations will use real With ``DCC_NEW_TMP_EMAIL`` set pytest invocations will use real
e-mail accounts and run through all functional "liveconfig" tests. e-mail accounts and run through all functional "liveconfig" tests.
@@ -129,7 +130,7 @@ organization::
This docker image can be used to run tests and build Python wheels for all interpreters:: This docker image can be used to run tests and build Python wheels for all interpreters::
$ docker run -e DCC_PY_LIVECONFIG \ $ docker run -e DCC_NEW_TMP_EMAIL \
--rm -it -v \$(pwd):/mnt -w /mnt \ --rm -it -v \$(pwd):/mnt -w /mnt \
deltachat/coredeps ci_scripts/run_all.sh deltachat/coredeps ci_scripts/run_all.sh

View File

@@ -28,7 +28,7 @@ def pytest_configure(config):
) )
cfg = config.getoption('--liveconfig') cfg = config.getoption('--liveconfig')
if not cfg: if not cfg:
cfg = os.getenv('DCC_PY_LIVECONFIG') cfg = os.getenv('DCC_NEW_TMP_EMAIL')
if cfg: if cfg:
config.option.liveconfig = cfg config.option.liveconfig = cfg
@@ -97,17 +97,16 @@ class SessionLiveConfigFromFile:
class SessionLiveConfigFromURL: class SessionLiveConfigFromURL:
def __init__(self, url, create_token): def __init__(self, url):
self.configlist = [] self.configlist = []
self.url = url self.url = url
self.create_token = create_token
def get(self, index): def get(self, index):
try: try:
return self.configlist[index] return self.configlist[index]
except IndexError: except IndexError:
assert index == len(self.configlist), index assert index == len(self.configlist), index
res = requests.post(self.url, json={"token_create_user": int(self.create_token)}) res = requests.post(self.url)
if res.status_code != 200: if res.status_code != 200:
pytest.skip("creating newtmpuser failed {!r}".format(res)) pytest.skip("creating newtmpuser failed {!r}".format(res))
d = res.json() d = res.json()
@@ -124,8 +123,7 @@ def session_liveconfig(request):
liveconfig_opt = request.config.option.liveconfig liveconfig_opt = request.config.option.liveconfig
if liveconfig_opt: if liveconfig_opt:
if liveconfig_opt.startswith("http"): if liveconfig_opt.startswith("http"):
url, create_token = liveconfig_opt.split("#", 1) return SessionLiveConfigFromURL(liveconfig_opt)
return SessionLiveConfigFromURL(url, create_token)
else: else:
return SessionLiveConfigFromFile(liveconfig_opt) return SessionLiveConfigFromFile(liveconfig_opt)
@@ -196,7 +194,7 @@ def acfactory(pytestconfig, tmpdir, request, session_liveconfig, datadir):
def get_online_config(self, pre_generated_key=True): def get_online_config(self, pre_generated_key=True):
if not session_liveconfig: if not session_liveconfig:
pytest.skip("specify DCC_PY_LIVECONFIG or --liveconfig") pytest.skip("specify DCC_NEW_TMP_EMAIL or --liveconfig")
configdict = session_liveconfig.get(self.live_count) configdict = session_liveconfig.get(self.live_count)
self.live_count += 1 self.live_count += 1
if "e2ee_enabled" not in configdict: if "e2ee_enabled" not in configdict: