summaryrefslogtreecommitdiff
path: root/src/mailman/testing
diff options
context:
space:
mode:
Diffstat (limited to 'src/mailman/testing')
-rw-r--r--src/mailman/testing/documentation.py7
-rw-r--r--src/mailman/testing/helpers.py25
-rw-r--r--src/mailman/testing/layers.py6
-rw-r--r--src/mailman/testing/mailman-fr.mobin1992 -> 1893 bytes
-rw-r--r--src/mailman/testing/mailman-fr.po12
5 files changed, 22 insertions, 28 deletions
diff --git a/src/mailman/testing/documentation.py b/src/mailman/testing/documentation.py
index f3a6e335a..29629fe1b 100644
--- a/src/mailman/testing/documentation.py
+++ b/src/mailman/testing/documentation.py
@@ -25,7 +25,8 @@ from inspect import isfunction, ismethod
from mailman import public
from mailman.app.lifecycle import create_list
from mailman.config import config
-from mailman.testing.helpers import call_api, specialized_message_from_string
+from mailman.testing.helpers import (
+ call_api, get_queue_messages, specialized_message_from_string, subscribe)
from mailman.testing.layers import SMTPLayer
@@ -92,7 +93,7 @@ def call_http(url, data=None, method=None, username=None, password=None):
content, response = call_api(url, data, method, username, password)
if content is None:
for header in sorted(response):
- print('{0}: {1}'.format(header, response[header]))
+ print('{}: {}'.format(header, response[header]))
return None
return content
@@ -145,9 +146,11 @@ def setup(testobj):
testobj.globs['dump_json'] = dump_json
testobj.globs['dump_msgdata'] = dump_msgdata
testobj.globs['dump_list'] = dump_list
+ testobj.globs['get_queue_messages'] = get_queue_messages
testobj.globs['message_from_string'] = specialized_message_from_string
testobj.globs['smtpd'] = SMTPLayer.smtpd
testobj.globs['stop'] = stop
+ testobj.globs['subscribe'] = subscribe
testobj.globs['transaction'] = config.db
# Add this so that cleanups can be automatically added by the doctest.
testobj.globs['cleanups'] = []
diff --git a/src/mailman/testing/helpers.py b/src/mailman/testing/helpers.py
index a87dd58ec..a57d883c7 100644
--- a/src/mailman/testing/helpers.py
+++ b/src/mailman/testing/helpers.py
@@ -21,7 +21,6 @@ import os
import json
import time
import uuid
-import errno
import shutil
import signal
import socket
@@ -228,11 +227,8 @@ def get_lmtp_client(quiet=False):
if not quiet:
print(response)
return lmtp
- except IOError as error:
- if error.errno == errno.ECONNREFUSED:
- time.sleep(0.1)
- else:
- raise
+ except ConnectionRefusedError:
+ time.sleep(0.1)
else:
raise RuntimeError('Connection refused')
@@ -256,18 +252,16 @@ def get_nntp_server(cleanups):
@public
-def wait_for_webservice():
+def wait_for_webservice(hostname=None, port=None):
"""Wait for the REST server to start serving requests."""
+ hostname = config.webservice.hostname if hostname is None else hostname
+ port = int(config.webservice.port) if port is None else port
until = datetime.datetime.now() + as_timedelta(config.devmode.wait)
while datetime.datetime.now() < until:
try:
- socket.socket().connect((config.webservice.hostname,
- int(config.webservice.port)))
- except IOError as error:
- if error.errno == errno.ECONNREFUSED:
- time.sleep(0.1)
- else:
- raise
+ socket.socket().connect((hostname, port))
+ except ConnectionRefusedError:
+ time.sleep(0.1)
else:
break
else:
@@ -475,6 +469,9 @@ def reset_the_world():
for filename in filenames:
os.remove(os.path.join(dirpath, filename))
shutil.rmtree(dirpath)
+ # Remove all the cache subdirectories, recursively.
+ for dirname in os.listdir(config.CACHE_DIR):
+ shutil.rmtree(os.path.join(config.CACHE_DIR, dirname))
# Reset the global style manager.
getUtility(IStyleManager).populate()
# Remove all dynamic header-match rules.
diff --git a/src/mailman/testing/layers.py b/src/mailman/testing/layers.py
index a282b2803..3157809e6 100644
--- a/src/mailman/testing/layers.py
+++ b/src/mailman/testing/layers.py
@@ -158,7 +158,7 @@ class ConfigLayer(MockAndMonkeyLayer):
[logging.$name]
propagate: yes
level: debug
- """), dict(name=sub_name, path=path))
+ """), None, dict(name=sub_name, path=path))
# The root logger will already have a handler, but it's not the right
# handler. Remove that and set our own.
if cls.stderr:
@@ -200,9 +200,7 @@ class ConfigLayer(MockAndMonkeyLayer):
def testSetUp(cls):
# Add an example domain.
with transaction():
- getUtility(IDomainManager).add(
- 'example.com', 'An example domain.',
- 'http://lists.example.com')
+ getUtility(IDomainManager).add('example.com', 'An example domain.')
@classmethod
def testTearDown(cls):
diff --git a/src/mailman/testing/mailman-fr.mo b/src/mailman/testing/mailman-fr.mo
index 5758baf60..539d8760d 100644
--- a/src/mailman/testing/mailman-fr.mo
+++ b/src/mailman/testing/mailman-fr.mo
Binary files differ
diff --git a/src/mailman/testing/mailman-fr.po b/src/mailman/testing/mailman-fr.po
index ca4ce8c32..d7061f74e 100644
--- a/src/mailman/testing/mailman-fr.po
+++ b/src/mailman/testing/mailman-fr.po
@@ -20,9 +20,8 @@ msgid ""
"Send $display_name mailing list submissions to\n"
"\t$got_list_email\n"
"\n"
-"To subscribe or unsubscribe via the World Wide Web, visit\n"
-"\t$got_listinfo_url\n"
-"or, via email, send a message with subject or body 'help' to\n"
+"To subscribe or unsubscribe via email, send a message with subject or body\n"
+"'help' to\n"
"\t$got_request_email\n"
"\n"
"You can reach the person managing the list at\n"
@@ -34,11 +33,8 @@ msgstr ""
"Envoyez vos messages pour la liste $display_name à\n"
"\t$got_list_email\n"
"\n"
-"Pour vous (dés)abonner par le web, consultez\n"
-"\t$got_listinfo_url\n"
-"\n"
-"ou, par courriel, envoyez un message avec « help » dans le corps\n"
-"ou dans le sujet à\n"
+"Pour vous (dés)abonner par courriel, envoyez un message avec « help » dans\n"
+"le corps ou dans le sujet à\n"
"\t$got_request_email\n"
"\n"
"Vous pouvez contacter l'administrateur de la liste à l'adresse\n"