summaryrefslogtreecommitdiff
path: root/src/mailman/testing/helpers.py
Commit message (Collapse)AuthorAgeFilesLines
...
* - More tests of mailman.runners.nntp.prepare_message(), this time of theBarry Warsaw2012-04-011-0/+41
| | | | | | | | | header removal and de-duplication algorithms. - Improve the robustness of the de-duplication code. - Add a very nice helper called `configuration` which can be used either as a decorator or context manager to temporarily set values in a configuration section. No more need to manage pushes/pops. More code needs to be converted to use this style.
* Several fixes and cleanups, ostensibly to fix Python 2.6 support.Barry Warsaw2012-03-221-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | - email.iterators.body_line_iterator() cannot handle unicodes in Python 2.6, because it uses cStringIO.StringIO under the covers, and *that* can't handle unicode. This works fine in Python 2.7, so I override this for the tests only under 2.6 (the code itself isn't affected). - AddressError needs to str() its IAddress attribute explicitly in the __str__() method, otherwise under Python 2.6, you'll get unprintable reprs in the doctests. Again, this works correctly in 2.7, but EIBTI, so it can't hurt either way. - EmailError: a new exception, not related to AddressError. The reason for this it to conform to current nomenclature: "address" means an IAddress while "email" means a text email address. So InvalidEmailAddressError now derives from EmailError instead of AddressError because it gets passed a text email address, and because that is invalid, it never gets turned into an IAddress. The __str__() of this new base exception class does some tricky encoding to keep it compatible between Python 2.6 and 2.7. - UnverifiedAddressError derives from AddressError instead of the more generic MailmanError. - A few random code cleanups are included.
* * The LMTP server now requires that the incoming message have a `Message-ID`,Barry Warsaw2012-03-131-2/+3
| | | | | | | | | | | otherwise it rejects the message with a 550 error. Also, the LMTP server adds the `X-Message-ID-Hash` header automatically. The `inject` cli command will also add the `X-Message-ID-Hash` header, but it will craft a `Message-ID` header first if one is missing from the injected text. Also, `inject` will always set the correct value for the `original_size` attribute on the message object, instead of trusting a possibly incorrect value if it's already set. The individual `IArchiver` implementations no longer set the `X-Message-ID-Hash` header.
* * The `join` email command no longer accepts an `address=` argument. ItsBarry Warsaw2012-02-291-1/+1
| | | | | | | | | `digest=` argument now accepts the following values: `no` (for regular delivery), `mime`, or `plain`. Also: - Fix get_queue_messages() to properly sort on the string representation of a header, since it could be a Header instance.
* * Stop adding the X-BeenThere header.Barry Warsaw2011-11-061-1/+6
| | | | | | | * Separate out the RFC 2369 header adding handler. * Dynamically calculate the `List-Id` header instead of storing it in the database. This means it cannot be changed. * Be sure to clean out any digest .mmdf files when the world is reset.
* * Implement the style manager as a utility instead of an attribute hangingBarry Warsaw2011-10-241-1/+2
| | | | | | off the `mailman.config.config` object. * Fixed bogus use of `bounce_processing` attribute (should have been `process_bounces`, with thanks to Vincent Fretin. (LP: #876774)
* Complete bug 827036 work.Barry Warsaw2011-08-171-0/+1
| | | | | | | | | | | * Add ListCreatingEvent and ListDeletingEvent. These are sent before the operation actually occurs, whereas the previously added ListCreatedEvent and ListDeletedEvent are sent after the operation. Specifically, this is necessary because request database deletion requires the IMailingList object, which is only available before the list is deleted. * Add a handler to clear out the requests database for a mailing list, when the mailing list is about to be deleted.
* Major terminology shift:Barry Warsaw2011-06-011-11/+9
| | | | | | | | | | | | | | | | | * Queue runners are now called just 'Runners' since several of them don't manage queue directories. * Ban the term 'qrunner' too. * The master queue runner watcher should now just be called the 'master' or the 'master runner'. * bin/qrunner -> bin/runner * mailman.qrunner log file -> mailman.runner * master-qrunner.lck -> master.lck * master-qrunner.pid -> master.pid Also: * Remove some obsolete files * Begin the .txt -> .rst renaming
* * bounce_unrecognized_goes_to_list_owner -> forward_unrecognized_bounces_to Barry Warsaw2011-05-251-1/+16
| | | | | | | | | | | | * Add an additional option for unrecognized bounce disposition: send it to the site administrators. * Move maybe_forward() from src/mailman/queue/bounce.py to src/mailman/app/bounces.py, refactor and add tests. * Add a LogFileMark class to help with tests that want to check the output to a log file. * OwnerNotification gets a better signature. Instead of tomoderators, the last argument is a roster to send the notification to. If roster is None, then the notification goes to the site administrators.
* oh wellBarry Warsaw2011-05-141-2/+1
|
* Add tests for the outgoing queue runner.Barry Warsaw2011-05-141-3/+11
| | | | | | | * Use m.u.datetime.now() instead of datetime.now() * Add a predicate argument to make_testable_runner() so that we can e.g. pass in a function that causes the queue runner to run only once. * Minor improvement to get_queue_messages() so that it doesn't need a lambda.
* Move the test timeout values into a configuration variable. Set devmode.waitBarry Warsaw2011-05-031-11/+14
| | | | to the timeout value you want.
* Start the enablement of bounce detection.Barry Warsaw2011-05-011-0/+21
| | | | | | | | | | * Move VERP header extraction to mailman.app.bounces, and ports the implementation to the get_verp() function. * Restore the [mta] verp_regexp value which got lost along the way. * Move mailman.email.utils to mailman.utilities.email and add a test for split_email() * Move specialized_message_from_string() from test_documentation to mailman.testing.helpers.
* * Move members.txt corner cases to unittests.Barry Warsaw2011-04-201-0/+53
| | | | | | | * Fix a case in a list's /members API where the listname is bogus. * Catch NotAMemberError form delete_member() and return not_found. * Refactor REST helpers so that call_api() can be used in unittests without doing any prints to stdout.
* Refactor .subscribe() from IAddress to IMailingList.Barry Warsaw2011-04-161-3/+3
|
* Fixed a typo in add_member() which prevented subscribing an email address thatBarry Warsaw2011-01-311-0/+30
| | | | | | | | was already linked to a user. Found by Florian Fuchs who also provided the fix, though I implemented the test differently. LP: #710182 Also, refactor the "reset the world" functionality ConfigLayer.testTearDown() so that it could be used by other test code.
* Split member and nonmember moderation.Barry Warsaw2011-01-021-7/+16
| | | | | | | | | | | | | | | | * member-moderation happens at the same place in the built-in chain that the previously named moderation rule happens. nonmember-moderation happens after all the other normal moderation rules. * Handle unsubscribed nonmember posts. Other changes: * Message.senders now filters out Nones and empty strings. * Various test cleanups and simplifications. * More `address` -> `email` fixes. * Give Link class a useful repr. * Fix a potential UnboundLocalError. * Various other small changes.
* Fix the obvious errors identified by pyflakes. Skip false positives (mostlyBarry Warsaw2010-10-081-2/+0
| | | | | due to _() interpolation) and a few other problems that did not have immediately obvious fixes.
* * Fix the bin/test -e/--stderr option to work with the currentBarry Warsaw2010-06-181-0/+18
| | | | | | | | | | | | | zope.testrunner. Actually, divorce it from the latter and handle the sys.argv sequence ourselves. * Added IMailingList.get_roster() which returns the named roster (from a MemberRole enum). * The start of an IMailingList doctest. This needs much more detail. * Move the subscribe() function from membership.txt into the mailman.testing.helpers. * Added new REST interface for getting all the members of a roster for a specific mailing list: .../lists/<list>/roster/<role>. Note that <role> is the plural form of the MemberRole enum.
* Chains now fire Zope events in their _process() implementation.Barry Warsaw2010-02-161-1/+24
| | | | Clean up the chains.txt doctest to use this and other recent improvements.
* Happy New Year.Barry Warsaw2010-01-011-1/+1
|
* The delivery agent requires that the message object have a .original_sizeBarry Warsaw2009-12-041-1/+0
| | | | attribute. Add this for UserNotifications.
* Use lazr.smtptest instead of our own SMTPServer and test SMTPd.Barry Warsaw2009-10-151-60/+0
| | | | | Update the lazr.restful IWebServiceConfiguration implementation to include the new hop_by_hop_headers attribute, by way of BaseWSGIWebServiceConfiguration.
* When testing, the signal.pause() is a problem because the TestableMaster isBarry Warsaw2009-10-151-1/+7
| | | | | never killed with a signal. In the real-world, it is though. So put the .pause() in a method that can be overridden by TestableMaster.
* Set testing threads as daemon so they won't hang.Barry Warsaw2009-06-291-0/+2
| | | | Fix system absolute url.
* More tests for the REST server, this time, for the queue runner.Barry Warsaw2009-05-101-1/+28
| | | | | | | | | | | Add logging to the RESTRunner. Also, use pkg_resources.resource_stream() instead of .resource_string() where appropriate. Add a bunch of XXX comments for things I need to figure out about the Zope-ish parts of the lazr.restful implementation. Change __getitem__() api to _lookup().
* Minor cleanupsBarry Warsaw2009-03-051-2/+5
|
* Massive digester rework.Barry Warsaw2009-02-041-3/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This moves actual digest creation and sending into a new queue runner. That way, digest creation does not block the main incoming processor. Lots of code clean up and reorganization too, and many fixes. digest_last_sent_at: Make this a DateTime digest_size_threshold: Make this a Float digest_volume_frequency: Make this an Enum DigestFrequency: new enum Fix up IMailingList interface to reflect reality. In Runner base class, allow for msg.get_sender() to return a False value. If this happens (as it can with the empty marker messages used to signal the digester that there's work to do), just use the list's preferred language. Give the retry.py and incoming.py queue runner modules some proper epilogues. The EmptyingRunner (for testing) logs itself as the runner its wrapping. The digest file name now ends in .mmdf since that's the format we're using. Add 'create_list' to doctest globals. Add a Mailbox class to add support for the context manager protocol.
* Push the source directory into a 'src' subdirectory so that zc.buildout worksBarry Warsaw2009-01-251-0/+248
correctly regardless of how it's used.