diff options
Diffstat (limited to 'src/mailman/testing')
| -rw-r--r-- | src/mailman/testing/config-with-instances.pck | bin | 0 -> 4667 bytes | |||
| -rw-r--r-- | src/mailman/testing/helpers.py | 26 |
2 files changed, 6 insertions, 20 deletions
diff --git a/src/mailman/testing/config-with-instances.pck b/src/mailman/testing/config-with-instances.pck Binary files differnew file mode 100644 index 000000000..b5173f58f --- /dev/null +++ b/src/mailman/testing/config-with-instances.pck diff --git a/src/mailman/testing/helpers.py b/src/mailman/testing/helpers.py index 476211a08..8fa4fbd2f 100644 --- a/src/mailman/testing/helpers.py +++ b/src/mailman/testing/helpers.py @@ -33,7 +33,6 @@ __all__ = [ 'reset_the_world', 'specialized_message_from_string', 'subscribe', - 'subscribe_ex', 'temporary_db', 'wait_for_webservice', ] @@ -437,7 +436,10 @@ class chdir: def subscribe(mlist, first_name, role=MemberRole.member, email=None): - """Helper for subscribing a sample person to a mailing list.""" + """Helper for subscribing a sample person to a mailing list. + + Returns the newly created member object. + """ user_manager = getUtility(IUserManager) email = ('{0}person@example.com'.format(first_name[0].lower()) if email is None else email) @@ -453,25 +455,9 @@ def subscribe(mlist, first_name, role=MemberRole.member, email=None): subscription_address = address else: subscription_address = list(person.addresses)[0] - # We can't return the newly created member because that will - # implicitly open a new transaction, which can break doctests. If you - # really need the newly created member, look it up. mlist.subscribe(subscription_address, role) - - -def subscribe_ex(mlist, first_name, role=MemberRole.member, email=None): - """Like ``subscribe()`` but returns the newly created member object. - - Only use this in contexts where you can accept the opening of an implicit - transaction (i.e. *not* in REST tests) unless you explicitly close said - transaction. Otherwise you will lock the database. - """ - # Blarg. I wish we didn't have to duplicate this logic. - email = ('{0}person@example.com'.format(first_name[0].lower()) - if email is None else email) - subscribe(mlist, first_name, role, email) - roster = mlist.get_roster(role) - return roster.get_member(email) + roster = mlist.get_roster(role) + return roster.get_member(email) |
