Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package python-mailmanclient for
openSUSE:Factory checked in at 2021-02-07 15:17:04
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-mailmanclient (Old)
and /work/SRC/openSUSE:Factory/.python-mailmanclient.new.28504 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-mailmanclient"
Sun Feb 7 15:17:04 2021 rev:5 rq:869114 version:3.3.2
Changes:
--------
---
/work/SRC/openSUSE:Factory/python-mailmanclient/python-mailmanclient.changes
2020-08-04 20:23:43.917011694 +0200
+++
/work/SRC/openSUSE:Factory/.python-mailmanclient.new.28504/python-mailmanclient.changes
2021-02-07 15:18:40.865733811 +0100
@@ -1,0 +2,26 @@
+Thu Feb 4 00:11:53 UTC 2021 - Jan Engelhardt <[email protected]>
+
+- Avoid name repetition (e.g. rpmlint's name-repeated-in-summary)
+
+-------------------------------------------------------------------
+Wed Feb 3 16:36:32 UTC 2021 - Andreas Schneider <[email protected]>
+
+- Update to 3.3.2
+ * Add two new get_requests() and get_requests_count() to get pending
+ subscription requests``MailingList.get_requests`` is the new API to fetch
+ pending requests and supersedes the previous requests property. (See !121)
+ * Add Member.subscription_mode to determine if a User is subscribed or an
+ Address. (See !121)
+ * Add a new get_held_count() API to get a count of held messages for a
+ MailingList. (See !122)
+ * Add display_name to the pending subscription requests. (Fixes #55)
+ * Allow setting a Member's address attribute. (See !128)
+ * Add support for inviting an email address to join a list.
+ * Rewrite urls according to the baseurl used to instantiate Client instead of
+ relying on self_link. (Fixes #22)
+ * Add get_request API to MailingList to get individual request objects.
+ * Add send_welcome_message parameter to MailingList.subscribe() to suppress
+ welcome message. (Closes #61)
+- Fix build on tumbleweed
+
+-------------------------------------------------------------------
Old:
----
mailmanclient-3.3.1.tar.gz
New:
----
mailmanclient-3.3.2.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-mailmanclient.spec ++++++
--- /var/tmp/diff_new_pack.CFHeuK/_old 2021-02-07 15:18:41.397734698 +0100
+++ /var/tmp/diff_new_pack.CFHeuK/_new 2021-02-07 15:18:41.401734705 +0100
@@ -1,7 +1,7 @@
#
# spec file for package python-mailmanclient
#
-# Copyright (c) 2020 SUSE LLC
+# Copyright (c) 2021 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -18,10 +18,13 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%define skip_python2 1
+%if 0%{?suse_version} >= 1550
+%define skip_python36 1
+%endif
Name: python-mailmanclient
-Version: 3.3.1
+Version: 3.3.2
Release: 0
-Summary: mailmanclient -- Python bindings for Mailman REST API
+Summary: Python bindings for the Mailman REST API
License: LGPL-3.0-only
URL: https://www.list.org/
Source:
https://files.pythonhosted.org/packages/source/m/mailmanclient/mailmanclient-%{version}.tar.gz
@@ -41,10 +44,10 @@
%python_subpackages
%description
-mailmanclient -- Python bindings for Mailman REST API
+Python bindings for Mailman REST API.
%prep
-%setup -q -n mailmanclient-%{version}
+%autosetup -n mailmanclient-%{version}
%build
export LC_ALL=C.UTF-8
++++++ mailmanclient-3.3.1.tar.gz -> mailmanclient-3.3.2.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/mailmanclient-3.3.1/PKG-INFO
new/mailmanclient-3.3.2/PKG-INFO
--- old/mailmanclient-3.3.1/PKG-INFO 2020-06-02 05:39:22.932331300 +0200
+++ new/mailmanclient-3.3.2/PKG-INFO 2021-01-11 06:36:53.216249700 +0100
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: mailmanclient
-Version: 3.3.1
+Version: 3.3.2
Summary: mailmanclient -- Python bindings for Mailman REST API
Home-page: http://www.list.org/
Maintainer: Barry Warsaw
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/mailmanclient-3.3.1/src/mailmanclient/constants.py
new/mailmanclient-3.3.2/src/mailmanclient/constants.py
--- old/mailmanclient-3.3.1/src/mailmanclient/constants.py 2020-06-02
05:37:27.000000000 +0200
+++ new/mailmanclient-3.3.2/src/mailmanclient/constants.py 2020-07-18
21:01:42.000000000 +0200
@@ -15,7 +15,7 @@
# along with mailmanclient. If not, see <http://www.gnu.org/licenses/>.
-__version__ = '3.3.1'
+__version__ = '3.3.2'
DEFAULT_PAGE_ITEM_COUNT = 50
MISSING = object()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/mailmanclient-3.3.1/src/mailmanclient/docs/NEWS.rst
new/mailmanclient-3.3.2/src/mailmanclient/docs/NEWS.rst
--- old/mailmanclient-3.3.1/src/mailmanclient/docs/NEWS.rst 2020-06-02
05:37:27.000000000 +0200
+++ new/mailmanclient-3.3.2/src/mailmanclient/docs/NEWS.rst 2021-01-11
06:02:08.000000000 +0100
@@ -3,6 +3,28 @@
=======================
+.. _news-3.3.2:
+
+3.3.2 (2021-01-10)
+==================
+
+- Add two new ``get_requests()`` and ``get_requests_count()`` to get pending
+ subscription requests``MailingList.get_requests`` is the new API to fetch
+ pending requests and supersedes the previous ``requests`` property. (See
+ !121)
+- Add ``Member.subscription_mode`` to determine if a User is subscribed or an
+ Address. (See !121)
+- Add a new ``get_held_count()`` API to get a count of held messages for a
+ ``MailingList``. (See !122)
+- Add ``display_name`` to the pending subscription requests. (Fixes #55)
+- Allow setting a ``Member``'s ``address`` attribute. (See !128)
+- Add support for inviting an email address to join a list.
+- Rewrite urls according to the ``baseurl`` used to instantiate ``Client``
+ instead of relying on ``self_link``. (Fixes #22)
+- Add ``get_request`` API to MailingList to get individual request objects.
+- Add ``send_welcome_message`` parameter to MailingList.subscribe() to suppress
+ welcome message. (Closes #61)
+
3.3.1 (2020-06-01)
==================
@@ -52,13 +74,13 @@
-------
* Add '.pc' (patch directory) to list of ignored patterns when building the
- documentation with Sphinx.
+ documentation with Sphinx.
* `Mailinglist.add_owner` and `Mailinglist.add_moderator` now accept an
additional `display_name` argument that allows associating display names with
these memberships.
* Add a new API ``Client.find_lists`` which allows filtering mailing lists
- related to a subscriber. It optionally allows a role, which filters the
lists
- that the address is subscribed to with that role.
+ related to a subscriber. It optionally allows a role, which filters the lists
+ that the address is subscribed to with that role.
Backwards Incompatible Changes
-------------------------------
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/mailmanclient-3.3.1/src/mailmanclient/docs/using.rst
new/mailmanclient-3.3.2/src/mailmanclient/docs/using.rst
--- old/mailmanclient-3.3.1/src/mailmanclient/docs/using.rst 2020-06-02
05:37:27.000000000 +0200
+++ new/mailmanclient-3.3.2/src/mailmanclient/docs/using.rst 2021-01-11
04:43:46.000000000 +0100
@@ -24,6 +24,11 @@
python_version: ...
self_link: http://localhost:9001/3.1/system/versions
+.. note::
+ The content accessible via mailmanclient depends heavily on the version
+ of the mailman core REST API it's connecting to. See `Core REST API
+ docs`_ for more details.
+
To start with, there are no known mailing lists.
>>> client.lists
@@ -263,6 +268,18 @@
>>> print(data['token_owner'])
subscriber
+We can also invite an email address to join the list. This will send an
+invitation email to the address for the user to accept. Here again we get a
+response with a token:
+
+ >>> data = test_one.subscribe('[email protected]',
+ ... 'Invitee',
+ ... invitation=True)
+ >>> data['token'] is not None
+ True
+ >>> print(data['token_owner'])
+ subscriber
+
If we know the email address to be valid, we can set the
``pre_verified`` flag. However, the list's subscription policy is
"confirm", so if we try to subscribe a user, we will also get a token
@@ -492,6 +509,7 @@
>>> for user in client.users:
... print(user.display_name)
Unverified
+ Invitee
Unconfirmed
Anna
Bill
@@ -506,13 +524,13 @@
>>> page.nr
1
>>> page.total_size
- 8
+ 9
>>> for user in page:
... print(user.display_name)
Unverified
+ Invitee
Unconfirmed
Anna
- Bill
You can get the next or previous pages without calling ``get_userpage`` again.
@@ -522,10 +540,10 @@
>>> for user in page:
... print(user.display_name)
+ Bill
Cris
Jack
Jill
- Hans
>>> page = page.previous
>>> page.nr
@@ -534,9 +552,9 @@
>>> for user in page:
... print(user.display_name)
Unverified
+ Invitee
Unconfirmed
Anna
- Bill
A single user can be retrieved using their email address.
@@ -694,7 +712,8 @@
User Subscriptions
------------------
-A User's subscriptions can be access through their ``subscriptions`` property.
+A User's subscriptions can be accessed through the User's ``subscriptions``
+property.
>>> bill = client.get_user('[email protected]')
>>> for subscription in bill.subscriptions:
@@ -848,7 +867,7 @@
... print(m)
Member "[email protected]" on "test-1.example.com"
-Members and owners/moderators are separate entries in in the general members
+Members and owners/moderators are separate entries in the general members
list:
>>> print(test_one.subscribe('[email protected]', 'Bar',
@@ -914,14 +933,14 @@
>>> confirm_first = example_dot_com.create_list('confirm-first')
>>> settings = confirm_first.settings
- >>> settings['subscription_policy'] = 'moderate'
+ >>> settings['subscription_policy'] = 'confirm_then_moderate'
>>> settings.save()
>>> confirm_first = client.get_list('confirm-first.example.com')
>>> print(confirm_first.settings['subscription_policy'])
- moderate
+ confirm_then_moderate
-Initially there are no requests, so let's to subscribe someone to the
+Initially there are no requests, so let's subscribe someone to the
list. We'll get a token back.
>>> confirm_first.requests
@@ -935,7 +954,7 @@
Now the request shows up in the list of requests:
>>> import time; time.sleep(5)
- >>> len(confirm_first.requests)
+ >>> confirm_first.get_requests_count()
1
>>> request_1 = confirm_first.requests[0]
@@ -950,23 +969,48 @@
>>> print(request_1['list_id'])
confirm-first.example.com
-Subscription requests can be accepted, deferred, rejected or
-discarded using the request token.
+It is possible to filter subscription requests based on who is it pending an
+action from using ``token_owner`` parameter::
>>> data = confirm_first.subscribe('[email protected]',
... pre_verified=True,
... pre_confirmed=True)
>>> data = confirm_first.subscribe('[email protected]',
... pre_verified=True,
- ... pre_confirmed=True)
+ ... pre_confirmed=False)
- >>> len(confirm_first.requests)
+ >>> confirm_first.get_requests_count()
3
+
+Possible values for ``token_owner`` include:
+- ``subscriber``
+- ``moderator``
+- ``no_one``
+
+
+All these are pending an approval from moderator::
+
+ >>> confirm_first.get_requests_count(token_owner='moderator')
+ 2
+
+Subscriptions which aren't ``pre_confirmed`` first require confirmation from
+the user if list's subscription policy is ``confirm`` or
+``confirm_then_moderate``::
+
+ >>> confirm_first.get_requests_count(token_owner='subscriber')
+ 1
+ >>> data = confirm_first.get_requests(token_owner='subscriber')[0]
+ >>> print(data['email'])
+ [email protected]
+
+Subscription requests can be accepted, deferred, rejected or
+discarded using the request token.
+
Let's accept Groucho:
>>> response = confirm_first.moderate_request(request_1['token'], 'accept')
- >>> len(confirm_first.requests)
+ >>> confirm_first.get_requests_count()
2
>>> request_2 = confirm_first.requests[0]
@@ -980,13 +1024,13 @@
Let's reject Harpo:
>>> response = confirm_first.moderate_request(request_2['token'], 'reject')
- >>> len(confirm_first.requests)
+ >>> confirm_first.get_requests_count()
1
Let's discard Zeppo's request:
>>> response = confirm_first.moderate_request(request_3['token'],
'discard')
- >>> len(confirm_first.requests)
+ >>> confirm_first.get_requests_count()
0
@@ -1018,13 +1062,13 @@
queue.
>>> while True:
- ... all_held = test_one.held
- ... if len(all_held) > 0:
+ ... if test_one.get_held_count() > 0:
... break
... time.sleep(0.1)
Messages held for moderation can be listed on a per list basis.
+ >>> all_held = test_one.held
>>> print(all_held[0].request_id)
1
@@ -1359,9 +1403,11 @@
default_language : en
email_commands_max_lines : 10
filtered_messages_are_preservable : no
+ hold_digest : no
html_to_plain_text_command : /usr/bin/lynx -dump $filename
layout : here
listname_chars : [-_.0-9a-z]
+ masthead_threshold : 4
noreply_address : noreply
pending_request_life : 3d
post_hook :
@@ -1374,3 +1420,5 @@
... domain.delete()
>>> for user in client.users:
... user.delete()
+
+.. _`Core REST API docs`:
https://docs.mailman3.org/projects/mailman/en/latest/src/mailman/rest/docs/rest.html
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/mailmanclient-3.3.1/src/mailmanclient/restbase/connection.py
new/mailmanclient-3.3.2/src/mailmanclient/restbase/connection.py
--- old/mailmanclient-3.3.1/src/mailmanclient/restbase/connection.py
2020-05-10 01:14:40.000000000 +0200
+++ new/mailmanclient-3.3.2/src/mailmanclient/restbase/connection.py
2021-01-11 04:43:46.000000000 +0100
@@ -15,7 +15,7 @@
# along with mailmanclient. If not, see <http://www.gnu.org/licenses/>.
from urllib.error import HTTPError
-from urllib.parse import urljoin, urlencode
+from urllib.parse import urljoin, urlencode, urlparse, urlunparse
from requests import request
@@ -58,6 +58,21 @@
else:
self.auth = (name, password)
+ def rewrite_url(self, url):
+ """rewrite url component with self.baseurl prefix "scheme://netloc"
+
+ :param url: the URL to rewrite
+ :type url: str
+ :return: modified URL
+ :rtype: str
+ """
+ # rewrite url component with self.baseurl prefix "scheme://netloc"
+ pbaseurl = urlparse(self.baseurl)
+ parsed = urlparse(url)
+ parsed = parsed._replace(scheme=pbaseurl.scheme,
+ netloc=pbaseurl.netloc)
+ return urlunparse(parsed)
+
def call(self, path, data=None, method=None):
"""Make a call to the Mailman REST API.
@@ -87,6 +102,7 @@
method = 'POST'
method = method.upper()
url = urljoin(self.baseurl, path)
+ url = self.rewrite_url(url)
try:
response = request(
url=url,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/mailmanclient-3.3.1/src/mailmanclient/restobjects/mailinglist.py
new/mailmanclient-3.3.2/src/mailmanclient/restobjects/mailinglist.py
--- old/mailmanclient-3.3.1/src/mailmanclient/restobjects/mailinglist.py
2020-06-02 05:37:27.000000000 +0200
+++ new/mailmanclient-3.3.2/src/mailmanclient/restobjects/mailinglist.py
2021-01-11 04:43:46.000000000 +0100
@@ -131,15 +131,35 @@
url = 'lists/{0}/held'.format(self.fqdn_listname)
return Page(self._connection, url, HeldMessage, count, page)
+ def get_held_count(self):
+ """Get a count of held messages."""
+ response, json = self._connection.call(
+ 'lists/{}/held/count'.format(self.fqdn_listname), None, 'GET')
+ return json['count']
+
def get_held_message(self, held_id):
url = 'lists/{0}/held/{1}'.format(self.fqdn_listname, held_id)
return HeldMessage(self._connection, url)
@property
def requests(self):
- """Return a list of dicts with subscription requests."""
- response, content = self._connection.call(
- 'lists/{0}/requests'.format(self.fqdn_listname), None, 'GET')
+ """See :meth:`get_requests`."""
+ return self.get_requests()
+
+ def get_requests(self, token_owner=None):
+ """Return a list of dicts with subscription requests.
+
+ This is the new API for requests which allows filtering via
+ `token_owner` since it isn't possible to do so via the property
+ requests.
+
+ :param token_owner: Who owns the pending requests? Should be one in
+ 'no_one', 'moderator' and 'subscriber'.
+ """
+ url = 'lists/{0}/requests'.format(self.fqdn_listname)
+ if token_owner:
+ url += '?token_owner={}'.format(token_owner)
+ response, content = self._connection.call(url, None, 'GET')
if 'entries' not in content:
return []
else:
@@ -147,12 +167,39 @@
for entry in content['entries']:
request = dict(email=entry['email'],
token=entry['token'],
+ display_name=entry['display_name'],
token_owner=entry['token_owner'],
list_id=entry['list_id'],
request_date=entry['when'])
entries.append(request)
return entries
+ def get_requests_count(self, token_owner=None):
+ """Return a total count of pending subscription requests.
+
+ This should be a faster query when *all* the requests aren't needed and
+ only a count is needed to display on the badge in List's settings page.
+
+ :param token_owner: Who owns the pending requests? Should be one in
+ 'no_one', 'moderator' and 'subscriber'.
+ :returns: The count of pending requests.
+ """
+ url = 'lists/{}/requests/count'.format(self.fqdn_listname)
+ if token_owner:
+ url += '?token_owner={}'.format(token_owner)
+ response, json = self._connection.call(url)
+ return json['count']
+
+ def get_request(self, token):
+ """Get an individual pending request for the given token.
+
+ :param token: The token for the request.
+ :returns: The request dictionary.
+ """
+ url = 'lists/{}/requests/{}'.format(self.fqdn_listname, token)
+ response, json = self._connection.call(url)
+ return json
+
@property
def archivers(self):
url = 'lists/{0}/archivers'.format(self.list_id)
@@ -309,19 +356,24 @@
return self._get_membership(email, 'nonmember')
def subscribe(self, address, display_name=None, pre_verified=False,
- pre_confirmed=False, pre_approved=False):
+ pre_confirmed=False, pre_approved=False, invitation=False,
+ send_welcome_message=None):
"""Subscribe an email address to a mailing list.
:param address: Email address to subscribe to the list.
:type address: str
:param display_name: The real name of the new member.
+ :type display_name: str
:param pre_verified: True if the address has been verified.
:type pre_verified: bool
:param pre_confirmed: True if membership has been approved by the user.
:type pre_confirmed: bool
:param pre_approved: True if membership is moderator-approved.
:type pre_approved: bool
- :type display_name: str
+ :param invitation: True if this is an invitation to join the list.
+ :type invitation: bool
+ :param send_welcome_message: True if welcome message should be sent.
+ :type send_welcome_message: bool
:return: A member proxy object.
"""
data = dict(
@@ -336,12 +388,19 @@
data['pre_confirmed'] = True
if pre_approved:
data['pre_approved'] = True
+ if invitation:
+ data['invitation'] = True
+ # Even if it is False, we should send this value because it means we
+ # should suppress welcome message, so check for None value to skip the
+ # parameter.
+ if send_welcome_message is not None:
+ data['send_welcome_message'] = send_welcome_message
response, content = self._connection.call('members', data)
# If a member is not immediately subscribed (i.e. verificatoin,
# confirmation or approval need), the response content is returned.
if response.status_code == 202:
return content
- # I the subscription is executed immediately, a member object
+ # If the subscription is executed immediately, a member object
# is returned.
return Member(self._connection, response.headers.get('location'))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/mailmanclient-3.3.1/src/mailmanclient/restobjects/member.py
new/mailmanclient-3.3.2/src/mailmanclient/restobjects/member.py
--- old/mailmanclient-3.3.1/src/mailmanclient/restobjects/member.py
2020-06-02 05:37:27.000000000 +0200
+++ new/mailmanclient-3.3.2/src/mailmanclient/restobjects/member.py
2020-07-18 21:01:42.000000000 +0200
@@ -24,8 +24,9 @@
class Member(RESTObject, PreferencesMixin):
- _properties = ('delivery_mode', 'email', 'list_id', 'moderation_action',
- 'display_name', 'role', 'self_link')
+ _properties = ('address', 'delivery_mode', 'email', 'list_id',
+ 'moderation_action', 'display_name', 'role', 'self_link',
+ 'subscription_mode')
_writable_properties = ('address', 'delivery_mode', 'moderation_action')
def __repr__(self):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/mailmanclient-3.3.1/src/mailmanclient/tests/test_list.py
new/mailmanclient-3.3.2/src/mailmanclient/tests/test_list.py
--- old/mailmanclient-3.3.1/src/mailmanclient/tests/test_list.py
2020-05-10 01:14:40.000000000 +0200
+++ new/mailmanclient-3.3.2/src/mailmanclient/tests/test_list.py
2021-01-11 04:43:46.000000000 +0100
@@ -220,3 +220,22 @@
pre_approved=True)
users = self.mlist.members[0]
self.assertEqual(users.display_name, 'B Person')
+
+ def test_invite(self):
+ data = self.mlist.subscribe('[email protected]',
+ invitation=True)
+ # cperson is not a member yet.
+ self.assertRaisesRegex(ValueError,
+ 'not a member',
+ self.mlist.get_member,
+ '[email protected]')
+ # But we got a token for the invitation.
+ self.assertEqual(data['token_owner'], 'subscriber')
+
+ def test_get_individual_pending_request(self):
+ data = self.mlist.subscribe('[email protected]', pre_confirmed=False)
+ self.assertEqual(data['token_owner'], 'subscriber')
+ # Now get the individual request object.
+ json = self.mlist.get_request(data['token'])
+ self.assertEqual(json['token_owner'], data['token_owner'])
+ self.assertEqual(json['token'], data['token'])
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/mailmanclient-3.3.1/src/mailmanclient/tests/test_rewrite_url.py
new/mailmanclient-3.3.2/src/mailmanclient/tests/test_rewrite_url.py
--- old/mailmanclient-3.3.1/src/mailmanclient/tests/test_rewrite_url.py
1970-01-01 01:00:00.000000000 +0100
+++ new/mailmanclient-3.3.2/src/mailmanclient/tests/test_rewrite_url.py
2021-01-11 04:43:46.000000000 +0100
@@ -0,0 +1,45 @@
+# Copyright (C) 2019-2020 by the Free Software Foundation, Inc.
+#
+# This file is part of mailman.client.
+#
+# mailman.client is free software: you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as published by the
+# Free Software Foundation, version 3 of the License.
+#
+# mailman.client is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+# License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with mailman.client. If not, see <http://www.gnu.org/licenses/>.
+
+"""Test for the rewriting of self_link URLs."""
+
+import unittest
+
+from mailmanclient import Client
+
+
+class TestRewriteUrl(unittest.TestCase):
+ """Test that self_link paths are safely rewritten"""
+
+ def setUp(self):
+ self._client = Client(
+ 'http://127.0.0.1:9001/3.1', 'restadmin', 'restpass')
+ self.domain = self._client.create_domain('example.org')
+
+ def tearDown(self):
+ self.domain.delete()
+
+ def test_domain_self_link_is_localhost(self):
+ domain = self._client.get_domain('example.org')
+ assert domain.self_link.startswith('http://localhost:9001/')
+
+ def test_connection_rewrite_url(self):
+ link = self._client._connection.rewrite_url(self.domain.self_link)
+ assert link.startswith('http://127.0.0.1:9001/')
+
+ def test_connection_rewrites_url(self):
+ response, _c = self._client._connection.call(self.domain.self_link)
+ assert response.url.startswith('http://127.0.0.1:9001/')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/mailmanclient-3.3.1/src/mailmanclient.egg-info/PKG-INFO
new/mailmanclient-3.3.2/src/mailmanclient.egg-info/PKG-INFO
--- old/mailmanclient-3.3.1/src/mailmanclient.egg-info/PKG-INFO 2020-06-02
05:39:22.000000000 +0200
+++ new/mailmanclient-3.3.2/src/mailmanclient.egg-info/PKG-INFO 2021-01-11
06:36:53.000000000 +0100
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: mailmanclient
-Version: 3.3.1
+Version: 3.3.2
Summary: mailmanclient -- Python bindings for Mailman REST API
Home-page: http://www.list.org/
Maintainer: Barry Warsaw
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/mailmanclient-3.3.1/src/mailmanclient.egg-info/SOURCES.txt
new/mailmanclient-3.3.2/src/mailmanclient.egg-info/SOURCES.txt
--- old/mailmanclient-3.3.1/src/mailmanclient.egg-info/SOURCES.txt
2020-06-02 05:39:22.000000000 +0200
+++ new/mailmanclient-3.3.2/src/mailmanclient.egg-info/SOURCES.txt
2021-01-11 06:36:53.000000000 +0100
@@ -57,6 +57,7 @@
src/mailmanclient/tests/test_domain.py
src/mailmanclient/tests/test_list.py
src/mailmanclient/tests/test_page.py
+src/mailmanclient/tests/test_rewrite_url.py
src/mailmanclient/tests/test_templates.py
src/mailmanclient/tests/test_unicode.py
src/mailmanclient/tests/data/TestDomains.test_no_domain.yaml
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/mailmanclient-3.3.1/tox.ini
new/mailmanclient-3.3.2/tox.ini
--- old/mailmanclient-3.3.1/tox.ini 2020-06-02 05:37:27.000000000 +0200
+++ new/mailmanclient-3.3.2/tox.ini 2020-06-03 08:45:11.000000000 +0200
@@ -5,6 +5,8 @@
usedevelop = True
commands = pytest {posargs}
extras = testing
+deps =
+ git+https://gitlab.com/mailman/mailman@master
[testenv:dependency]
userdevelop = True