# -*- 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) 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'), ])