Accepting request 932694 from devel:languages:python:mailman

OBS-URL: https://build.opensuse.org/request/show/932694
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-mailmanclient?expand=0&rev=7
This commit is contained in:
2021-11-22 22:03:59 +00:00
committed by Git OBS Bridge
5 changed files with 135 additions and 5 deletions

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:4082ac0c66d7f7bee15751fe2564098b971177c0013e66d0c8ceee1ebdcb5592
size 80654

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:92fe624675e41f41f59de1208e0125dfaa8d062bbe6138bd7cd79e4dd0b6f85e
size 90137

View File

@@ -0,0 +1,98 @@
Index: mailmanclient-3.3.3/src/mailmanclient/tests/test_async_client.py
===================================================================
--- mailmanclient-3.3.3.orig/src/mailmanclient/tests/test_async_client.py 2021-11-19 10:35:49.358591669 +0100
+++ mailmanclient-3.3.3/src/mailmanclient/tests/test_async_client.py 2021-11-19 10:35:59.998665466 +0100
@@ -1,93 +0,0 @@
-import httpx
-import pytest
-import concurrent.futures
-
-from mailmanclient.asynclient import AsyncClient
-from mailmanclient import Client
-
-
-@pytest.fixture(autouse=True)
-def setup():
- """Setup for testing. Create test data."""
- client = Client('http://localhost:9001/3.1', 'restadmin', 'restpass')
- print('Loading test data...')
- try:
- domain = client.create_domain('example.com')
- except Exception:
- domain = client.get_domain('example.com')
- # Create some lists.
- lists = []
- print('Creating lists...')
- with concurrent.futures.ThreadPoolExecutor(max_workers=3) as executor:
- future_to_id = {
- executor.submit(domain.create_list, f'list{i}'): f'list{i}'
- for i in range(10)}
- for future in concurrent.futures.as_completed(future_to_id):
- lists.append(future.result())
-
- # Subscribe some addresses.
- print('Creating subscirbers...')
- for i, ml in enumerate(lists):
- with concurrent.futures.ThreadPoolExecutor(max_workers=3) as executor:
- futures = [
- executor.submit(
- ml.subscribe, f'mylist{each}@example.com',
- pre_verified=True, pre_confirmed=True, pre_approved=True)
- for each in range(i*5)]
- for _future in concurrent.futures.as_completed(futures):
- print('.', end='')
- yield
- # Cleanup after test.
- for ml in lists:
- ml.delete()
- domain.delete()
-
-
-@pytest.fixture
-async def client():
- async with httpx.AsyncClient() as conn:
- client = AsyncClient(
- conn, 'http://localhost:9001/3.1', 'restadmin', 'restpass')
- yield client
-
-
-@pytest.mark.asyncio
-async def test_async_client(client):
- domains = await client.domains()
- for each in domains:
- print(f'Domain: {each.mail_host}')
-
-
-@pytest.mark.asyncio
-async def test_get_lists(client):
- lists = await client.lists()
- for ml in lists:
- print(f'Mailinglist: {ml.fqdn_listname}')
- await ml.config()
-
-
-@pytest.mark.asyncio
-async def test_get_members(client):
- members = await client.members()
- for member in members:
- print(f'Member: {member.role} {member.list_id} {member.email} ',
- end='')
-
-
-@pytest.mark.asyncio
-async def test_get_users(client):
- users = await client.users()
- for user in users:
- print(f'User: {user.user_id} ', end='')
- addrs = await user.addresses()
- for addr in addrs:
- print(f'UserAddress: {addr.email}', end='')
- prefs = await user.preferences()
- print('UserPreference: {}'.format(prefs._data), end='')
-
-
-@pytest.mark.asyncio
-async def test_get_addresses(client):
- addresses = await client.addresses()
- for addr in addresses:
- print(f'Address: {addr.email}', end='')

View File

@@ -1,3 +1,27 @@
-------------------------------------------------------------------
Fri Nov 19 09:22:22 UTC 2021 - Andreas Schneider <asn@cryptomilk.org>
- Fix running the tests
* Added mailmanclient-skip-httpx-tests.patch
- Set missing Group
-------------------------------------------------------------------
Thu Nov 18 18:14:51 UTC 2021 - Matej Cepl <mcepl@suse.com>
- Update to 3.3.3:
- Add pre_confirmed and pre_approved parameters to
MailingList.unsubscribe.
- Add support to fetch pending unsubscription requests.
- Add member_id as a property of Member object.
- Return pending token when a Member is unsubscribed.
- Allow specifying a reason when handling subscription requests
- Add support to specify fields when fetching a roster.
- Add a mechanism to hook into the request parameters.
- Add basic support for async client for Mailman API.
- Allow specifying delivery_mode and delivery_status when
subscribing a Member.
- Add a new Client.find_users API which allows searching for
the users.
-------------------------------------------------------------------
Tue May 4 09:30:03 UTC 2021 - Ben Greiner <code@bnavigator.de>

View File

@@ -20,12 +20,16 @@
# mailman is built only for primary python3 flavor
%define pythons python3
Name: python-mailmanclient
Version: 3.3.2
Version: 3.3.3
Release: 0
Summary: Python bindings for the Mailman REST API
Group: Productivity/Networking/Email/Mailinglists
License: LGPL-3.0-only
URL: https://www.list.org/
Source: https://files.pythonhosted.org/packages/source/m/mailmanclient/mailmanclient-%{version}.tar.gz
%if 0%{?sle_version} && 0%{?sle_version} <= 150300
Patch0: mailmanclient-skip-httpx-tests.patch
%endif
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
@@ -33,7 +37,11 @@ Requires: python-requests
BuildArch: noarch
# SECTION test requirements
BuildRequires: %{python_module falcon}
%if 0%{?suse_version} >= 1550 || 0%{?sle_version} >= 150400
BuildRequires: %{python_module httpx}
%endif
BuildRequires: %{python_module mailman}
BuildRequires: %{python_module pytest-asyncio}
BuildRequires: %{python_module pytest-services}
BuildRequires: %{python_module pytest-vcr}
BuildRequires: %{python_module pytest}
@@ -50,7 +58,7 @@ Obsoletes: python38-mailmanclient < %{version}-%{release}
Python bindings for Mailman REST API.
%prep
%autosetup -n mailmanclient-%{version}
%autosetup -n mailmanclient-%{version} -p1
%build
export LC_ALL=C.UTF-8