summaryrefslogtreecommitdiff
path: root/src/mailman/utilities/datetime.py
diff options
context:
space:
mode:
authorBarry Warsaw2011-04-04 14:32:17 -0400
committerBarry Warsaw2011-04-04 14:32:17 -0400
commit17887e4d1e56915647e1d395e18573db2b9ea3ba (patch)
tree8dc9f275e878539040ee25857593570aca1ec113 /src/mailman/utilities/datetime.py
parentcd18f50624f33a9556492168933d5fe088d51a04 (diff)
downloadmailman-17887e4d1e56915647e1d395e18573db2b9ea3ba.tar.gz
mailman-17887e4d1e56915647e1d395e18573db2b9ea3ba.tar.zst
mailman-17887e4d1e56915647e1d395e18573db2b9ea3ba.zip
More fleshing out of the users REST API.
* Add a 'uid factory' which allows us to return predictable unique ids for various testing purposes, e.g. user ids. This should work even in the case of cross-subprocess uid generation. * REST access to individual users, or the set of all users. * User objects now have a created_on attribute. * Users can be created through the web, but must have an email address. * Add a [devmode] 'testing' variable for communicating to qrunner subprocesses that we're running in testing mode. This allows us to coordinate factories and such in the qrunner processes. * layers.is_testing() for more consistent API. * Give AddressError a .address attribute for better diagnostics.
Diffstat (limited to '')
-rw-r--r--src/mailman/utilities/datetime.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/mailman/utilities/datetime.py b/src/mailman/utilities/datetime.py
index 9dcd21f1e..1ee727da4 100644
--- a/src/mailman/utilities/datetime.py
+++ b/src/mailman/utilities/datetime.py
@@ -36,7 +36,7 @@ __all__ = [
import datetime
-from mailman.testing.layers import MockAndMonkeyLayer
+from mailman.testing import layers
@@ -51,12 +51,12 @@ class DateFactory:
# We can't automatically fast-forward because some tests require us to
# stay on the same day for a while, e.g. autorespond.txt.
return (self.predictable_now
- if MockAndMonkeyLayer.testing_mode
+ if layers.is_testing()
else datetime.datetime.now(tz))
def today(self):
return (self.predictable_today
- if MockAndMonkeyLayer.testing_mode
+ if layers.is_testing()
else datetime.date.today())
@classmethod
@@ -74,4 +74,4 @@ factory = DateFactory()
factory.reset()
today = factory.today
now = factory.now
-MockAndMonkeyLayer.register_reset(factory.reset)
+layers.MockAndMonkeyLayer.register_reset(factory.reset)