Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-igwn-auth-utils for 
openSUSE:Factory checked in at 2023-04-02 19:18:30
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-igwn-auth-utils (Old)
 and      /work/SRC/openSUSE:Factory/.python-igwn-auth-utils.new.9019 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-igwn-auth-utils"

Sun Apr  2 19:18:30 2023 rev:3 rq:1076680 version:0.4.0

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/python-igwn-auth-utils/python-igwn-auth-utils.changes
    2022-09-19 16:03:19.422148270 +0200
+++ 
/work/SRC/openSUSE:Factory/.python-igwn-auth-utils.new.9019/python-igwn-auth-utils.changes
  2023-04-02 19:18:32.676875565 +0200
@@ -1,0 +2,9 @@
+Sat Apr  1 20:27:20 UTC 2023 - Ben Greiner <[email protected]>
+
+- Update to v0.4.0
+  * [!48] Add igwn_auth_utils.scitokens.token_audience function.
+  * [!49] Add support for all HTTP methods
+  * [!51] Fix error reporting in scitokens tests
+- Ignore setuptools deprecation API
+
+-------------------------------------------------------------------

Old:
----
  igwn-auth-utils-0.3.1.tar.gz

New:
----
  igwn-auth-utils-0.4.0.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-igwn-auth-utils.spec ++++++
--- /var/tmp/diff_new_pack.cYcIVB/_old  2023-04-02 19:18:33.112877754 +0200
+++ /var/tmp/diff_new_pack.cYcIVB/_new  2023-04-02 19:18:33.116877774 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package python-igwn-auth-utils
 #
-# Copyright (c) 2022 SUSE LLC
+# Copyright (c) 2023 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -20,15 +20,16 @@
 %define skip_python2 1
 %global srcname igwn-auth-utils
 Name:           python-igwn-auth-utils
-Version:        0.3.1
+Version:        0.4.0
 Release:        0
 Summary:        Auth Utils for International Gravitational-Wave Observatory 
Network (IGWN)
 License:        BSD-3-Clause
 URL:            https://git.ligo.org/computing/igwn-auth-utils
 Source:         
https://files.pythonhosted.org/packages/source/i/%{srcname}/%{srcname}-%{version}.tar.gz
+BuildRequires:  %{python_module pip}
 BuildRequires:  %{python_module setuptools_scm >= 3.4.3}
 BuildRequires:  %{python_module setuptools}
-BuildRequires:  %{python_module toml}
+BuildRequires:  %{python_module wheel}
 BuildRequires:  fdupes
 BuildRequires:  python-rpm-macros
 Requires:       python-cryptography >= 2.3
@@ -59,12 +60,13 @@
 %prep
 %setup -q -n %{srcname}-%{version}
 sed -i 's/--color=yes//' pyproject.toml
+sed -i '/"error",/ a \        "ignore:pkg_resources is deprecated as an 
API:DeprecationWarning",' pyproject.toml
 
 %build
-%python_build
+%pyproject_wheel
 
 %install
-%python_install
+%pyproject_install
 %python_expand %fdupes %{buildroot}%{$python_sitelib}
 
 %check

++++++ igwn-auth-utils-0.3.1.tar.gz -> igwn-auth-utils-0.4.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/igwn-auth-utils-0.3.1/.gitlab/ci/debian.yml 
new/igwn-auth-utils-0.4.0/.gitlab/ci/debian.yml
--- old/igwn-auth-utils-0.3.1/.gitlab/ci/debian.yml     2022-04-07 
16:41:17.000000000 +0200
+++ new/igwn-auth-utils-0.4.0/.gitlab/ci/debian.yml     2023-01-17 
15:48:16.000000000 +0100
@@ -99,6 +99,12 @@
     # setup local apt repository
     - apt-get -y -q -q install local-apt-repository
     - mkdir -pv /srv/local-apt-repository
