summaryrefslogtreecommitdiff
path: root/src/mailman/database/autorespond.py
diff options
context:
space:
mode:
authorBarry Warsaw2009-02-17 21:40:55 -0500
committerBarry Warsaw2009-02-17 21:40:55 -0500
commit1f4c4e107f24cbb36110e8cb88908b34bac74b01 (patch)
tree9879c2cc638b3c9517019af7b83388429274cf47 /src/mailman/database/autorespond.py
parent9c28502b5d8b1fc2388354c19e81a18a0e3c0088 (diff)
downloadmailman-1f4c4e107f24cbb36110e8cb88908b34bac74b01.tar.gz
mailman-1f4c4e107f24cbb36110e8cb88908b34bac74b01.tar.zst
mailman-1f4c4e107f24cbb36110e8cb88908b34bac74b01.zip
Add a "mock and monkey" layer to set up testing infrastructure, e.g. for
predictable dates and times. Fill out the autorespond.txt test to show that when the date flips over, the response counts reset. Add a date/time factory which we should use rather than the built-in datetime for now() and today() so that they can be appropriately tested.
Diffstat (limited to 'src/mailman/database/autorespond.py')
-rw-r--r--src/mailman/database/autorespond.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/mailman/database/autorespond.py b/src/mailman/database/autorespond.py
index 9561e804c..0a22dfa14 100644
--- a/src/mailman/database/autorespond.py
+++ b/src/mailman/database/autorespond.py
@@ -27,7 +27,6 @@ __all__ = [
]
-from datetime import date
from storm.locals import And, Date, Int, Reference
from zope.interface import implements
@@ -37,6 +36,7 @@ from mailman.database.types import Enum
from mailman.interfaces.autorespond import (
IAutoResponseRecord, IAutoResponseSet, Response)
from mailman.interfaces.mailinglist import IMailingList
+from mailman.utilities.datetime import today
@@ -58,7 +58,7 @@ class AutoResponseRecord(Model):
self.mailing_list = mailing_list
self.address = address
self.response_type = response_type
- self.date_sent = date.today()
+ self.date_sent = today()
@@ -75,7 +75,7 @@ class AutoResponseSet:
And(AutoResponseRecord.address == address,
AutoResponseRecord.mailing_list == self._mailing_list,
AutoResponseRecord.response_type == response_type,
- AutoResponseRecord.date_sent == date.today())).count()
+ AutoResponseRecord.date_sent == today())).count()
def response_sent(self, address, response_type):
"""See `IAutoResponseSet`."""