tests (e2e/conftest): check new exit code for conflict to avoid crashing if test accounts already exist
This commit is contained in:
parent
095ec0c71a
commit
736f91e557
1 changed files with 12 additions and 6 deletions
|
|
@ -25,6 +25,7 @@ from pathlib import Path
|
|||
from aiosmtpd.controller import Controller
|
||||
from aiosmtpd.handlers import Message
|
||||
from email.message import EmailMessage
|
||||
import sh
|
||||
from sh import jp
|
||||
import pytest
|
||||
|
||||
|
|
@ -155,12 +156,17 @@ def test_profiles():
|
|||
profile_suff = f"_s{server_idx}" if server_idx>1 else ""
|
||||
profile = f"account{account_idx}{profile_suff}"
|
||||
profiles.append(profile)
|
||||
jp.account.create(
|
||||
f"account{account_idx}@server{server_idx}.test",
|
||||
"test",
|
||||
profile=profile,
|
||||
host=f"server{server_idx}.test"
|
||||
)
|
||||
try:
|
||||
jp.account.create(
|
||||
f"account{account_idx}@server{server_idx}.test",
|
||||
"test",
|
||||
profile=profile,
|
||||
host=f"server{server_idx}.test"
|
||||
)
|
||||
except sh.ErrorReturnCode_19:
|
||||
# this is the conlict exit code, this can happen when tests are run
|
||||
# inside a container when --keep-profiles is used with run_e2e.py.
|
||||
pass
|
||||
jp.profile.modify(profile="account1", default=True, connect=True)
|
||||
jp.profile.connect(profile="account1_s2", connect=True)
|
||||
yield tuple(profiles)
|
||||
|
|
|
|||
Loading…
Reference in a new issue