+    - |
+      cat > /etc/apt/preferences.d/99local-apt-repository << EOF
+      Package: *
+      Pin: origin ""
+      Pin-Priority: 1001
+      EOF
     # fill our local apt repo and rebuild it
     - mv -v *.deb /srv/local-apt-repository
     - /usr/lib/local-apt-repository/rebuild
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/igwn-auth-utils-0.3.1/PKG-INFO 
new/igwn-auth-utils-0.4.0/PKG-INFO
--- old/igwn-auth-utils-0.3.1/PKG-INFO  2022-09-18 16:09:55.533328300 +0200
+++ new/igwn-auth-utils-0.4.0/PKG-INFO  2023-01-17 15:50:51.666570700 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: igwn-auth-utils
-Version: 0.3.1
+Version: 0.4.0
 Summary: Authorisation utilities for IGWN
 Home-page: https://git.ligo.org/computing/igwn-auth-utils
 Author: Duncan Macleod
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/igwn-auth-utils-0.3.1/debian/changelog 
new/igwn-auth-utils-0.4.0/debian/changelog
--- old/igwn-auth-utils-0.3.1/debian/changelog  2022-09-18 16:07:49.000000000 
+0200
+++ new/igwn-auth-utils-0.4.0/debian/changelog  2023-01-17 15:48:16.000000000 
+0100
@@ -1,3 +1,9 @@
+igwn-auth-utils (0.4.0-1) unstable; urgency=low
+
+  * update to 0.4.0
+
+ -- Duncan Macleod <[email protected]>  Tue, 17 Jan 2023 12:15:00 +0000
+
 igwn-auth-utils (0.3.1-1) unstable; urgency=low
 
   * update to 0.3.1, 0.3.0 was forgotten in debian
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/igwn-auth-utils-0.3.1/docs/requests.rst 
new/igwn-auth-utils-0.4.0/docs/requests.rst
--- old/igwn-auth-utils-0.3.1/docs/requests.rst 2022-09-17 14:52:32.000000000 
+0200
+++ new/igwn-auth-utils-0.4.0/docs/requests.rst 2023-01-17 13:11:16.000000000 
+0100
@@ -39,6 +39,26 @@
    :toctree: api
    :nosignatures:
 
-   ~igwn_auth_utils.SessionAuthMixin
-   ~igwn_auth_utils.Session
    ~igwn_auth_utils.get
+   ~igwn_auth_utils.request
+   ~igwn_auth_utils.Session
+   ~igwn_auth_utils.SessionAuthMixin
+
+======================
+Other request methoeds
+======================
+
+Only the :func:`~igwn_auth_utils.get` and :func:`~igwn_auth_utils.request`
+functions are available from the top-level module interface, however all
+HTTP methods are supported via functions in the
+:mod:`igwn_auth_utils.requests` module:
+
+.. autosummary::
+   :toctree: api
+   :nosignatures:
+
+   igwn_auth_utils.requests.delete
+   igwn_auth_utils.requests.head
+   igwn_auth_utils.requests.patch
+   igwn_auth_utils.requests.post
+   igwn_auth_utils.requests.put
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/igwn-auth-utils-0.3.1/igwn-auth-utils.spec 
new/igwn-auth-utils-0.4.0/igwn-auth-utils.spec
--- old/igwn-auth-utils-0.3.1/igwn-auth-utils.spec      2022-09-18 
16:07:49.000000000 +0200
+++ new/igwn-auth-utils-0.4.0/igwn-auth-utils.spec      2023-01-17 
15:48:16.000000000 +0100
@@ -1,5 +1,5 @@
 %define srcname igwn-auth-utils
-%define version 0.3.1
+%define version 0.4.0
 %define release 1
 
 Name:      python-%{srcname}
@@ -73,6 +73,9 @@
 # -- changelog
 
 %changelog
