Test that STARTTLS connection works

This commit is contained in:
link2xt
2023-01-02 21:31:23 +00:00
parent 1e5c90ed65
commit 5b3596987b
2 changed files with 17 additions and 2 deletions

View File

@@ -27,12 +27,17 @@ class ACFactory:
async def get_unconfigured_bot(self) -> Bot:
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()
account = await self.get_unconfigured_account()
assert not await account.is_configured()
await account.set_config("addr", credentials["email"])
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()
assert await account.is_configured()
return account

View File

@@ -41,6 +41,16 @@ async def test_acfactory(acfactory) -> None:
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
async def test_account(acfactory) -> None:
alice, bob = await acfactory.get_online_accounts(2)