Skip to content

Commit 3693b11

Browse files
authored
Release 0.23.1 (#109)
2 parents f4c70b2 + e001f07 commit 3693b11

19 files changed

Lines changed: 2709 additions & 1782 deletions

.github/workflows/test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ jobs:
3030
rm -Rf httpx_auth
3131
- name: Install wheel
3232
run: |
33-
python -m pip install dist/httpx_auth-0.23.0-py3-none-any.whl --force-reinstall
33+
python -m pip install dist/httpx_auth-0.23.1-py3-none-any.whl --force-reinstall
3434
python -c 'import httpx_auth'
3535
- name: Install source distribution
3636
run: |
37-
python -m pip install dist/httpx_auth-0.23.0.tar.gz --force-reinstall
37+
python -m pip install dist/httpx_auth-0.23.1.tar.gz --force-reinstall
3838
python -c 'import httpx_auth'

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [Unreleased]
88

9+
## [0.23.1] - 2025-01-07
10+
### Fixed
11+
- Test suite should now run even if port 5000 is used by another process. Thanks to [`commonism`](https://github.com/commonism).
12+
913
## [0.23.0] - 2025-01-07
1014
### Fixed
1115
- Bearer tokens with nested JSON string are now properly handled. Thanks to [`Patrick Rodrigues`](https://github.com/pythrick).
@@ -262,7 +266,8 @@ Note that a few changes were made:
262266
### Added
263267
- Placeholder for port of requests_auth to httpx
264268

265-
[Unreleased]: https://github.com/Colin-b/httpx_auth/compare/v0.23.0...HEAD
269+
[Unreleased]: https://github.com/Colin-b/httpx_auth/compare/v0.23.1...HEAD
270+
[0.23.1]: https://github.com/Colin-b/httpx_auth/compare/v0.23.0...v0.23.1
266271
[0.23.0]: https://github.com/Colin-b/httpx_auth/compare/v0.22.0...v0.23.0
267272
[0.22.0]: https://github.com/Colin-b/httpx_auth/compare/v0.21.0...v0.22.0
268273
[0.21.0]: https://github.com/Colin-b/httpx_auth/compare/v0.20.0...v0.21.0

httpx_auth/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
# Major should be incremented in case there is a breaking change. (eg: 2.5.8 -> 3.0.0)
44
# Minor should be incremented in case there is an enhancement. (eg: 2.5.8 -> 2.6.0)
55
# Patch should be incremented in case there is a bug fix. (eg: 2.5.8 -> 2.5.9)
6-
__version__ = "0.23.0"
6+
__version__ = "0.23.1"

tests/features/multi_auth/test_add_operator_async.py

Lines changed: 44 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -315,17 +315,19 @@ async def test_oauth2_client_credential_and_multiple_authentication_can_be_combi
315315

316316
@pytest.mark.asyncio
317317
async def test_oauth2_authorization_code_and_api_key_authentication_can_be_combined(
318-
token_cache, httpx_mock: HTTPXMock, browser_mock: BrowserMock
318+
token_cache, httpx_mock: HTTPXMock, browser_mock: BrowserMock, unused_tcp_port: int
319319
):
320320
authorization_code_auth = httpx_auth.OAuth2AuthorizationCode(
321-
"https://provide_code", "https://provide_access_token"
321+
"https://provide_code",
322+
"https://provide_access_token",
323+
redirect_uri_port=unused_tcp_port,
322324
)
323325
api_key_auth = httpx_auth.HeaderApiKey("my_provided_api_key")
324326
auth = authorization_code_auth + api_key_auth
325327

326328
tab = browser_mock.add_response(
327-
opened_url="https://provide_code?response_type=code&state=ce9c755b41b5e3c5b64c70598715d5de271023a53f39a67a70215d265d11d2bfb6ef6e9c701701e998e69cbdbf2cee29fd51d2a950aa05f59a20cf4a646099d5&redirect_uri=http%3A%2F%2Flocalhost%3A5000%2F",
328-
reply_url="http://localhost:5000#code=SplxlOBeZQQYbYS6WxSbIA&state=ce9c755b41b5e3c5b64c70598715d5de271023a53f39a67a70215d265d11d2bfb6ef6e9c701701e998e69cbdbf2cee29fd51d2a950aa05f59a20cf4a646099d5",
329+
opened_url=f"https://provide_code?response_type=code&state=ce9c755b41b5e3c5b64c70598715d5de271023a53f39a67a70215d265d11d2bfb6ef6e9c701701e998e69cbdbf2cee29fd51d2a950aa05f59a20cf4a646099d5&redirect_uri=http%3A%2F%2Flocalhost%3A{unused_tcp_port}%2F",
330+
reply_url=f"http://localhost:{unused_tcp_port}#code=SplxlOBeZQQYbYS6WxSbIA&state=ce9c755b41b5e3c5b64c70598715d5de271023a53f39a67a70215d265d11d2bfb6ef6e9c701701e998e69cbdbf2cee29fd51d2a950aa05f59a20cf4a646099d5",
329331
)
330332

331333
httpx_mock.add_response(
@@ -357,10 +359,12 @@ async def test_oauth2_authorization_code_and_api_key_authentication_can_be_combi
357359

358360
@pytest.mark.asyncio
359361
async def test_oauth2_authorization_code_and_multiple_authentication_can_be_combined(
360-
token_cache, httpx_mock: HTTPXMock, browser_mock: BrowserMock
362+
token_cache, httpx_mock: HTTPXMock, browser_mock: BrowserMock, unused_tcp_port: int
361363
):
362364
authorization_code_auth = httpx_auth.OAuth2AuthorizationCode(
363-
"https://provide_code", "https://provide_access_token"
365+
"https://provide_code",
366+
"https://provide_access_token",
367+
redirect_uri_port=unused_tcp_port,
364368
)
365369
api_key_auth = httpx_auth.HeaderApiKey("my_provided_api_key")
366370
api_key_auth2 = httpx_auth.HeaderApiKey(
@@ -369,8 +373,8 @@ async def test_oauth2_authorization_code_and_multiple_authentication_can_be_comb
369373
auth = authorization_code_auth + (api_key_auth + api_key_auth2)
370374

371375
tab = browser_mock.add_response(
372-
opened_url="https://provide_code?response_type=code&state=ce9c755b41b5e3c5b64c70598715d5de271023a53f39a67a70215d265d11d2bfb6ef6e9c701701e998e69cbdbf2cee29fd51d2a950aa05f59a20cf4a646099d5&redirect_uri=http%3A%2F%2Flocalhost%3A5000%2F",
373-
reply_url="http://localhost:5000#code=SplxlOBeZQQYbYS6WxSbIA&state=ce9c755b41b5e3c5b64c70598715d5de271023a53f39a67a70215d265d11d2bfb6ef6e9c701701e998e69cbdbf2cee29fd51d2a950aa05f59a20cf4a646099d5",
376+
opened_url=f"https://provide_code?response_type=code&state=ce9c755b41b5e3c5b64c70598715d5de271023a53f39a67a70215d265d11d2bfb6ef6e9c701701e998e69cbdbf2cee29fd51d2a950aa05f59a20cf4a646099d5&redirect_uri=http%3A%2F%2Flocalhost%3A{unused_tcp_port}%2F",
377+
reply_url=f"http://localhost:{unused_tcp_port}#code=SplxlOBeZQQYbYS6WxSbIA&state=ce9c755b41b5e3c5b64c70598715d5de271023a53f39a67a70215d265d11d2bfb6ef6e9c701701e998e69cbdbf2cee29fd51d2a950aa05f59a20cf4a646099d5",
374378
)
375379

376380
httpx_mock.add_response(
@@ -403,20 +407,26 @@ async def test_oauth2_authorization_code_and_multiple_authentication_can_be_comb
403407

404408
@pytest.mark.asyncio
405409
async def test_oauth2_pkce_and_api_key_authentication_can_be_combined(
406-
token_cache, httpx_mock: HTTPXMock, browser_mock: BrowserMock, monkeypatch
410+
token_cache,
411+
httpx_mock: HTTPXMock,
412+
browser_mock: BrowserMock,
413+
monkeypatch,
414+
unused_tcp_port: int,
407415
):
408416
monkeypatch.setattr(
409417
httpx_auth._oauth2.authorization_code_pkce.os, "urandom", lambda x: b"1" * 63
410418
)
411419
pkce_auth = httpx_auth.OAuth2AuthorizationCodePKCE(
412-
"https://provide_code", "https://provide_access_token"
420+
"https://provide_code",
421+
"https://provide_access_token",
422+
redirect_uri_port=unused_tcp_port,
413423
)
414424
api_key_auth = httpx_auth.HeaderApiKey("my_provided_api_key")
415425
auth = pkce_auth + api_key_auth
416426

417427
tab = browser_mock.add_response(
418-
opened_url="https://provide_code?response_type=code&state=ce9c755b41b5e3c5b64c70598715d5de271023a53f39a67a70215d265d11d2bfb6ef6e9c701701e998e69cbdbf2cee29fd51d2a950aa05f59a20cf4a646099d5&redirect_uri=http%3A%2F%2Flocalhost%3A5000%2F&code_challenge=5C_ph_KZ3DstYUc965SiqmKAA-ShvKF4Ut7daKd3fjc&code_challenge_method=S256",
419-
reply_url="http://localhost:5000#code=SplxlOBeZQQYbYS6WxSbIA&state=ce9c755b41b5e3c5b64c70598715d5de271023a53f39a67a70215d265d11d2bfb6ef6e9c701701e998e69cbdbf2cee29fd51d2a950aa05f59a20cf4a646099d5",
428+
opened_url=f"https://provide_code?response_type=code&state=ce9c755b41b5e3c5b64c70598715d5de271023a53f39a67a70215d265d11d2bfb6ef6e9c701701e998e69cbdbf2cee29fd51d2a950aa05f59a20cf4a646099d5&redirect_uri=http%3A%2F%2Flocalhost%3A{unused_tcp_port}%2F&code_challenge=5C_ph_KZ3DstYUc965SiqmKAA-ShvKF4Ut7daKd3fjc&code_challenge_method=S256",
429+
reply_url=f"http://localhost:{unused_tcp_port}#code=SplxlOBeZQQYbYS6WxSbIA&state=ce9c755b41b5e3c5b64c70598715d5de271023a53f39a67a70215d265d11d2bfb6ef6e9c701701e998e69cbdbf2cee29fd51d2a950aa05f59a20cf4a646099d5",
420430
)
421431

422432
httpx_mock.add_response(
@@ -448,13 +458,19 @@ async def test_oauth2_pkce_and_api_key_authentication_can_be_combined(
448458

449459
@pytest.mark.asyncio
450460
async def test_oauth2_pkce_and_multiple_authentication_can_be_combined(
451-
token_cache, httpx_mock: HTTPXMock, browser_mock: BrowserMock, monkeypatch
461+
token_cache,
462+
httpx_mock: HTTPXMock,
463+
browser_mock: BrowserMock,
464+
monkeypatch,
465+
unused_tcp_port: int,
452466
):
453467
monkeypatch.setattr(
454468
httpx_auth._oauth2.authorization_code_pkce.os, "urandom", lambda x: b"1" * 63
455469
)
456470
pkce_auth = httpx_auth.OAuth2AuthorizationCodePKCE(
457-
"https://provide_code", "https://provide_access_token"
471+
"https://provide_code",
472+
"https://provide_access_token",
473+
redirect_uri_port=unused_tcp_port,
458474
)
459475
api_key_auth = httpx_auth.HeaderApiKey("my_provided_api_key")
460476
api_key_auth2 = httpx_auth.HeaderApiKey(
@@ -463,8 +479,8 @@ async def test_oauth2_pkce_and_multiple_authentication_can_be_combined(
463479
auth = pkce_auth + (api_key_auth + api_key_auth2)
464480

465481
tab = browser_mock.add_response(
466-
opened_url="https://provide_code?response_type=code&state=ce9c755b41b5e3c5b64c70598715d5de271023a53f39a67a70215d265d11d2bfb6ef6e9c701701e998e69cbdbf2cee29fd51d2a950aa05f59a20cf4a646099d5&redirect_uri=http%3A%2F%2Flocalhost%3A5000%2F&code_challenge=5C_ph_KZ3DstYUc965SiqmKAA-ShvKF4Ut7daKd3fjc&code_challenge_method=S256",
467-
reply_url="http://localhost:5000#code=SplxlOBeZQQYbYS6WxSbIA&state=ce9c755b41b5e3c5b64c70598715d5de271023a53f39a67a70215d265d11d2bfb6ef6e9c701701e998e69cbdbf2cee29fd51d2a950aa05f59a20cf4a646099d5",
482+
opened_url=f"https://provide_code?response_type=code&state=ce9c755b41b5e3c5b64c70598715d5de271023a53f39a67a70215d265d11d2bfb6ef6e9c701701e998e69cbdbf2cee29fd51d2a950aa05f59a20cf4a646099d5&redirect_uri=http%3A%2F%2Flocalhost%3A{unused_tcp_port}%2F&code_challenge=5C_ph_KZ3DstYUc965SiqmKAA-ShvKF4Ut7daKd3fjc&code_challenge_method=S256",
483+
reply_url=f"http://localhost:{unused_tcp_port}#code=SplxlOBeZQQYbYS6WxSbIA&state=ce9c755b41b5e3c5b64c70598715d5de271023a53f39a67a70215d265d11d2bfb6ef6e9c701701e998e69cbdbf2cee29fd51d2a950aa05f59a20cf4a646099d5",
468484
)
469485

470486
httpx_mock.add_response(
@@ -497,9 +513,11 @@ async def test_oauth2_pkce_and_multiple_authentication_can_be_combined(
497513

498514
@pytest.mark.asyncio
499515
async def test_oauth2_implicit_and_api_key_authentication_can_be_combined(
500-
token_cache, httpx_mock: HTTPXMock, browser_mock: BrowserMock
516+
token_cache, httpx_mock: HTTPXMock, browser_mock: BrowserMock, unused_tcp_port: int
501517
):
502-
implicit_auth = httpx_auth.OAuth2Implicit("https://provide_token")
518+
implicit_auth = httpx_auth.OAuth2Implicit(
519+
"https://provide_token", redirect_uri_port=unused_tcp_port
520+
)
503521
api_key_auth = httpx_auth.HeaderApiKey("my_provided_api_key")
504522
auth = implicit_auth + api_key_auth
505523

@@ -508,8 +526,8 @@ async def test_oauth2_implicit_and_api_key_authentication_can_be_combined(
508526
) + datetime.timedelta(hours=1)
509527
token = create_token(expiry_in_1_hour)
510528
tab = browser_mock.add_response(
511-
opened_url="https://provide_token?response_type=token&state=bee505cb6ceb14b9f6ac3573cd700b3b3e965004078d7bb57c7b92df01e448c992a7a46b4804164fc998ea166ece3f3d5849ca2405c4a548f43b915b0677231c&redirect_uri=http%3A%2F%2Flocalhost%3A5000%2F",
512-
reply_url="http://localhost:5000",
529+
opened_url=f"https://provide_token?response_type=token&state=bee505cb6ceb14b9f6ac3573cd700b3b3e965004078d7bb57c7b92df01e448c992a7a46b4804164fc998ea166ece3f3d5849ca2405c4a548f43b915b0677231c&redirect_uri=http%3A%2F%2Flocalhost%3A{unused_tcp_port}%2F",
530+
reply_url=f"http://localhost:{unused_tcp_port}",
513531
data=f"access_token={token}&state=bee505cb6ceb14b9f6ac3573cd700b3b3e965004078d7bb57c7b92df01e448c992a7a46b4804164fc998ea166ece3f3d5849ca2405c4a548f43b915b0677231c",
514532
)
515533

@@ -530,9 +548,11 @@ async def test_oauth2_implicit_and_api_key_authentication_can_be_combined(
530548

531549
@pytest.mark.asyncio
532550
async def test_oauth2_implicit_and_multiple_authentication_can_be_combined(
533-
token_cache, httpx_mock: HTTPXMock, browser_mock: BrowserMock
551+
token_cache, httpx_mock: HTTPXMock, browser_mock: BrowserMock, unused_tcp_port: int
534552
):
535-
implicit_auth = httpx_auth.OAuth2Implicit("https://provide_token")
553+
implicit_auth = httpx_auth.OAuth2Implicit(
554+
"https://provide_token", redirect_uri_port=unused_tcp_port
555+
)
536556
api_key_auth = httpx_auth.HeaderApiKey("my_provided_api_key")
537557
api_key_auth2 = httpx_auth.HeaderApiKey(
538558
"my_provided_api_key2", header_name="X-Api-Key2"
@@ -544,8 +564,8 @@ async def test_oauth2_implicit_and_multiple_authentication_can_be_combined(
544564
) + datetime.timedelta(hours=1)
545565
token = create_token(expiry_in_1_hour)
546566
tab = browser_mock.add_response(
547-
opened_url="https://provide_token?response_type=token&state=bee505cb6ceb14b9f6ac3573cd700b3b3e965004078d7bb57c7b92df01e448c992a7a46b4804164fc998ea166ece3f3d5849ca2405c4a548f43b915b0677231c&redirect_uri=http%3A%2F%2Flocalhost%3A5000%2F",
548-
reply_url="http://localhost:5000",
567+
opened_url=f"https://provide_token?response_type=token&state=bee505cb6ceb14b9f6ac3573cd700b3b3e965004078d7bb57c7b92df01e448c992a7a46b4804164fc998ea166ece3f3d5849ca2405c4a548f43b915b0677231c&redirect_uri=http%3A%2F%2Flocalhost%3A{unused_tcp_port}%2F",
568+
reply_url=f"http://localhost:{unused_tcp_port}",
549569
data=f"access_token={token}&state=bee505cb6ceb14b9f6ac3573cd700b3b3e965004078d7bb57c7b92df01e448c992a7a46b4804164fc998ea166ece3f3d5849ca2405c4a548f43b915b0677231c",
550570
)
551571

0 commit comments

Comments
 (0)