+* Tue Jan 17 2023 Duncan Macleod <[email protected]> - 0.4.0-1
+- update to 0.4.0
+
 * Sun Sep 18 2022 Duncan Macleod <[email protected]> - 0.3.1-1
 - update to 0.3.1, 0.3.0 was forgotten in RPM
 - promote requests interface requirements from suggested to requires
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/igwn-auth-utils-0.3.1/igwn_auth_utils/__init__.py 
new/igwn-auth-utils-0.4.0/igwn_auth_utils/__init__.py
--- old/igwn-auth-utils-0.3.1/igwn_auth_utils/__init__.py       2022-09-17 
14:52:32.000000000 +0200
+++ new/igwn-auth-utils-0.4.0/igwn_auth_utils/__init__.py       2023-01-17 
13:11:16.000000000 +0100
@@ -9,6 +9,7 @@
 from .error import IgwnAuthError
 from .requests import (
     get,
+    request,
     Session,
     SessionAuthMixin,
     SessionErrorMixin,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/igwn-auth-utils-0.3.1/igwn_auth_utils/_version.py 
new/igwn-auth-utils-0.4.0/igwn_auth_utils/_version.py
--- old/igwn-auth-utils-0.3.1/igwn_auth_utils/_version.py       2022-09-18 
16:09:55.000000000 +0200
+++ new/igwn-auth-utils-0.4.0/igwn_auth_utils/_version.py       2023-01-17 
15:50:51.000000000 +0100
@@ -1,5 +1,4 @@
-# coding: utf-8
 # file generated by setuptools_scm
 # don't change, don't track in version control
-__version__ = version = '0.3.1'
-__version_tuple__ = version_tuple = (0, 3, 1)
+__version__ = version = '0.4.0'
+__version_tuple__ = version_tuple = (0, 4, 0)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/igwn-auth-utils-0.3.1/igwn_auth_utils/requests.py 
new/igwn-auth-utils-0.4.0/igwn_auth_utils/requests.py
--- old/igwn-auth-utils-0.3.1/igwn_auth_utils/requests.py       2022-09-17 
14:52:32.000000000 +0200
+++ new/igwn-auth-utils-0.4.0/igwn_auth_utils/requests.py       2023-01-17 
13:11:16.000000000 +0100
@@ -22,6 +22,7 @@
 from .error import IgwnAuthError
 from .scitokens import (
     find_token as find_scitoken,
+    target_audience as scitoken_audience,
     token_authorization_header as scitoken_authorization_header,
 )
 from .x509 import (
@@ -82,8 +83,13 @@
         - `None`: try and discover a valid token, but
           try something else if that fails
 
-    token_audience, token_scope : `str`
-        The ``audience`` and ``scope`` to pass to
+    token_audience : `str`, list` of `str`
+        The value(s) of the audience (``aud``) claim to pass to
+        :func:`igwn_auth_utils.find_scitoken` when discovering
+        available tokens.
+
+    token_scope : `str`
+        The value(s) of the ``scope``  ``audience`` and ``scope`` to pass to
         :func:`igwn_auth_utils.find_scitoken` when discovering
         available tokens.
 
@@ -104,8 +110,9 @@
         object to attach to a `~requests.Request`
 
     url : `str`, optional
-        the URL that will be queried within this session; this is only
-        used to access credentials via :mod:`safe_netrc`.
+        the URL/host that will be queried within this session; this is used
+        to set the default ``token_audience`` and to access credentials
+        via :mod:`safe_netrc`.
 
     force_noauth : `bool`, optional
         Disable the use of any authorisation credentials (mainly for testing).
@@ -289,16 +296,7 @@
         """Find a bearer token for authorization
         """
         if audience is None and url is not None:
-            # default the audience to the scheme://fqdn of the target host,
-            # both including and excluding any ':port' suffix, and ANY
-            scheme, netloc = urlparse(url)[:2]
-            host = netloc.split(':', 1)[0]  # remove a :port suffix
-            if scheme and netloc:
-                audience = list({
-                    f"{scheme}://{netloc}",
-                    f"{scheme}://{host}",
-                    "ANY",
-                })
+            audience = scitoken_audience(url, include_any=True)
         return _find_cred(find_scitoken, audience, scope, error=error)
 
     @staticmethod
@@ -368,21 +366,24 @@
     _obj.__doc__ = _obj.__doc__.format(parameters=_auth_session_parameters)
 
 
-def get(url, *args, session=None, **kwargs):
-    """Request data from a URL via an HTTP ``'GET'`` request
+def request(method, url, *args, session=None, **kwargs):
+    """Send a request of the specific method to the specified URL.
 
     Parameters
     ----------
+    method : `str`
+        The method to use.
+
     url : `str`,
-        the URL to request
+        The URL to request.
 
     session : `requests.Session`, optional
-        the connection session to use, if not given one will be
-        created on-the-fly
+        The connection session to use, if not given one will be
+        created on-the-fly.
 
     args, kwargs
-        all other keyword arguments are passed directly to
-        `requests.Session.get`
+        All other keyword arguments are passed directly to
+        `requests.Session.request`
 
     Returns
     -------
@@ -391,12 +392,12 @@
 
     See also
     --------
-    requests.Session.get
+    requests.Session.request
         for information on how the request is performed
     """
     # user's session
     if session:
-        return session.get(url, *args, **kwargs)
+        return session.request(method, url, *args, **kwargs)
 
     # new session
     sess_kwargs = {k: kwargs.pop(k) for k in (
@@ -406,4 +407,52 @@
         "token_scope",
     ) if k in kwargs}
     with Session(url=url, **sess_kwargs) as session:
-        return session.get(url, *args, **kwargs)
+        return session.request(method, url, *args, **kwargs)
+
+
+_request_wrapper_doc = """
+    Send an HTTP {METHOD} request to the specified URL with IGWN Auth attached.
+
+    Parameters
+    ----------
+    url : `str`
+        The URL to request.
+
+    session : `requests.Session`, optional
+        The connection session to use, if not given one will be
+        created on-the-fly.
+
+    args, kwargs
+        All other keyword arguments are passed directly to
+        :meth:`requests.Session.{method}`
+
+    Returns
+    -------
+    resp : `requests.Response`
+        the response object
+
+    See also
+    --------
+    requests.Session.{method}
+        for information on how the request is performed
+""".strip()
+
+
+def _request_wrapper_factory(method):
+    def _request_wrapper(url, *args, session=None, **kwargs):
+        return request(method, url, *args, session=session, **kwargs)
+
+    _request_wrapper.__doc__ = _request_wrapper_doc.format(
+        method=method,
+        METHOD=method.upper(),
+    )
+    return _request_wrapper
+
+
+# request methods
+delete = _request_wrapper_factory("delete")
+get = _request_wrapper_factory("get")
+head = _request_wrapper_factory("head")
+patch = _request_wrapper_factory("patch")
+post = _request_wrapper_factory("post")
+put = _request_wrapper_factory("put")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/igwn-auth-utils-0.3.1/igwn_auth_utils/scitokens.py 
new/igwn-auth-utils-0.4.0/igwn_auth_utils/scitokens.py
--- old/igwn-auth-utils-0.3.1/igwn_auth_utils/scitokens.py      2022-09-17 
14:52:32.000000000 +0200
+++ new/igwn-auth-utils-0.4.0/igwn_auth_utils/scitokens.py      2023-01-17 
13:39:40.000000000 +0100
@@ -9,6 +9,7 @@
 
 import os
 from pathlib import Path
+from urllib.parse import urlparse
 
 from jwt import (
     InvalidAudienceError,
@@ -35,6 +36,19 @@
 
 
 def is_valid_token(token, audience, scope, timeleft=600):
+    """Test whether ``token`` matches the ``audience`` and ``scope``.
+
+    Parameters
+    ----------
+    token : `scitokens.SciToken`
+        The token to test.
+
+    audience : `str`, `list` or `str`
+        The audience(s) to accept.
+
+    scope : `str`
+        A single scope to validate.
+    """
     enforcer = Enforcer(token["iss"], audience=audience)
 
     # add validator for timeleft
@@ -58,6 +72,51 @@
     return enforcer.test(token, authz, path=path)
 
 
+def target_audience(url, include_any=True):
+    """Return the expected ``aud`` claim to authorize a request to ``url``.
+
+    Parameters
+    ----------
+    url : `str`
+        The URL that will be requested.
+
+    include_any : `bool`, optional
+        If `True`, include ``"ANY"`` in the return list of
+        audiences, otherwise, don't.
+
+    Returns
+    -------
+    audiences : `list` of `str`
+        A `list` of audience values (`str`), either of length 1
+        if ``include_any=False`, otherwise of length 2.
+
+    Examples
+    --------
+    >>> default_audience(
+    ...     "https://datafind.ligo.org:443/LDR/services/data/v1/gwf.json";,
+    ...     include_any=True,
+    ... )
+    ["https://datafind.ligo.org";, "ANY"]
+    >>> default_audience(
+    ...     "segments.ligo.org",
+    ...     include_any=False,
+    ... )
+    ["https://segments.ligo.org";]
+
+    Hostnames given without a URL scheme are presumed to be HTTPS:
+
+    >>> default_audience("datafind.ligo.org")
+    ["https://datafind.ligo.org";]
+    """
+    if "//" not in url:  # always match a hostname, not a path
+        url = f"//{url}"
+    parsed = urlparse(url, scheme="https")
+    aud = [f"{parsed.scheme}://{parsed.hostname}"]
+    if include_any:
+        aud.append("ANY")
+    return aud
+
+
 # -- I/O --------------------
 
 def deserialize_token(raw, **kwargs):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/igwn-auth-utils-0.3.1/igwn_auth_utils/tests/test_requests.py 
new/igwn-auth-utils-0.4.0/igwn_auth_utils/tests/test_requests.py
--- old/igwn-auth-utils-0.3.1/igwn_auth_utils/tests/test_requests.py    
2022-09-17 14:52:32.000000000 +0200
+++ new/igwn-auth-utils-0.4.0/igwn_auth_utils/tests/test_requests.py    
2023-01-17 15:48:16.000000000 +0100
@@ -11,6 +11,7 @@
 import os
 import stat
 from unittest import mock
+from urllib.parse import urlencode
 
 import pytest
 
@@ -75,11 +76,11 @@
         )
 
         # with the kwarg a RequestException is raised
-        with pytest.raises(RequestException) as exc:
+        with pytest.raises(
+            RequestException,
+            match=r"404 Client Error: not found for url: https://test.org/";,
+        ):
             igwn_requests.get("https://test.org";)
-        assert str(exc.value) == (
-            "404 Client Error: not found for url: https://test.org/";
-        )
 
     # -- SessionAuthMixin
 
@@ -153,11 +154,10 @@
             self.Session(token=True)
 
     @pytest.mark.parametrize(("url", "aud"), (
-        ("https://secret.example.com:8008";, list({
-            "https://secret.example.com:8008";,
+        ("https://secret.example.com:8008";, [
             "https://secret.example.com";,
             "ANY",
-        })),
+        ]),
         (None, None)
     ))
     @mock.patch("igwn_auth_utils.requests.find_scitoken")
@@ -257,5 +257,23 @@
     """
     session = mock.MagicMock()
     assert igwn_requests.get("https://test.org";, session=session)
-    session.get.assert_called_once_with("https://test.org";)
+    session.request.assert_called_once_with("get", "https://test.org";)
     mock_session.assert_not_called()
+
+
+def test_post(requests_mock):
+    """Test that `igwn_auth_utils.requests.post` can perform a simple request.
+    """
+    data = {"a": 1, "b": 2}
+    requests_mock.post(
+        "https://example.com";,
+        text="THANKS",
+    )
+    # check that the correct response got passed through
+    assert igwn_requests.post(
+        "https://example.com";,
+        data=data,
+    ).text == "THANKS"
+    # check that the data was encoded into the request properly
+    req = requests_mock.request_history[0]
+    assert req.body == urlencode(data)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/igwn-auth-utils-0.3.1/igwn_auth_utils/tests/test_scitokens.py 
new/igwn-auth-utils-0.4.0/igwn_auth_utils/tests/test_scitokens.py
--- old/igwn-auth-utils-0.3.1/igwn_auth_utils/tests/test_scitokens.py   
2022-09-17 14:52:32.000000000 +0200
+++ new/igwn-auth-utils-0.4.0/igwn_auth_utils/tests/test_scitokens.py   
2023-01-17 15:48:16.000000000 +0100
@@ -11,7 +11,10 @@
 import time
 from unittest import mock
 
-from scitokens import SciToken
+from scitokens import (
+    __version__ as scitokens_version,
+    SciToken,
+)
 from scitokens.scitokens import InvalidPathError
 
 import pytest
@@ -138,6 +141,23 @@
         igwn_scitokens.is_valid_token(rtoken, READ_AUDIENCE, "read")
 
 
[email protected]("include_any", (False, True))
[email protected](("url", "aud"), (
+    # basic
+    ("https://example.com/data";, ["https://example.com";]),
+    # no scheme
+    ("example.com", ["https://example.com";]),
+    # port
+    ("https://example.com:443/data/test";, ["https://example.com";]),
+    # HTTP
+    ("http://example.com:443/data/test";, ["http://example.com";]),
+))
+def test_target_audience(url, aud, include_any):
+    if include_any:
+        aud += ["ANY"]
+    assert igwn_scitokens.target_audience(url, include_any=include_any) == aud
+
+
 def test_load_token_file(rtoken_path, rtoken, public_pem):
     assert_tokens_equal(
         igwn_scitokens.load_token_file(
@@ -209,7 +229,6 @@
         (rtoken, READ_AUDIENCE, READ_SCOPE),
         (wtoken, WRITE_AUDIENCE, WRITE_SCOPE),
     ):
-        print("TEST", token, aud, scope)
         assert_tokens_equal(
             igwn_scitokens.find_token(
                 audience=aud,
@@ -224,7 +243,10 @@
 
 @pytest.mark.parametrize(("audience", "msg"), [
     (READ_AUDIENCE, "could not find a valid SciToken"),
-    (WRITE_AUDIENCE, "Invalid audience"),
+    (WRITE_AUDIENCE, (
+        "could not find a valid SciToken" if scitokens_version >= "1.7.3"
+        else "Invalid audience"
+    )),
 ])
 @mock.patch.dict("os.environ")
 # make sure a real token doesn't get in the way
@@ -233,7 +255,10 @@
     # token with the wrong claims
     os.environ["SCITOKEN"] = rtoken.serialize().decode("utf-8")
     # check that we get an error
-    with pytest.raises(IgwnAuthError) as exc:
+    with pytest.raises(
+        IgwnAuthError,
+        match=msg,
+    ):
         igwn_scitokens.find_token(
             audience,
             WRITE_SCOPE,
@@ -241,7 +266,6 @@
             public_key=public_pem,
             skip_errors=False,
         )
-    assert str(exc.value).startswith(msg)
 
 
 @mock.patch.dict("os.environ")
@@ -259,13 +283,15 @@
     os.environ["SCITOKEN"] = rtoken.serialize().decode("utf-8")
 
     # check that we get the normal error
-    with pytest.raises(IgwnAuthError) as exc:
+    with pytest.raises(
+        IgwnAuthError,
+        match=message,
+    ):
         igwn_scitokens.find_token(
             READ_AUDIENCE,
             READ_SCOPE,
             skip_errors=skip_errors,
         )
-    assert str(exc.value).startswith(message)
 
 
 @mock.patch.dict("os.environ")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/igwn-auth-utils-0.3.1/igwn_auth_utils/tests/test_x509.py 
new/igwn-auth-utils-0.4.0/igwn_auth_utils/tests/test_x509.py
--- old/igwn-auth-utils-0.3.1/igwn_auth_utils/tests/test_x509.py        
2022-06-27 11:59:09.000000000 +0200
+++ new/igwn-auth-utils-0.4.0/igwn_auth_utils/tests/test_x509.py        
2023-01-17 15:48:17.000000000 +0100
@@ -86,11 +86,11 @@
 
 
 def test_validate_certificate_expiry_error(x509cert):
-    with pytest.raises(ValueError) as exc:
+    with pytest.raises(
+        ValueError,
+        match="X.509 certificate has less than 10000000000 seconds remaining",
+    ):
         igwn_x509.validate_certificate(x509cert, timeleft=int(1e10))
-    assert str(exc.value) == (
-        "X.509 certificate has less than 10000000000 seconds remaining"
-    )
 
 
 def test_is_valid_certificate(x509cert_path):
@@ -182,8 +182,8 @@
         os.environ.pop(f"X509_USER_{suffix}", None)
 
     # check that we can't find any credentials
-    with pytest.raises(IgwnAuthError) as exc:
+    with pytest.raises(
+        IgwnAuthError,
+        match="could not find an RFC-3820 compliant X.509 credential",
+    ):
         igwn_x509.find_credentials()
-    assert str(exc.value).startswith(
-        "could not find an RFC-3820 compliant X.509 credential",
-    )
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/igwn-auth-utils-0.3.1/igwn_auth_utils.egg-info/PKG-INFO 
new/igwn-auth-utils-0.4.0/igwn_auth_utils.egg-info/PKG-INFO
--- old/igwn-auth-utils-0.3.1/igwn_auth_utils.egg-info/PKG-INFO 2022-09-18 
16:09:55.000000000 +0200
+++ new/igwn-auth-utils-0.4.0/igwn_auth_utils.egg-info/PKG-INFO 2023-01-17 
15:50:51.000000000 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: igwn-auth-utils
-Version: 0.3.1
+Version: 0.4.0
 Summary: Authorisation utilities for IGWN
 Home-page: https://git.ligo.org/computing/igwn-auth-utils
 Author: Duncan Macleod

Reply via email to