mirror of
https://github.com/chatmail/core.git
synced 2026-05-23 00:36:32 +03:00
Test that STARTTLS connection works
This commit is contained in:
@@ -27,12 +27,17 @@ class ACFactory:
|
|||||||
async def get_unconfigured_bot(self) -> Bot:
|
async def get_unconfigured_bot(self) -> Bot:
|
||||||
return Bot(await self.get_unconfigured_account())
|
return Bot(await self.get_unconfigured_account())
|
||||||
|
|
||||||
async def new_configured_account(self) -> Account:
|
async def new_preconfigured_account(self) -> Account:
|
||||||
|
"""Make a new account with configuration options set, but configuration not started."""
|
||||||
credentials = await get_temp_credentials()
|
credentials = await get_temp_credentials()
|
||||||
account = await self.get_unconfigured_account()
|
account = await self.get_unconfigured_account()
|
||||||
assert not await account.is_configured()
|
|
||||||
await account.set_config("addr", credentials["email"])
|
await account.set_config("addr", credentials["email"])
|
||||||
await account.set_config("mail_pw", credentials["password"])
|
await account.set_config("mail_pw", credentials["password"])
|
||||||
|
assert not await account.is_configured()
|
||||||
|
return account
|
||||||
|
|
||||||
|
async def new_configured_account(self) -> Account:
|
||||||
|
account = await self.new_preconfigured_account()
|
||||||
await account.configure()
|
await account.configure()
|
||||||
assert await account.is_configured()
|
assert await account.is_configured()
|
||||||
return account
|
return account
|
||||||
|
|||||||
@@ -41,6 +41,16 @@ async def test_acfactory(acfactory) -> None:
|
|||||||
print("Successful configuration")
|
print("Successful configuration")
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.asyncio
|
||||||
|
async def test_configure_starttls(acfactory) -> None:
|
||||||
|
account = await acfactory.new_preconfigured_account()
|
||||||
|
|
||||||
|
# Use STARTTLS
|
||||||
|
await account.set_config("mail_security", "2")
|
||||||
|
await account.configure()
|
||||||
|
assert await account.is_configured()
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
async def test_account(acfactory) -> None:
|
async def test_account(acfactory) -> None:
|
||||||
alice, bob = await acfactory.get_online_accounts(2)
|
alice, bob = await acfactory.get_online_accounts(2)
|
||||||
|
|||||||
Reference in New Issue
Block a user