summaryrefslogtreecommitdiff
path: root/src/mailman/testing
diff options
context:
space:
mode:
authorBarry Warsaw2012-07-03 10:36:39 -0400
committerBarry Warsaw2012-07-03 10:36:39 -0400
commit01415190ab44e69a8f09a6411564a7cb288404e8 (patch)
tree869503cb83afa74a17446363a6dbda5ba62d2b8d /src/mailman/testing
parent3c8a07fc76176a8ea89ee6b73aef571d0b2c81ed (diff)
parent011677d7457f1d4c9cea3b030c8a50e941657812 (diff)
downloadmailman-01415190ab44e69a8f09a6411564a7cb288404e8.tar.gz
mailman-01415190ab44e69a8f09a6411564a7cb288404e8.tar.zst
mailman-01415190ab44e69a8f09a6411564a7cb288404e8.zip
* `passlib`_ is now used for all password hashing instead of flufl.password.
The default hash is `sha512_crypt`. (LP: #1015758) * Events renamed and moved: * `mailman.chains.accept.AcceptNotification` * `mailman.chains.base.ChainNotification` * `mailman.chains.discard.DiscardNotification` * `mailman.chains.hold.HoldNotification` * `mailman.chains.owner.OwnerNotification` * `mailman.chains.reject.RejectNotification` changed to (respectively): * `mailman.interfaces.chains.AcceptEvent` * `mailman.interfaces.chains.ChainEvent` * `mailman.interfaces.chains.DiscardEvent` * `mailman.interfaces.chains.HoldEvent` * `mailman.interfaces.chains.AcceptOwnerEvent` * `mailman.interfaces.chains.RejectEvent` * A `ConfigurationUpdatedEvent` is triggered when the system-wide global configuration stack is pushed or popped. * With the switch to `passlib`_, `[passwords]password_scheme` has been removed. Instead use `[passwords]path` to specify where to find the `passlib.cfg` file. See the comments in `schema.cfg` for details.
Diffstat (limited to 'src/mailman/testing')
-rw-r--r--src/mailman/testing/helpers.py12
-rw-r--r--src/mailman/testing/layers.py2
-rw-r--r--src/mailman/testing/passlib.cfg4
-rw-r--r--src/mailman/testing/testing.cfg3
4 files changed, 16 insertions, 5 deletions
diff --git a/src/mailman/testing/helpers.py b/src/mailman/testing/helpers.py
index 62e3b9d2a..84f215574 100644
--- a/src/mailman/testing/helpers.py
+++ b/src/mailman/testing/helpers.py
@@ -343,14 +343,14 @@ def call_api(url, data=None, method=None, username=None, password=None):
@contextmanager
def event_subscribers(*subscribers):
- """Temporarily set the Zope event subscribers list.
+ """Temporarily extend the Zope event subscribers list.
:param subscribers: A sequence of event subscribers.
:type subscribers: sequence of callables, each receiving one argument, the
event.
"""
old_subscribers = event.subscribers[:]
- event.subscribers = list(subscribers)
+ event.subscribers.extend(subscribers)
try:
yield
finally:
@@ -363,8 +363,14 @@ class configuration:
def __init__(self, section, **kws):
self._section = section
+ # Most tests don't care about the name given to the temporary
+ # configuration. Usually we'll just craft a random one, but some
+ # tests do care, so give them a hook to set it.
+ if '_configname' in kws:
+ self._uuid = kws.pop('_configname')
+ else:
+ self._uuid = uuid.uuid4().hex
self._values = kws.copy()
- self._uuid = uuid.uuid4().hex
def _apply(self):
lines = ['[{0}]'.format(self._section)]
diff --git a/src/mailman/testing/layers.py b/src/mailman/testing/layers.py
index 0faa1c8e4..bbef6d5f4 100644
--- a/src/mailman/testing/layers.py
+++ b/src/mailman/testing/layers.py
@@ -117,8 +117,6 @@ class ConfigLayer(MockAndMonkeyLayer):
test_config = dedent("""
[mailman]
layout: testing
- [passwords]
- password_scheme: cleartext
[paths.testing]
var_dir: %s
[devmode]
diff --git a/src/mailman/testing/passlib.cfg b/src/mailman/testing/passlib.cfg
new file mode 100644
index 000000000..225ecd49b
--- /dev/null
+++ b/src/mailman/testing/passlib.cfg
@@ -0,0 +1,4 @@
+[passlib]
+# Use a predictable hashing algorithm with plain text and no salt. This is
+# *only* useful for debugging and unit testing.
+schemes = roundup_plaintext
diff --git a/src/mailman/testing/testing.cfg b/src/mailman/testing/testing.cfg
index 91613cc8d..5f19dca14 100644
--- a/src/mailman/testing/testing.cfg
+++ b/src/mailman/testing/testing.cfg
@@ -30,6 +30,9 @@ smtp_port: 9025
lmtp_port: 9024
incoming: mailman.testing.mta.FakeMTA
+[passwords]
+path: python:mailman.testing.passlib
+
[webservice]
port: 9001