summaryrefslogtreecommitdiff
path: root/src/mailman/testing/helpers.py (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Several optimizations:Barry Warsaw2016-01-111-2/+1
| | | | | | | | | | | | * Use `yield from` wherever appropriate. * Use SA's .one_or_none() where appropriate. - Fix a bug in MailingList.pass_extensions. - Use ValueError in other places for consistency. - Remove unreached/nonsense code. - Simplify the SubscriptionService.find_member() and .find_members() implementations. - Boost coverage.
* Happy New Year.Barry Warsaw2016-01-021-1/+1
|
* Core no longer depends on the standalone `mock` module. (Closes: #146)Barry Warsaw2015-09-221-1/+1
|
* Extended test helper subscribe() which takes an optional email address andBarry Warsaw2015-03-261-8/+13
| | | | returns the newly created member.
* We don't need the 'six' package any more.Barry Warsaw2015-01-041-2/+2
|
* Bump copyright years.Barry Warsaw2015-01-041-1/+1
|
* Remove huge amounts of now unnecessary file boilerplate.Barry Warsaw2014-12-221-8/+4
|
* Trunk merge.Barry Warsaw2014-12-221-21/+19
|\
| * * Fixed `AttributeError` on MIME digest messages. Given by Aurélien Bompard.Barry Warsaw2014-12-101-1/+24
| |\ | | | | | | | | | (LP: #1130696)
| | * LP: #1130696 - AttributeError on .senderBarry Warsaw2014-12-101-0/+23
| |/|
| | * Make the MIMEDigester generate a subclass of MIMEMultipart with our additionsAurélien Bompard2014-12-091-0/+22
| |/ | | | | | | Fixes bug #1130696 (differently)
* | Move internationalized digest tests to unittests.Barry Warsaw2014-12-201-0/+25
| |
* | Better, but not perfect handler test passing.Barry Warsaw2014-12-151-2/+3
| |
* | Fix some basic REST plumbing, and make test_rosters pass.Barry Warsaw2014-12-111-1/+4
| |
* | Checkpointing.Barry Warsaw2014-11-301-6/+5
|/ | | | | | | | | | By using `six` I think I have most of the imports squared away. There's probably still uses of `unicode` built-ins that need fixing. The idea is to first get the test suite running (which it doesn't yet), and then to fix tests. There's a bug in lazr.config which requires us to patch it for now.
* * Fixed Unicode errors in the digest runner and when sending messages to theBarry Warsaw2014-11-291-0/+5
| | | | | | | | | | | site owner as a fallback. Given by Aurélien Bompard. (LP: #1130957). Also: * Convert some uses of the unicode() built-in to bytes.decode() in preparation for Python 3 and to eliminate some pyflakes errors. * Added LogFileMark.read() as a convenience method.
* First pass at converting to falcon for the REST API layer.Barry Warsaw2014-08-121-2/+3
| | | | | Currently, only /<api>/system and its subpaths work, but basic auth does work too. Requires a refactoring modification to falcon.
* Several internal improvements:Barry Warsaw2014-01-061-0/+2
| | | | | | | | | | | | | | | | | | | | | | * New events: - ConfirmationNeededEvent is triggered when a pendable requiring confirmation is created. This allows us to define an event handler for this event which sends the user notification. - SubscriptionEvent is triggered when a member is added to a mailing list. This lets us define an event handler which sends the welcome message. * send_welcome_message() now takes a member parameter instead of an address, which lets us directly access the member's delivery mode and user display name (if the member has a user, which it might not in some cases). * Use the list id in the pendable record instead of the list name for robustness (the latter can change but the former is permanent). * Test more registration conditions. * In the bin/runner command line switch handling, default `verbose` to None instead of False. This makes it work better with nose's -E switch (log to stderr). * In call_api(), if a POST, PUT, or PATCH method is used and data is None, encode the empty dictionary; seems like the behavior of urlencode() has changed, so this is safer. * Fix style and pyflakes warnings.
* Bump copyright years.Barry Warsaw2014-01-011-1/+1
|
* Fix a couple of intermittent test problems.Barry Warsaw2013-12-011-0/+2
|
* More fixes.Barry Warsaw2013-11-261-0/+4
|
* Bump copyright years.Barry Warsaw2013-01-011-1/+1
|
* * The default list style is renamed to `legacy-default` and a newBarry Warsaw2012-12-301-0/+1
| | | | | | | | `legacy-announce` style is added. This is similar to the `legacy-default` except set up for announce-only lists. Also, major refactoring of the default style into (hopefully) smaller composable units.
* * Deleting a user through the REST API also deletes all the user's linkedBarry Warsaw2012-11-051-1/+0
| | | | | | addresses and memberships. (LP: #1074374) Also: Clean up pyflakes warning by removing an obsolete __all__ entry.
* * Python 2.7 is not required. Python 2.6 is no longer officially supported.Barry Warsaw2012-10-311-20/+4
| | | | | The code base is now also `python2.7 -3` clean, although there are still some warnings in 3rd party dependencies. LP: #1073506
* trunk mergeBarry Warsaw2012-07-061-19/+27
|\
| * More consistency in the way post-configuration changes are processed. LessBarry Warsaw2012-07-021-2/+2
| | | | | | | | | | | | | | | | | | | | magic in the _post_process() method, more ConfigurationUpdatedEvents. More centralization of event initialization. Added property Configuration.language_configs. Instead of initializing events in initialize_2(), initialize them in initialize_1() and do it before the configuration is loaded.
| * * `passlib`_ is now used for all password hashing instead of flufl.password.Barry Warsaw2012-07-021-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The default hash is `sha512_crypt`. * 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.
| * - Modernize the helpers.py module by using print() functions.Barry Warsaw2012-04-221-16/+18
| | | | | | | | | | - Rewrite soem of the code to use the new transaction context manager, instead of explicitly accessing the config.db global.
* | - Refactor the way databases are schema-migrated so that load_migrations()Barry Warsaw2012-04-081-0/+30
|/ | | | | | | | | | | | | | | can be tested separately. - Add an `until` argument to load_migrations() so that we can load only up to a given timestamp. - In load_migrations(), ignore files in which the `version` part of the file name is empty. - In migrations.rst, use the new, better way of ensuring post-test cleanup. - Add tests for partial upgrades. - LP: #971013 - schema migrations for beta 2. - LP: #967238 - IMailingList.archive + IMailingList.archive_private -> IMailingList.archive_policy, and add ArchivePolicy enum. - Move the `chdir` context manager to helpers.py and add `temporary_db` context manager.
* * Header check specifications in the `mailman.cfg` file have changed quiteBarry Warsaw2012-04-061-0/+2
| | | | | | | | | | | | | | | | | | | | bit. The previous `[spam.header.foo]` sections have been removed. Instead, there's a new `[antispam]` section that contains a `header_checks` variable. This variable takes multiple lines of `Header: regexp` values, one per line. There is also a new `jump_chain` variable which names the chain to jump to should any of the header checks (including the list-specific, and programmatically added ones) match. * Fixed a typo when returning the configuration file's header match checks. (LP: #953497) Also: - Remove an unused method. - Improve test coverage for mailman/app/bounces.py - 100% test coverage for mailman/chains/headers.py - Various other minor code cleanup. - Fixed the 'any' rule, which was checking a bogus metadata dictionary key.
* - Improve the NNTP doctest.Barry Warsaw2012-04-021-0/+20
| | | | | - Add a `cleanups` global to doctests. This can be used to register functions which will get called automatically at doctest tearDown time.
* - 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.