python-igwn-auth-utils/igwn-auth-utils-mr76-mock_called_once.patch
Benjamin Greiner 5c3dac9a91 Accepting request 1146556 from home:bnavigator:branches:science
- Update to 1.1.0
  * Support multiple scopes in is_valid_token [!70]
- Release 1.0.2
  * Ensure that token=False works on all requests [!67]
- Release 1.0.1
  * Fix bug in disabling token auth via function call [!65]
- Release 1.0.0
  ## Major changes
  * Refactor requests auth handling to enable per-request token
    discovery [!59]
  ## Other changes:
  * Allow disabling automatic raise_for_status for Sessions [!52]
  * Fix keyword argument passing in requests wrappers [!56]
  * Add issuer keyword to is_valid_token [!57]
  * Allow deserialising token in is_valid_token [!58]
  * Add support for Python 3.11 [!61]
  * Workaround bug in requests 2.14 [!62]
- Add patches for python 3.12
  * igwn-auth-utils-mr73-utznow.patch
    https://git.ligo.org/computing/igwn-auth-utils/-/merge_requests/73
  * igwn-auth-utils-mr76-mock_called_once.patch
    https://git.ligo.org/computing/igwn-auth-utils/-/merge_requests/76

OBS-URL: https://build.opensuse.org/request/show/1146556
OBS-URL: https://build.opensuse.org/package/show/science/python-igwn-auth-utils?expand=0&rev=8
2024-02-14 11:24:54 +00:00

55 lines
1.9 KiB
Diff

From ad5bb8ce2cdcb3352400c487f4e33cf5eb85fcc7 Mon Sep 17 00:00:00 2001
From: Duncan Macleod <duncan.macleod@ligo.org>
Date: Tue, 13 Feb 2024 13:27:37 +0000
Subject: [PATCH] tests: fix call to mock.called_once_with
need to use builtin assert_called_once_with
---
igwn_auth_utils/tests/test_requests.py | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/igwn_auth_utils/tests/test_requests.py b/igwn_auth_utils/tests/test_requests.py
index de9428b..5de05eb 100644
--- a/igwn_auth_utils/tests/test_requests.py
+++ b/igwn_auth_utils/tests/test_requests.py
@@ -23,6 +23,7 @@ from requests import (
from .. import requests as igwn_requests
from ..error import IgwnAuthError
+from ..scitokens import target_audience
from .test_scitokens import rtoken # noqa: F401
SKIP_REQUESTS_NETRC = pytest.mark.skipif(
@@ -425,15 +426,25 @@ class TestSession:
assert sess.auth.audience == session_aud
assert sess.auth.scope == session_scope
+ audience = (
+ request_aud
+ or session_aud
+ or target_audience(
+ "https://example.com/api",
+ include_any=False,
+ )
+ )
+
# but that the request auth uses any new settings we give it
sess.get(
"https://example.com/api",
token_audience=request_aud,
token_scope=request_scope,
)
- assert find_scitoken.called_once_with(
- audience=request_aud or session_aud,
- scope=request_scope or session_scope,
+ find_scitoken.assert_called_once_with(
+ audience,
+ request_scope or session_scope,
+ issuer=None,
)
@mock.patch("igwn_auth_utils.requests.find_scitoken", return_value=None)
--
GitLab