2025-01-14 17:28:36 -06:00
|
|
|
# -*- coding: utf-8; -*-
|
|
|
|
|
|
|
|
from unittest import TestCase
|
|
|
|
from unittest.mock import MagicMock, patch, call
|
|
|
|
|
|
|
|
from wuttamess import wutta as mod
|
|
|
|
|
|
|
|
|
|
|
|
class TestPurgeEmailSettings(TestCase):
|
|
|
|
|
|
|
|
def test_basic(self):
|
|
|
|
c = MagicMock()
|
|
|
|
sql = MagicMock()
|
|
|
|
postgres = MagicMock(sql=sql)
|
2025-08-31 12:52:36 -05:00
|
|
|
with patch.object(mod, "postgres", new=postgres):
|
|
|
|
mod.purge_email_settings(c, "testy", appname="wuttatest")
|
|
|
|
sql.assert_has_calls(
|
|
|
|
[
|
|
|
|
call(
|
|
|
|
c,
|
|
|
|
"delete from setting where name like 'wuttatest.email.%.sender';",
|
|
|
|
database="testy",
|
|
|
|
),
|
|
|
|
call(
|
|
|
|
c,
|
|
|
|
"delete from setting where name like 'wuttatest.email.%.to';",
|
|
|
|
database="testy",
|
|
|
|
),
|
|
|
|
call(
|
|
|
|
c,
|
|
|
|
"delete from setting where name like 'wuttatest.email.%.cc';",
|
|
|
|
database="testy",
|
|
|
|
),
|
|
|
|
call(
|
|
|
|
c,
|
|
|
|
"delete from setting where name like 'wuttatest.email.%.bcc';",
|
|
|
|
database="testy",
|
|
|
|
),
|
|
|
|
]
|
|
|
|
)
|