Some checks failed
CI / skinny-install (aco) (push) Successful in 1m10s
CI / skinny-install (api) (push) Successful in 32s
CI / skinny-install (bcda) (push) Successful in 37s
CI / skinny-install (bib) (push) Successful in 35s
CI / skinny-install (bls) (push) Successful in 27s
CI / skinny-install (ccw) (push) Successful in 27s
CI / skinny-install (cli) (push) Successful in 39s
CI / skinny-install (cms) (push) Successful in 30s
CI / skinny-install (conf) (push) Successful in 27s
CI / skinny-install (opps) (push) Successful in 31s
CI / skinny-install (perf) (push) Successful in 40s
CI / skinny-install (pfs) (push) Successful in 36s
CI / skinny-install (rex) (push) Successful in 36s
CI / lint-test (push) Failing after 10m34s
Deploy / build-scan-report (push) Failing after 5m27s
Covers iom, oig, cli/{mail,prisma,zot}, mail/{cloudflare,postmark,
droplet,resend}, prisma/{vpn,screen,llm,project,export,eligibility,
extract,flow,ingest,tools}. Import + smoke tests with mocked deps.
Tracks #353.
41 lines
909 B
Python
41 lines
909 B
Python
"""Tests for mail.droplet — DO droplet lifecycle."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from mail.droplet import (
|
|
DOMAIN,
|
|
HOSTNAME,
|
|
_addr_to_key,
|
|
_gen_password,
|
|
_load_json,
|
|
_save_json,
|
|
)
|
|
|
|
|
|
class TestGenPassword:
|
|
def test_length(self):
|
|
pw = _gen_password(24)
|
|
assert len(pw) == 24
|
|
|
|
def test_alphanumeric(self):
|
|
pw = _gen_password()
|
|
assert pw.isalnum()
|
|
|
|
|
|
class TestAddrToKey:
|
|
def test_apex(self):
|
|
assert _addr_to_key(f"git@{DOMAIN}") == "git"
|
|
|
|
def test_subdomain(self):
|
|
assert _addr_to_key(f"cms@{HOSTNAME}") == f"cms@{HOSTNAME}"
|
|
|
|
|
|
class TestJsonHelpers:
|
|
def test_roundtrip(self, tmp_path):
|
|
path = tmp_path / "test.json"
|
|
_save_json(path, {"key": "val"})
|
|
assert _load_json(path) == {"key": "val"}
|
|
|
|
def test_missing(self, tmp_path):
|
|
assert _load_json(tmp_path / "nope.json") == {}
|