0s autopkgtest [10:24:47]: starting date and time: 2024-06-16 10:24:47+0000 0s autopkgtest [10:24:47]: git checkout: 433ed4c Merge branch 'skia/nova_flock' into 'ubuntu/5.34+prod' 0s autopkgtest [10:24:47]: host juju-7f2275-prod-proposed-migration-environment-9; command line: /home/ubuntu/autopkgtest/runner/autopkgtest --output-dir /tmp/autopkgtest-work.v_8ji0cx/out --timeout-copy=6000 --setup-commands 'ln -s /dev/null /etc/systemd/system/bluetooth.service; printf "http_proxy=http://squid.internal:3128\nhttps_proxy=http://squid.internal:3128\nno_proxy=127.0.0.1,127.0.1.1,login.ubuntu.com,localhost,localdomain,novalocal,internal,archive.ubuntu.com,ports.ubuntu.com,security.ubuntu.com,ddebs.ubuntu.com,changelogs.ubuntu.com,keyserver.ubuntu.com,launchpadlibrarian.net,launchpadcontent.net,launchpad.net,10.24.0.0/24,keystone.ps5.canonical.com,objectstorage.prodstack5.canonical.com\n" >> /etc/environment' --apt-pocket=proposed=src:httpx --apt-upgrade python-authlib --timeout-short=300 --timeout-copy=20000 --timeout-build=20000 --env=ADT_TEST_TRIGGERS=httpx/0.27.0-1 -- lxd -r lxd-armhf-10.145.243.171 lxd-armhf-10.145.243.171:autopkgtest/ubuntu/oracular/armhf 33s autopkgtest [10:25:20]: testbed dpkg architecture: armhf 35s autopkgtest [10:25:22]: testbed apt version: 2.9.5 35s autopkgtest [10:25:22]: @@@@@@@@@@@@@@@@@@@@ test bed setup 43s Get:1 http://ftpmaster.internal/ubuntu oracular-proposed InRelease [110 kB] 44s Get:2 http://ftpmaster.internal/ubuntu oracular-proposed/main Sources [36.1 kB] 44s Get:3 http://ftpmaster.internal/ubuntu oracular-proposed/restricted Sources [7052 B] 44s Get:4 http://ftpmaster.internal/ubuntu oracular-proposed/multiverse Sources [2576 B] 44s Get:5 http://ftpmaster.internal/ubuntu oracular-proposed/universe Sources [389 kB] 44s Get:6 http://ftpmaster.internal/ubuntu oracular-proposed/main armhf Packages [34.8 kB] 44s Get:7 http://ftpmaster.internal/ubuntu oracular-proposed/restricted armhf Packages [1860 B] 44s Get:8 http://ftpmaster.internal/ubuntu oracular-proposed/universe armhf Packages [293 kB] 44s Get:9 http://ftpmaster.internal/ubuntu oracular-proposed/multiverse armhf Packages [2528 B] 44s Fetched 877 kB in 1s (732 kB/s) 44s Reading package lists... 62s tee: /proc/self/fd/2: Permission denied 87s Hit:1 http://ftpmaster.internal/ubuntu oracular-proposed InRelease 87s Hit:2 http://ftpmaster.internal/ubuntu oracular InRelease 87s Hit:3 http://ftpmaster.internal/ubuntu oracular-updates InRelease 87s Hit:4 http://ftpmaster.internal/ubuntu oracular-security InRelease 88s Reading package lists... 88s Reading package lists... 88s Building dependency tree... 88s Reading state information... 89s Calculating upgrade... 89s The following packages will be upgraded: 89s libldap-common libldap2 89s 2 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 89s Need to get 203 kB of archives. 89s After this operation, 0 B of additional disk space will be used. 89s Get:1 http://ftpmaster.internal/ubuntu oracular/main armhf libldap-common all 2.6.7+dfsg-1~exp1ubuntu9 [31.5 kB] 89s Get:2 http://ftpmaster.internal/ubuntu oracular/main armhf libldap2 armhf 2.6.7+dfsg-1~exp1ubuntu9 [171 kB] 90s Fetched 203 kB in 0s (474 kB/s) 90s (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 58402 files and directories currently installed.) 90s Preparing to unpack .../libldap-common_2.6.7+dfsg-1~exp1ubuntu9_all.deb ... 90s Unpacking libldap-common (2.6.7+dfsg-1~exp1ubuntu9) over (2.6.7+dfsg-1~exp1ubuntu8) ... 90s Preparing to unpack .../libldap2_2.6.7+dfsg-1~exp1ubuntu9_armhf.deb ... 90s Unpacking libldap2:armhf (2.6.7+dfsg-1~exp1ubuntu9) over (2.6.7+dfsg-1~exp1ubuntu8) ... 90s Setting up libldap-common (2.6.7+dfsg-1~exp1ubuntu9) ... 90s Setting up libldap2:armhf (2.6.7+dfsg-1~exp1ubuntu9) ... 90s Processing triggers for man-db (2.12.1-2) ... 90s Processing triggers for libc-bin (2.39-0ubuntu9) ... 91s Reading package lists... 91s Building dependency tree... 91s Reading state information... 91s 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 93s autopkgtest [10:26:20]: rebooting testbed after setup commands that affected boot 133s autopkgtest [10:27:00]: testbed running kernel: Linux 6.5.0-35-generic #35~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue May 7 11:19:33 UTC 2 159s autopkgtest [10:27:26]: @@@@@@@@@@@@@@@@@@@@ apt-source python-authlib 173s Get:1 http://ftpmaster.internal/ubuntu oracular/universe python-authlib 1.3.1-1 (dsc) [2494 B] 173s Get:2 http://ftpmaster.internal/ubuntu oracular/universe python-authlib 1.3.1-1 (tar) [320 kB] 173s Get:3 http://ftpmaster.internal/ubuntu oracular/universe python-authlib 1.3.1-1 (diff) [5564 B] 174s gpgv: Signature made Thu Jun 6 10:39:37 2024 UTC 174s gpgv: using EDDSA key EE9AD6F90520FA11F69F4824477B0DB0263A54D8 174s gpgv: issuer "stefanor@debian.org" 174s gpgv: Can't check signature: No public key 174s dpkg-source: warning: cannot verify inline signature for ./python-authlib_1.3.1-1.dsc: no acceptable signature found 174s autopkgtest [10:27:41]: testing package python-authlib version 1.3.1-1 176s autopkgtest [10:27:43]: build not needed 178s autopkgtest [10:27:45]: test unittests3: preparing testbed 188s Reading package lists... 188s Building dependency tree... 188s Reading state information... 188s Starting pkgProblemResolver with broken count: 0 188s Starting 2 pkgProblemResolver with broken count: 0 188s Done 189s The following additional packages will be installed: 189s libjs-jquery python3-all python3-anyio python3-asgiref 189s python3-async-generator python3-authlib python3-cachelib python3-click 189s python3-colorama python3-django python3-flask python3-flask-sqlalchemy 189s python3-greenlet python3-h11 python3-httpcore python3-httpx 189s python3-iniconfig python3-itsdangerous python3-packaging python3-pluggy 189s python3-pycryptodome python3-pytest python3-pytest-asyncio 189s python3-pytest-django python3-sniffio python3-sqlalchemy python3-sqlparse 189s python3-starlette python3-werkzeug 189s Suggested packages: 189s python-cachelib-doc bpython3 geoip-database-contrib gettext ipython3 189s libgdal20 libsqlite3-mod-spatialite python-django-doc python3-bcrypt 189s python3-flup python3-memcache python3-mysqldb python3-pil python3-psycopg2 189s python3-selenium python3-sqlite python3-dotenv python-flask-doc 189s python-greenlet-dev python-greenlet-doc python-sqlalchemy-doc python3-fdb 189s python3-pymssql python3-asyncpg python3-aiosqlite python-sqlparse-doc 189s python3-databases python-werkzeug-doc python3-lxml python3-watchdog 189s Recommended packages: 189s javascript-common python3-tz python3-simplejson python3-sqlalchemy-ext 189s python3-uvicorn | python3-daphne python3-aiofiles python3-multipart 189s python3-pyinotify 189s The following NEW packages will be installed: 189s autopkgtest-satdep libjs-jquery python3-all python3-anyio python3-asgiref 189s python3-async-generator python3-authlib python3-cachelib python3-click 189s python3-colorama python3-django python3-flask python3-flask-sqlalchemy 189s python3-greenlet python3-h11 python3-httpcore python3-httpx 189s python3-iniconfig python3-itsdangerous python3-packaging python3-pluggy 189s python3-pycryptodome python3-pytest python3-pytest-asyncio 189s python3-pytest-django python3-sniffio python3-sqlalchemy python3-sqlparse 189s python3-starlette python3-werkzeug 189s 0 upgraded, 30 newly installed, 0 to remove and 0 not upgraded. 189s Need to get 6793 kB/6794 kB of archives. 189s After this operation, 43.9 MB of additional disk space will be used. 189s Get:1 /tmp/autopkgtest.C1D3tM/1-autopkgtest-satdep.deb autopkgtest-satdep armhf 0 [812 B] 189s Get:2 http://ftpmaster.internal/ubuntu oracular/main armhf libjs-jquery all 3.6.1+dfsg+~3.5.14-1 [328 kB] 189s Get:3 http://ftpmaster.internal/ubuntu oracular/main armhf python3-all armhf 3.12.3-0ubuntu1 [886 B] 189s Get:4 http://ftpmaster.internal/ubuntu oracular/universe armhf python3-sniffio all 1.3.1-1 [7262 B] 189s Get:5 http://ftpmaster.internal/ubuntu oracular/universe armhf python3-anyio all 4.3.0-1 [56.6 kB] 189s Get:6 http://ftpmaster.internal/ubuntu oracular/main armhf python3-asgiref all 3.8.1-1 [24.8 kB] 189s Get:7 http://ftpmaster.internal/ubuntu oracular/universe armhf python3-async-generator all 1.10-4 [17.5 kB] 189s Get:8 http://ftpmaster.internal/ubuntu oracular/universe armhf python3-pycryptodome armhf 3.20.0+dfsg-1 [1088 kB] 189s Get:9 http://ftpmaster.internal/ubuntu oracular/universe armhf python3-authlib all 1.3.1-1 [112 kB] 189s Get:10 http://ftpmaster.internal/ubuntu oracular/universe armhf python3-cachelib all 0.13.0-2 [20.7 kB] 189s Get:11 http://ftpmaster.internal/ubuntu oracular/main armhf python3-colorama all 0.4.6-4 [32.1 kB] 189s Get:12 http://ftpmaster.internal/ubuntu oracular/main armhf python3-click all 8.1.7-1 [79.1 kB] 189s Get:13 http://ftpmaster.internal/ubuntu oracular/main armhf python3-sqlparse all 0.5.0-1 [32.4 kB] 189s Get:14 http://ftpmaster.internal/ubuntu oracular/main armhf python3-django all 3:4.2.13-1 [2919 kB] 190s Get:15 http://ftpmaster.internal/ubuntu oracular/main armhf python3-itsdangerous all 2.2.0-1 [15.2 kB] 190s Get:16 http://ftpmaster.internal/ubuntu oracular/main armhf python3-werkzeug all 3.0.3-1 [170 kB] 190s Get:17 http://ftpmaster.internal/ubuntu oracular/main armhf python3-flask all 3.0.3-1ubuntu1 [83.2 kB] 190s Get:18 http://ftpmaster.internal/ubuntu oracular/main armhf python3-greenlet armhf 3.0.3-0ubuntu5 [153 kB] 190s Get:19 http://ftpmaster.internal/ubuntu oracular/main armhf python3-sqlalchemy all 1.4.50+ds1-1build1 [1020 kB] 190s Get:20 http://ftpmaster.internal/ubuntu oracular/universe armhf python3-flask-sqlalchemy all 3.0.3-1 [30.9 kB] 190s Get:21 http://ftpmaster.internal/ubuntu oracular/universe armhf python3-h11 all 0.14.0-1 [51.1 kB] 190s Get:22 http://ftpmaster.internal/ubuntu oracular/universe armhf python3-httpcore all 1.0.4-1 [38.8 kB] 190s Get:23 http://ftpmaster.internal/ubuntu oracular-proposed/universe armhf python3-httpx all 0.27.0-1 [60.9 kB] 190s Get:24 http://ftpmaster.internal/ubuntu oracular/universe armhf python3-iniconfig all 1.1.1-2 [6024 B] 190s Get:25 http://ftpmaster.internal/ubuntu oracular/main armhf python3-packaging all 24.0-1 [41.1 kB] 190s Get:26 http://ftpmaster.internal/ubuntu oracular/universe armhf python3-pluggy all 1.5.0-1 [21.0 kB] 190s Get:27 http://ftpmaster.internal/ubuntu oracular/universe armhf python3-pytest all 7.4.4-1 [305 kB] 190s Get:28 http://ftpmaster.internal/ubuntu oracular/universe armhf python3-pytest-asyncio all 0.20.3-1.3 [10.7 kB] 190s Get:29 http://ftpmaster.internal/ubuntu oracular/universe armhf python3-pytest-django all 4.5.2-3 [18.5 kB] 190s Get:30 http://ftpmaster.internal/ubuntu oracular/universe armhf python3-starlette all 0.31.1-1 [49.4 kB] 190s Fetched 6793 kB in 1s (7245 kB/s) 190s Selecting previously unselected package libjs-jquery. 190s (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 58402 files and directories currently installed.) 190s Preparing to unpack .../00-libjs-jquery_3.6.1+dfsg+~3.5.14-1_all.deb ... 190s Unpacking libjs-jquery (3.6.1+dfsg+~3.5.14-1) ... 190s Selecting previously unselected package python3-all. 190s Preparing to unpack .../01-python3-all_3.12.3-0ubuntu1_armhf.deb ... 190s Unpacking python3-all (3.12.3-0ubuntu1) ... 190s Selecting previously unselected package python3-sniffio. 190s Preparing to unpack .../02-python3-sniffio_1.3.1-1_all.deb ... 190s Unpacking python3-sniffio (1.3.1-1) ... 190s Selecting previously unselected package python3-anyio. 190s Preparing to unpack .../03-python3-anyio_4.3.0-1_all.deb ... 190s Unpacking python3-anyio (4.3.0-1) ... 190s Selecting previously unselected package python3-asgiref. 190s Preparing to unpack .../04-python3-asgiref_3.8.1-1_all.deb ... 190s Unpacking python3-asgiref (3.8.1-1) ... 190s Selecting previously unselected package python3-async-generator. 190s Preparing to unpack .../05-python3-async-generator_1.10-4_all.deb ... 190s Unpacking python3-async-generator (1.10-4) ... 190s Selecting previously unselected package python3-pycryptodome. 190s Preparing to unpack .../06-python3-pycryptodome_3.20.0+dfsg-1_armhf.deb ... 190s Unpacking python3-pycryptodome (3.20.0+dfsg-1) ... 190s Selecting previously unselected package python3-authlib. 190s Preparing to unpack .../07-python3-authlib_1.3.1-1_all.deb ... 190s Unpacking python3-authlib (1.3.1-1) ... 190s Selecting previously unselected package python3-cachelib. 190s Preparing to unpack .../08-python3-cachelib_0.13.0-2_all.deb ... 190s Unpacking python3-cachelib (0.13.0-2) ... 190s Selecting previously unselected package python3-colorama. 190s Preparing to unpack .../09-python3-colorama_0.4.6-4_all.deb ... 190s Unpacking python3-colorama (0.4.6-4) ... 190s Selecting previously unselected package python3-click. 190s Preparing to unpack .../10-python3-click_8.1.7-1_all.deb ... 190s Unpacking python3-click (8.1.7-1) ... 190s Selecting previously unselected package python3-sqlparse. 190s Preparing to unpack .../11-python3-sqlparse_0.5.0-1_all.deb ... 190s Unpacking python3-sqlparse (0.5.0-1) ... 191s Selecting previously unselected package python3-django. 191s Preparing to unpack .../12-python3-django_3%3a4.2.13-1_all.deb ... 191s Unpacking python3-django (3:4.2.13-1) ... 191s Selecting previously unselected package python3-itsdangerous. 191s Preparing to unpack .../13-python3-itsdangerous_2.2.0-1_all.deb ... 191s Unpacking python3-itsdangerous (2.2.0-1) ... 191s Selecting previously unselected package python3-werkzeug. 191s Preparing to unpack .../14-python3-werkzeug_3.0.3-1_all.deb ... 191s Unpacking python3-werkzeug (3.0.3-1) ... 191s Selecting previously unselected package python3-flask. 191s Preparing to unpack .../15-python3-flask_3.0.3-1ubuntu1_all.deb ... 191s Unpacking python3-flask (3.0.3-1ubuntu1) ... 191s Selecting previously unselected package python3-greenlet. 191s Preparing to unpack .../16-python3-greenlet_3.0.3-0ubuntu5_armhf.deb ... 191s Unpacking python3-greenlet (3.0.3-0ubuntu5) ... 191s Selecting previously unselected package python3-sqlalchemy. 191s Preparing to unpack .../17-python3-sqlalchemy_1.4.50+ds1-1build1_all.deb ... 191s Unpacking python3-sqlalchemy (1.4.50+ds1-1build1) ... 191s Selecting previously unselected package python3-flask-sqlalchemy. 191s Preparing to unpack .../18-python3-flask-sqlalchemy_3.0.3-1_all.deb ... 191s Unpacking python3-flask-sqlalchemy (3.0.3-1) ... 191s Selecting previously unselected package python3-h11. 191s Preparing to unpack .../19-python3-h11_0.14.0-1_all.deb ... 191s Unpacking python3-h11 (0.14.0-1) ... 191s Selecting previously unselected package python3-httpcore. 191s Preparing to unpack .../20-python3-httpcore_1.0.4-1_all.deb ... 191s Unpacking python3-httpcore (1.0.4-1) ... 192s Selecting previously unselected package python3-httpx. 192s Preparing to unpack .../21-python3-httpx_0.27.0-1_all.deb ... 192s Unpacking python3-httpx (0.27.0-1) ... 192s Selecting previously unselected package python3-iniconfig. 192s Preparing to unpack .../22-python3-iniconfig_1.1.1-2_all.deb ... 192s Unpacking python3-iniconfig (1.1.1-2) ... 192s Selecting previously unselected package python3-packaging. 192s Preparing to unpack .../23-python3-packaging_24.0-1_all.deb ... 192s Unpacking python3-packaging (24.0-1) ... 192s Selecting previously unselected package python3-pluggy. 192s Preparing to unpack .../24-python3-pluggy_1.5.0-1_all.deb ... 192s Unpacking python3-pluggy (1.5.0-1) ... 192s Selecting previously unselected package python3-pytest. 192s Preparing to unpack .../25-python3-pytest_7.4.4-1_all.deb ... 192s Unpacking python3-pytest (7.4.4-1) ... 192s Selecting previously unselected package python3-pytest-asyncio. 192s Preparing to unpack .../26-python3-pytest-asyncio_0.20.3-1.3_all.deb ... 192s Unpacking python3-pytest-asyncio (0.20.3-1.3) ... 192s Selecting previously unselected package python3-pytest-django. 192s Preparing to unpack .../27-python3-pytest-django_4.5.2-3_all.deb ... 192s Unpacking python3-pytest-django (4.5.2-3) ... 192s Selecting previously unselected package python3-starlette. 192s Preparing to unpack .../28-python3-starlette_0.31.1-1_all.deb ... 192s Unpacking python3-starlette (0.31.1-1) ... 192s Selecting previously unselected package autopkgtest-satdep. 192s Preparing to unpack .../29-1-autopkgtest-satdep.deb ... 192s Unpacking autopkgtest-satdep (0) ... 192s Setting up python3-iniconfig (1.1.1-2) ... 192s Setting up python3-sniffio (1.3.1-1) ... 192s Setting up python3-async-generator (1.10-4) ... 192s Setting up python3-anyio (4.3.0-1) ... 192s Setting up python3-colorama (0.4.6-4) ... 193s Setting up python3-pycryptodome (3.20.0+dfsg-1) ... 193s Setting up python3-itsdangerous (2.2.0-1) ... 193s Setting up python3-all (3.12.3-0ubuntu1) ... 193s Setting up python3-starlette (0.31.1-1) ... 193s Setting up python3-click (8.1.7-1) ... 194s Setting up python3-packaging (24.0-1) ... 194s Setting up python3-sqlparse (0.5.0-1) ... 194s Setting up python3-greenlet (3.0.3-0ubuntu5) ... 194s Setting up python3-h11 (0.14.0-1) ... 194s Setting up python3-pluggy (1.5.0-1) ... 194s Setting up python3-cachelib (0.13.0-2) ... 194s Setting up libjs-jquery (3.6.1+dfsg+~3.5.14-1) ... 194s Setting up python3-asgiref (3.8.1-1) ... 194s Setting up python3-authlib (1.3.1-1) ... 195s Setting up python3-httpcore (1.0.4-1) ... 195s Setting up python3-django (3:4.2.13-1) ... 196s Setting up python3-pytest (7.4.4-1) ... 196s Setting up python3-pytest-django (4.5.2-3) ... 197s Setting up python3-sqlalchemy (1.4.50+ds1-1build1) ... 198s Setting up python3-httpx (0.27.0-1) ... 198s Setting up python3-werkzeug (3.0.3-1) ... 198s Setting up python3-pytest-asyncio (0.20.3-1.3) ... 198s Setting up python3-flask (3.0.3-1ubuntu1) ... 198s Setting up python3-flask-sqlalchemy (3.0.3-1) ... 198s Setting up autopkgtest-satdep (0) ... 198s Processing triggers for man-db (2.12.1-2) ... 213s (Reading database ... 66236 files and directories currently installed.) 213s Removing autopkgtest-satdep (0) ... 219s autopkgtest [10:28:26]: test unittests3: [----------------------- 222s === python3.12 === 222s ============================= test session starts ============================== 222s platform linux -- Python 3.12.4, pytest-7.4.4, pluggy-1.5.0 222s rootdir: /tmp/autopkgtest.C1D3tM/autopkgtest_tmp 222s configfile: setup.cfg 222s plugins: anyio-4.3.0, asyncio-0.20.3, django-4.5.2 222s asyncio: mode=Mode.STRICT 222s collected 101 items 222s 222s tests/core/test_oauth2/test_rfc6749_misc.py ...... [ 5%] 224s tests/core/test_oauth2/test_rfc7523.py ........................ [ 29%] 224s tests/core/test_oauth2/test_rfc7591.py ...... [ 35%] 224s tests/core/test_oauth2/test_rfc7662.py ...... [ 41%] 224s tests/core/test_oauth2/test_rfc8414.py .......................... [ 67%] 224s tests/core/test_oidc/test_core.py .......... [ 77%] 224s tests/core/test_oidc/test_discovery.py ....................... [100%] 224s 224s ============================= 101 passed in 1.70s ============================== 225s ============================= test session starts ============================== 225s platform linux -- Python 3.12.4, pytest-7.4.4, pluggy-1.5.0 225s django: settings: tests.clients.test_django.settings (from env) 225s rootdir: /tmp/autopkgtest.C1D3tM/autopkgtest_tmp 225s configfile: setup.cfg 225s plugins: anyio-4.3.0, asyncio-0.20.3, django-4.5.2 225s asyncio: mode=Mode.STRICT 225s collected 167 items 225s 225s tests/clients/test_django/test_oauth_client.py ............. [ 7%] 225s tests/clients/test_flask/test_oauth_client.py .................... [ 19%] 225s tests/clients/test_flask/test_user_mixin.py ..... [ 22%] 226s tests/clients/test_httpx/test_assertion_client.py .. [ 23%] 226s tests/clients/test_httpx/test_async_assertion_client.py F. [ 25%] 235s tests/clients/test_httpx/test_async_oauth1_client.py FFFFFFF [ 29%] 244s tests/clients/test_httpx/test_async_oauth2_client.py FFFFFFss...FFFFFFF. [ 40%] 246s FFFFF. [ 44%] 246s tests/clients/test_httpx/test_oauth1_client.py ....... [ 48%] 246s tests/clients/test_httpx/test_oauth2_client.py ...................... [ 61%] 246s tests/clients/test_requests/test_assertion_session.py .. [ 62%] 246s tests/clients/test_requests/test_oauth1_session.py ................ [ 72%] 247s tests/clients/test_requests/test_oauth2_session.py ..................... [ 85%] 247s ......... [ 90%] 249s tests/clients/test_starlette/test_oauth_client.py ...FF.FFFF.F [ 97%] 250s tests/clients/test_starlette/test_user_mixin.py F..F [100%] 250s 250s =================================== FAILURES =================================== 250s ______________________________ test_refresh_token ______________________________ 250s 250s @contextlib.contextmanager 250s def map_httpcore_exceptions() -> typing.Iterator[None]: 250s try: 250s > yield 250s 250s /usr/lib/python3/dist-packages/httpx/_transports/default.py:69: 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s /usr/lib/python3/dist-packages/httpx/_transports/default.py:373: in handle_async_request 250s resp = await self._pool.handle_async_request(req) 250s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:216: in handle_async_request 250s raise exc from None 250s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:196: in handle_async_request 250s response = await connection.handle_async_request( 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s 250s self = 250s request = 250s 250s async def handle_async_request(self, request: Request) -> Response: 250s timeouts = request.extensions.get("timeout", {}) 250s timeout = timeouts.get("connect", None) 250s 250s async with self._connect_lock: 250s if not self._connected: 250s target = b"%b:%d" % (self._remote_origin.host, self._remote_origin.port) 250s 250s connect_url = URL( 250s scheme=self._proxy_origin.scheme, 250s host=self._proxy_origin.host, 250s port=self._proxy_origin.port, 250s target=target, 250s ) 250s connect_headers = merge_headers( 250s [(b"Host", target), (b"Accept", b"*/*")], self._proxy_headers 250s ) 250s connect_request = Request( 250s method=b"CONNECT", 250s url=connect_url, 250s headers=connect_headers, 250s extensions=request.extensions, 250s ) 250s connect_response = await self._connection.handle_async_request( 250s connect_request 250s ) 250s 250s if connect_response.status < 200 or connect_response.status > 299: 250s reason_bytes = connect_response.extensions.get("reason_phrase", b"") 250s reason_str = reason_bytes.decode("ascii", errors="ignore") 250s msg = "%d %s" % (connect_response.status, reason_str) 250s await self._connection.aclose() 250s > raise ProxyError(msg) 250s E httpcore.ProxyError: 503 Service Unavailable 250s 250s /usr/lib/python3/dist-packages/httpcore/_async/http_proxy.py:298: ProxyError 250s 250s The above exception was the direct cause of the following exception: 250s 250s @pytest.mark.asyncio 250s async def test_refresh_token(): 250s async def verifier(request): 250s content = await request.body() 250s if str(request.url) == 'https://i.b/token': 250s assert b'assertion=' in content 250s 250s async with AsyncAssertionClient( 250s 'https://i.b/token', 250s grant_type=AsyncAssertionClient.JWT_BEARER_GRANT_TYPE, 250s issuer='foo', 250s subject='foo', 250s audience='foo', 250s alg='HS256', 250s key='secret', 250s app=AsyncMockDispatch(default_token, assert_func=verifier) 250s ) as client: 250s > await client.get('https://i.b') 250s 250s tests/clients/test_httpx/test_async_assertion_client.py:33: 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s /usr/lib/python3/dist-packages/httpx/_client.py:1801: in get 250s return await self.request( 250s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/assertion_client.py:38: in request 250s await self.refresh_token() 250s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/assertion_client.py:45: in _refresh_token 250s resp = await self.request( 250s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/assertion_client.py:41: in request 250s return await super().request( 250s /usr/lib/python3/dist-packages/httpx/_client.py:1574: in request 250s return await self.send(request, auth=auth, follow_redirects=follow_redirects) 250s /usr/lib/python3/dist-packages/httpx/_client.py:1661: in send 250s response = await self._send_handling_auth( 250s /usr/lib/python3/dist-packages/httpx/_client.py:1689: in _send_handling_auth 250s response = await self._send_handling_redirects( 250s /usr/lib/python3/dist-packages/httpx/_client.py:1726: in _send_handling_redirects 250s response = await self._send_single_request(request) 250s /usr/lib/python3/dist-packages/httpx/_client.py:1763: in _send_single_request 250s response = await transport.handle_async_request(request) 250s /usr/lib/python3/dist-packages/httpx/_transports/default.py:372: in handle_async_request 250s with map_httpcore_exceptions(): 250s /usr/lib/python3.12/contextlib.py:158: in __exit__ 250s self.gen.throw(value) 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s 250s @contextlib.contextmanager 250s def map_httpcore_exceptions() -> typing.Iterator[None]: 250s try: 250s yield 250s except Exception as exc: 250s mapped_exc = None 250s 250s for from_exc, to_exc in HTTPCORE_EXC_MAP.items(): 250s if not isinstance(exc, from_exc): 250s continue 250s # We want to map to the most specific exception we can find. 250s # Eg if `exc` is an `httpcore.ReadTimeout`, we want to map to 250s # `httpx.ReadTimeout`, not just `httpx.TimeoutException`. 250s if mapped_exc is None or issubclass(to_exc, mapped_exc): 250s mapped_exc = to_exc 250s 250s if mapped_exc is None: # pragma: no cover 250s raise 250s 250s message = str(exc) 250s > raise mapped_exc(message) from exc 250s E httpx.ProxyError: 503 Service Unavailable 250s 250s /usr/lib/python3/dist-packages/httpx/_transports/default.py:86: ProxyError 250s _____________________ test_fetch_request_token_via_header ______________________ 250s 250s @pytest.mark.asyncio 250s async def test_fetch_request_token_via_header(): 250s request_token = {'oauth_token': '1', 'oauth_token_secret': '2'} 250s 250s async def assert_func(request): 250s auth_header = request.headers.get('authorization') 250s assert 'oauth_consumer_key="id"' in auth_header 250s assert 'oauth_signature=' in auth_header 250s 250s app = AsyncMockDispatch(request_token, assert_func=assert_func) 250s async with AsyncOAuth1Client('id', 'secret', app=app) as client: 250s > response = await client.fetch_request_token(oauth_url) 250s 250s tests/clients/test_httpx/test_async_oauth1_client.py:24: 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth1_client.py:70: in _fetch_token 250s token = self.parse_response_token(resp.status_code, to_unicode(text)) 250s /usr/lib/python3/dist-packages/authlib/oauth1/client.py:152: in parse_response_token 250s self.handle_error('fetch_token_denied', message) 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s 250s error_type = 'fetch_token_denied' 250s error_description = 'Token request failed with code 404, response was \'\n\n\t\t\n\t\n\n\'.' 250s 250s @staticmethod 250s def handle_error(error_type, error_description): 250s > raise OAuthError(error_type, error_description) 250s E authlib.integrations.base_client.errors.OAuthError: fetch_token_denied: Token request failed with code 404, response was ' 250s E 250s E 250s E 250s E 404 - Not Found 250s E 250s E 250s E

404 - Not Found

250s E 250s E 250s E 250s E '. 250s 250s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth1_client.py:76: OAuthError 250s ______________________ test_fetch_request_token_via_body _______________________ 250s 250s @pytest.mark.asyncio 250s async def test_fetch_request_token_via_body(): 250s request_token = {'oauth_token': '1', 'oauth_token_secret': '2'} 250s 250s async def assert_func(request): 250s auth_header = request.headers.get('authorization') 250s assert auth_header is None 250s 250s content = await request.body() 250s assert b'oauth_consumer_key=id' in content 250s assert b'&oauth_signature=' in content 250s 250s mock_response = AsyncMockDispatch(request_token, assert_func=assert_func) 250s 250s async with AsyncOAuth1Client( 250s 'id', 'secret', signature_type=SIGNATURE_TYPE_BODY, 250s app=mock_response, 250s ) as client: 250s > response = await client.fetch_request_token(oauth_url) 250s 250s tests/clients/test_httpx/test_async_oauth1_client.py:47: 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth1_client.py:70: in _fetch_token 250s token = self.parse_response_token(resp.status_code, to_unicode(text)) 250s /usr/lib/python3/dist-packages/authlib/oauth1/client.py:152: in parse_response_token 250s self.handle_error('fetch_token_denied', message) 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s 250s error_type = 'fetch_token_denied' 250s error_description = 'Token request failed with code 404, response was \'\n\n\t\t\n\t\n\n\'.' 250s 250s @staticmethod 250s def handle_error(error_type, error_description): 250s > raise OAuthError(error_type, error_description) 250s E authlib.integrations.base_client.errors.OAuthError: fetch_token_denied: Token request failed with code 404, response was ' 250s E 250s E 250s E 250s E 404 - Not Found 250s E 250s E 250s E

404 - Not Found

250s E 250s E 250s E 250s E '. 250s 250s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth1_client.py:76: OAuthError 250s ______________________ test_fetch_request_token_via_query ______________________ 250s 250s @pytest.mark.asyncio 250s async def test_fetch_request_token_via_query(): 250s request_token = {'oauth_token': '1', 'oauth_token_secret': '2'} 250s 250s async def assert_func(request): 250s auth_header = request.headers.get('authorization') 250s assert auth_header is None 250s 250s url = str(request.url) 250s assert 'oauth_consumer_key=id' in url 250s assert '&oauth_signature=' in url 250s 250s mock_response = AsyncMockDispatch(request_token, assert_func=assert_func) 250s 250s async with AsyncOAuth1Client( 250s 'id', 'secret', signature_type=SIGNATURE_TYPE_QUERY, 250s app=mock_response, 250s ) as client: 250s > response = await client.fetch_request_token(oauth_url) 250s 250s tests/clients/test_httpx/test_async_oauth1_client.py:70: 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth1_client.py:70: in _fetch_token 250s token = self.parse_response_token(resp.status_code, to_unicode(text)) 250s /usr/lib/python3/dist-packages/authlib/oauth1/client.py:152: in parse_response_token 250s self.handle_error('fetch_token_denied', message) 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s 250s error_type = 'fetch_token_denied' 250s error_description = 'Token request failed with code 404, response was \'\n\n\t\t\n\t\n\n\'.' 250s 250s @staticmethod 250s def handle_error(error_type, error_description): 250s > raise OAuthError(error_type, error_description) 250s E authlib.integrations.base_client.errors.OAuthError: fetch_token_denied: Token request failed with code 404, response was ' 250s E 250s E 250s E 250s E 404 - Not Found 250s E 250s E 250s E

404 - Not Found

250s E 250s E 250s E 250s E '. 250s 250s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth1_client.py:76: OAuthError 250s ___________________________ test_fetch_access_token ____________________________ 250s 250s @pytest.mark.asyncio 250s async def test_fetch_access_token(): 250s request_token = {'oauth_token': '1', 'oauth_token_secret': '2'} 250s 250s async def assert_func(request): 250s auth_header = request.headers.get('authorization') 250s assert 'oauth_verifier="d"' in auth_header 250s assert 'oauth_token="foo"' in auth_header 250s assert 'oauth_consumer_key="id"' in auth_header 250s assert 'oauth_signature=' in auth_header 250s 250s mock_response = AsyncMockDispatch(request_token, assert_func=assert_func) 250s async with AsyncOAuth1Client( 250s 'id', 'secret', token='foo', token_secret='bar', 250s app=mock_response, 250s ) as client: 250s with pytest.raises(OAuthError): 250s await client.fetch_access_token(oauth_url) 250s 250s > response = await client.fetch_access_token(oauth_url, verifier='d') 250s 250s tests/clients/test_httpx/test_async_oauth1_client.py:94: 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth1_client.py:63: in fetch_access_token 250s token = await self._fetch_token(url, **kwargs) 250s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth1_client.py:70: in _fetch_token 250s token = self.parse_response_token(resp.status_code, to_unicode(text)) 250s /usr/lib/python3/dist-packages/authlib/oauth1/client.py:152: in parse_response_token 250s self.handle_error('fetch_token_denied', message) 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s 250s error_type = 'fetch_token_denied' 250s error_description = 'Token request failed with code 404, response was \'\n\n\t\t\n\t\n\n\'.' 250s 250s @staticmethod 250s def handle_error(error_type, error_description): 250s > raise OAuthError(error_type, error_description) 250s E authlib.integrations.base_client.errors.OAuthError: fetch_token_denied: Token request failed with code 404, response was ' 250s E 250s E 250s E 250s E 404 - Not Found 250s E 250s E 250s E

404 - Not Found

250s E 250s E 250s E 250s E '. 250s 250s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth1_client.py:76: OAuthError 250s _____________________________ test_get_via_header ______________________________ 250s 250s @pytest.mark.asyncio 250s async def test_get_via_header(): 250s mock_response = AsyncMockDispatch(b'hello') 250s async with AsyncOAuth1Client( 250s 'id', 'secret', token='foo', token_secret='bar', 250s app=mock_response, 250s ) as client: 250s response = await client.get('https://example.com/') 250s 250s > assert response.content == b'hello' 250s E AssertionError: assert b'\n\n' == b'hello' 250s E At index 0 diff: b'<' != b'h' 250s E Use -v to get more diff 250s 250s tests/clients/test_httpx/test_async_oauth1_client.py:108: AssertionError 250s ______________________________ test_get_via_body _______________________________ 250s 250s @pytest.mark.asyncio 250s async def test_get_via_body(): 250s async def assert_func(request): 250s content = await request.body() 250s assert b'oauth_token=foo' in content 250s assert b'oauth_consumer_key=id' in content 250s assert b'oauth_signature=' in content 250s 250s mock_response = AsyncMockDispatch(b'hello', assert_func=assert_func) 250s async with AsyncOAuth1Client( 250s 'id', 'secret', token='foo', token_secret='bar', 250s signature_type=SIGNATURE_TYPE_BODY, 250s app=mock_response, 250s ) as client: 250s response = await client.post('https://example.com/') 250s 250s > assert response.content == b'hello' 250s E AssertionError: assert b'\n\n' == b'hello' 250s E At index 0 diff: b'<' != b'h' 250s E Use -v to get more diff 250s 250s tests/clients/test_httpx/test_async_oauth1_client.py:132: AssertionError 250s ______________________________ test_get_via_query ______________________________ 250s 250s @pytest.mark.asyncio 250s async def test_get_via_query(): 250s mock_response = AsyncMockDispatch(b'hello') 250s async with AsyncOAuth1Client( 250s 'id', 'secret', token='foo', token_secret='bar', 250s signature_type=SIGNATURE_TYPE_QUERY, 250s app=mock_response, 250s ) as client: 250s response = await client.get('https://example.com/') 250s 250s > assert response.content == b'hello' 250s E AssertionError: assert b'\n\n' == b'hello' 250s E At index 0 diff: b'<' != b'h' 250s E Use -v to get more diff 250s 250s tests/clients/test_httpx/test_async_oauth1_client.py:149: AssertionError 250s __________ test_add_token_get_request[assert_token_in_header-header] ___________ 250s 250s @contextlib.contextmanager 250s def map_httpcore_exceptions() -> typing.Iterator[None]: 250s try: 250s > yield 250s 250s /usr/lib/python3/dist-packages/httpx/_transports/default.py:69: 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s /usr/lib/python3/dist-packages/httpx/_transports/default.py:373: in handle_async_request 250s resp = await self._pool.handle_async_request(req) 250s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:216: in handle_async_request 250s raise exc from None 250s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:196: in handle_async_request 250s response = await connection.handle_async_request( 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s 250s self = 250s request = 250s 250s async def handle_async_request(self, request: Request) -> Response: 250s timeouts = request.extensions.get("timeout", {}) 250s timeout = timeouts.get("connect", None) 250s 250s async with self._connect_lock: 250s if not self._connected: 250s target = b"%b:%d" % (self._remote_origin.host, self._remote_origin.port) 250s 250s connect_url = URL( 250s scheme=self._proxy_origin.scheme, 250s host=self._proxy_origin.host, 250s port=self._proxy_origin.port, 250s target=target, 250s ) 250s connect_headers = merge_headers( 250s [(b"Host", target), (b"Accept", b"*/*")], self._proxy_headers 250s ) 250s connect_request = Request( 250s method=b"CONNECT", 250s url=connect_url, 250s headers=connect_headers, 250s extensions=request.extensions, 250s ) 250s connect_response = await self._connection.handle_async_request( 250s connect_request 250s ) 250s 250s if connect_response.status < 200 or connect_response.status > 299: 250s reason_bytes = connect_response.extensions.get("reason_phrase", b"") 250s reason_str = reason_bytes.decode("ascii", errors="ignore") 250s msg = "%d %s" % (connect_response.status, reason_str) 250s await self._connection.aclose() 250s > raise ProxyError(msg) 250s E httpcore.ProxyError: 503 Service Unavailable 250s 250s /usr/lib/python3/dist-packages/httpcore/_async/http_proxy.py:298: ProxyError 250s 250s The above exception was the direct cause of the following exception: 250s 250s assert_func = 250s token_placement = 'header' 250s 250s @pytest.mark.asyncio 250s @pytest.mark.parametrize( 250s "assert_func, token_placement", 250s [ 250s (assert_token_in_header, "header"), 250s (assert_token_in_body, "body"), 250s (assert_token_in_uri, "uri") 250s ] 250s ) 250s async def test_add_token_get_request(assert_func, token_placement): 250s mock_response = AsyncMockDispatch({'a': 'a'}, assert_func=assert_func) 250s async with AsyncOAuth2Client( 250s 'foo', 250s token=default_token, 250s token_placement=token_placement, 250s app=mock_response 250s ) as client: 250s > resp = await client.get('https://i.b') 250s 250s tests/clients/test_httpx/test_async_oauth2_client.py:62: 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s /usr/lib/python3/dist-packages/httpx/_client.py:1801: in get 250s return await self.request( 250s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:90: in request 250s return await super().request( 250s /usr/lib/python3/dist-packages/httpx/_client.py:1574: in request 250s return await self.send(request, auth=auth, follow_redirects=follow_redirects) 250s /usr/lib/python3/dist-packages/httpx/_client.py:1661: in send 250s response = await self._send_handling_auth( 250s /usr/lib/python3/dist-packages/httpx/_client.py:1689: in _send_handling_auth 250s response = await self._send_handling_redirects( 250s /usr/lib/python3/dist-packages/httpx/_client.py:1726: in _send_handling_redirects 250s response = await self._send_single_request(request) 250s /usr/lib/python3/dist-packages/httpx/_client.py:1763: in _send_single_request 250s response = await transport.handle_async_request(request) 250s /usr/lib/python3/dist-packages/httpx/_transports/default.py:372: in handle_async_request 250s with map_httpcore_exceptions(): 250s /usr/lib/python3.12/contextlib.py:158: in __exit__ 250s self.gen.throw(value) 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s 250s @contextlib.contextmanager 250s def map_httpcore_exceptions() -> typing.Iterator[None]: 250s try: 250s yield 250s except Exception as exc: 250s mapped_exc = None 250s 250s for from_exc, to_exc in HTTPCORE_EXC_MAP.items(): 250s if not isinstance(exc, from_exc): 250s continue 250s # We want to map to the most specific exception we can find. 250s # Eg if `exc` is an `httpcore.ReadTimeout`, we want to map to 250s # `httpx.ReadTimeout`, not just `httpx.TimeoutException`. 250s if mapped_exc is None or issubclass(to_exc, mapped_exc): 250s mapped_exc = to_exc 250s 250s if mapped_exc is None: # pragma: no cover 250s raise 250s 250s message = str(exc) 250s > raise mapped_exc(message) from exc 250s E httpx.ProxyError: 503 Service Unavailable 250s 250s /usr/lib/python3/dist-packages/httpx/_transports/default.py:86: ProxyError 250s ____________ test_add_token_get_request[assert_token_in_body-body] _____________ 250s 250s @contextlib.contextmanager 250s def map_httpcore_exceptions() -> typing.Iterator[None]: 250s try: 250s > yield 250s 250s /usr/lib/python3/dist-packages/httpx/_transports/default.py:69: 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s /usr/lib/python3/dist-packages/httpx/_transports/default.py:373: in handle_async_request 250s resp = await self._pool.handle_async_request(req) 250s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:216: in handle_async_request 250s raise exc from None 250s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:196: in handle_async_request 250s response = await connection.handle_async_request( 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s 250s self = 250s request = 250s 250s async def handle_async_request(self, request: Request) -> Response: 250s timeouts = request.extensions.get("timeout", {}) 250s timeout = timeouts.get("connect", None) 250s 250s async with self._connect_lock: 250s if not self._connected: 250s target = b"%b:%d" % (self._remote_origin.host, self._remote_origin.port) 250s 250s connect_url = URL( 250s scheme=self._proxy_origin.scheme, 250s host=self._proxy_origin.host, 250s port=self._proxy_origin.port, 250s target=target, 250s ) 250s connect_headers = merge_headers( 250s [(b"Host", target), (b"Accept", b"*/*")], self._proxy_headers 250s ) 250s connect_request = Request( 250s method=b"CONNECT", 250s url=connect_url, 250s headers=connect_headers, 250s extensions=request.extensions, 250s ) 250s connect_response = await self._connection.handle_async_request( 250s connect_request 250s ) 250s 250s if connect_response.status < 200 or connect_response.status > 299: 250s reason_bytes = connect_response.extensions.get("reason_phrase", b"") 250s reason_str = reason_bytes.decode("ascii", errors="ignore") 250s msg = "%d %s" % (connect_response.status, reason_str) 250s await self._connection.aclose() 250s > raise ProxyError(msg) 250s E httpcore.ProxyError: 503 Service Unavailable 250s 250s /usr/lib/python3/dist-packages/httpcore/_async/http_proxy.py:298: ProxyError 250s 250s The above exception was the direct cause of the following exception: 250s 250s assert_func = 250s token_placement = 'body' 250s 250s @pytest.mark.asyncio 250s @pytest.mark.parametrize( 250s "assert_func, token_placement", 250s [ 250s (assert_token_in_header, "header"), 250s (assert_token_in_body, "body"), 250s (assert_token_in_uri, "uri") 250s ] 250s ) 250s async def test_add_token_get_request(assert_func, token_placement): 250s mock_response = AsyncMockDispatch({'a': 'a'}, assert_func=assert_func) 250s async with AsyncOAuth2Client( 250s 'foo', 250s token=default_token, 250s token_placement=token_placement, 250s app=mock_response 250s ) as client: 250s > resp = await client.get('https://i.b') 250s 250s tests/clients/test_httpx/test_async_oauth2_client.py:62: 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s /usr/lib/python3/dist-packages/httpx/_client.py:1801: in get 250s return await self.request( 250s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:90: in request 250s return await super().request( 250s /usr/lib/python3/dist-packages/httpx/_client.py:1574: in request 250s return await self.send(request, auth=auth, follow_redirects=follow_redirects) 250s /usr/lib/python3/dist-packages/httpx/_client.py:1661: in send 250s response = await self._send_handling_auth( 250s /usr/lib/python3/dist-packages/httpx/_client.py:1689: in _send_handling_auth 250s response = await self._send_handling_redirects( 250s /usr/lib/python3/dist-packages/httpx/_client.py:1726: in _send_handling_redirects 250s response = await self._send_single_request(request) 250s /usr/lib/python3/dist-packages/httpx/_client.py:1763: in _send_single_request 250s response = await transport.handle_async_request(request) 250s /usr/lib/python3/dist-packages/httpx/_transports/default.py:372: in handle_async_request 250s with map_httpcore_exceptions(): 250s /usr/lib/python3.12/contextlib.py:158: in __exit__ 250s self.gen.throw(value) 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s 250s @contextlib.contextmanager 250s def map_httpcore_exceptions() -> typing.Iterator[None]: 250s try: 250s yield 250s except Exception as exc: 250s mapped_exc = None 250s 250s for from_exc, to_exc in HTTPCORE_EXC_MAP.items(): 250s if not isinstance(exc, from_exc): 250s continue 250s # We want to map to the most specific exception we can find. 250s # Eg if `exc` is an `httpcore.ReadTimeout`, we want to map to 250s # `httpx.ReadTimeout`, not just `httpx.TimeoutException`. 250s if mapped_exc is None or issubclass(to_exc, mapped_exc): 250s mapped_exc = to_exc 250s 250s if mapped_exc is None: # pragma: no cover 250s raise 250s 250s message = str(exc) 250s > raise mapped_exc(message) from exc 250s E httpx.ProxyError: 503 Service Unavailable 250s 250s /usr/lib/python3/dist-packages/httpx/_transports/default.py:86: ProxyError 250s _____________ test_add_token_get_request[assert_token_in_uri-uri] ______________ 250s 250s @contextlib.contextmanager 250s def map_httpcore_exceptions() -> typing.Iterator[None]: 250s try: 250s > yield 250s 250s /usr/lib/python3/dist-packages/httpx/_transports/default.py:69: 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s /usr/lib/python3/dist-packages/httpx/_transports/default.py:373: in handle_async_request 250s resp = await self._pool.handle_async_request(req) 250s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:216: in handle_async_request 250s raise exc from None 250s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:196: in handle_async_request 250s response = await connection.handle_async_request( 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s 250s self = 250s request = 250s 250s async def handle_async_request(self, request: Request) -> Response: 250s timeouts = request.extensions.get("timeout", {}) 250s timeout = timeouts.get("connect", None) 250s 250s async with self._connect_lock: 250s if not self._connected: 250s target = b"%b:%d" % (self._remote_origin.host, self._remote_origin.port) 250s 250s connect_url = URL( 250s scheme=self._proxy_origin.scheme, 250s host=self._proxy_origin.host, 250s port=self._proxy_origin.port, 250s target=target, 250s ) 250s connect_headers = merge_headers( 250s [(b"Host", target), (b"Accept", b"*/*")], self._proxy_headers 250s ) 250s connect_request = Request( 250s method=b"CONNECT", 250s url=connect_url, 250s headers=connect_headers, 250s extensions=request.extensions, 250s ) 250s connect_response = await self._connection.handle_async_request( 250s connect_request 250s ) 250s 250s if connect_response.status < 200 or connect_response.status > 299: 250s reason_bytes = connect_response.extensions.get("reason_phrase", b"") 250s reason_str = reason_bytes.decode("ascii", errors="ignore") 250s msg = "%d %s" % (connect_response.status, reason_str) 250s await self._connection.aclose() 250s > raise ProxyError(msg) 250s E httpcore.ProxyError: 503 Service Unavailable 250s 250s /usr/lib/python3/dist-packages/httpcore/_async/http_proxy.py:298: ProxyError 250s 250s The above exception was the direct cause of the following exception: 250s 250s assert_func = 250s token_placement = 'uri' 250s 250s @pytest.mark.asyncio 250s @pytest.mark.parametrize( 250s "assert_func, token_placement", 250s [ 250s (assert_token_in_header, "header"), 250s (assert_token_in_body, "body"), 250s (assert_token_in_uri, "uri") 250s ] 250s ) 250s async def test_add_token_get_request(assert_func, token_placement): 250s mock_response = AsyncMockDispatch({'a': 'a'}, assert_func=assert_func) 250s async with AsyncOAuth2Client( 250s 'foo', 250s token=default_token, 250s token_placement=token_placement, 250s app=mock_response 250s ) as client: 250s > resp = await client.get('https://i.b') 250s 250s tests/clients/test_httpx/test_async_oauth2_client.py:62: 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s /usr/lib/python3/dist-packages/httpx/_client.py:1801: in get 250s return await self.request( 250s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:90: in request 250s return await super().request( 250s /usr/lib/python3/dist-packages/httpx/_client.py:1574: in request 250s return await self.send(request, auth=auth, follow_redirects=follow_redirects) 250s /usr/lib/python3/dist-packages/httpx/_client.py:1661: in send 250s response = await self._send_handling_auth( 250s /usr/lib/python3/dist-packages/httpx/_client.py:1689: in _send_handling_auth 250s response = await self._send_handling_redirects( 250s /usr/lib/python3/dist-packages/httpx/_client.py:1726: in _send_handling_redirects 250s response = await self._send_single_request(request) 250s /usr/lib/python3/dist-packages/httpx/_client.py:1763: in _send_single_request 250s response = await transport.handle_async_request(request) 250s /usr/lib/python3/dist-packages/httpx/_transports/default.py:372: in handle_async_request 250s with map_httpcore_exceptions(): 250s /usr/lib/python3.12/contextlib.py:158: in __exit__ 250s self.gen.throw(value) 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s 250s @contextlib.contextmanager 250s def map_httpcore_exceptions() -> typing.Iterator[None]: 250s try: 250s yield 250s except Exception as exc: 250s mapped_exc = None 250s 250s for from_exc, to_exc in HTTPCORE_EXC_MAP.items(): 250s if not isinstance(exc, from_exc): 250s continue 250s # We want to map to the most specific exception we can find. 250s # Eg if `exc` is an `httpcore.ReadTimeout`, we want to map to 250s # `httpx.ReadTimeout`, not just `httpx.TimeoutException`. 250s if mapped_exc is None or issubclass(to_exc, mapped_exc): 250s mapped_exc = to_exc 250s 250s if mapped_exc is None: # pragma: no cover 250s raise 250s 250s message = str(exc) 250s > raise mapped_exc(message) from exc 250s E httpx.ProxyError: 503 Service Unavailable 250s 250s /usr/lib/python3/dist-packages/httpx/_transports/default.py:86: ProxyError 250s ______ test_add_token_to_streaming_request[assert_token_in_header-header] ______ 250s 250s @contextlib.contextmanager 250s def map_httpcore_exceptions() -> typing.Iterator[None]: 250s try: 250s > yield 250s 250s /usr/lib/python3/dist-packages/httpx/_transports/default.py:69: 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s /usr/lib/python3/dist-packages/httpx/_transports/default.py:373: in handle_async_request 250s resp = await self._pool.handle_async_request(req) 250s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:216: in handle_async_request 250s raise exc from None 250s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:196: in handle_async_request 250s response = await connection.handle_async_request( 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s 250s self = 250s request = 250s 250s async def handle_async_request(self, request: Request) -> Response: 250s timeouts = request.extensions.get("timeout", {}) 250s timeout = timeouts.get("connect", None) 250s 250s async with self._connect_lock: 250s if not self._connected: 250s target = b"%b:%d" % (self._remote_origin.host, self._remote_origin.port) 250s 250s connect_url = URL( 250s scheme=self._proxy_origin.scheme, 250s host=self._proxy_origin.host, 250s port=self._proxy_origin.port, 250s target=target, 250s ) 250s connect_headers = merge_headers( 250s [(b"Host", target), (b"Accept", b"*/*")], self._proxy_headers 250s ) 250s connect_request = Request( 250s method=b"CONNECT", 250s url=connect_url, 250s headers=connect_headers, 250s extensions=request.extensions, 250s ) 250s connect_response = await self._connection.handle_async_request( 250s connect_request 250s ) 250s 250s if connect_response.status < 200 or connect_response.status > 299: 250s reason_bytes = connect_response.extensions.get("reason_phrase", b"") 250s reason_str = reason_bytes.decode("ascii", errors="ignore") 250s msg = "%d %s" % (connect_response.status, reason_str) 250s await self._connection.aclose() 250s > raise ProxyError(msg) 250s E httpcore.ProxyError: 503 Service Unavailable 250s 250s /usr/lib/python3/dist-packages/httpcore/_async/http_proxy.py:298: ProxyError 250s 250s The above exception was the direct cause of the following exception: 250s 250s assert_func = 250s token_placement = 'header' 250s 250s @pytest.mark.asyncio 250s @pytest.mark.parametrize( 250s "assert_func, token_placement", 250s [ 250s (assert_token_in_header, "header"), 250s (assert_token_in_body, "body"), 250s (assert_token_in_uri, "uri") 250s ] 250s ) 250s async def test_add_token_to_streaming_request(assert_func, token_placement): 250s mock_response = AsyncMockDispatch({'a': 'a'}, assert_func=assert_func) 250s async with AsyncOAuth2Client( 250s 'foo', 250s token=default_token, 250s token_placement=token_placement, 250s app=mock_response 250s ) as client: 250s > async with client.stream("GET", 'https://i.b') as stream: 250s 250s tests/clients/test_httpx/test_async_oauth2_client.py:85: 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s /usr/lib/python3.12/contextlib.py:210: in __aenter__ 250s return await anext(self.gen) 250s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:103: in stream 250s async with super().stream( 250s /usr/lib/python3.12/contextlib.py:210: in __aenter__ 250s return await anext(self.gen) 250s /usr/lib/python3/dist-packages/httpx/_client.py:1617: in stream 250s response = await self.send( 250s /usr/lib/python3/dist-packages/httpx/_client.py:1661: in send 250s response = await self._send_handling_auth( 250s /usr/lib/python3/dist-packages/httpx/_client.py:1689: in _send_handling_auth 250s response = await self._send_handling_redirects( 250s /usr/lib/python3/dist-packages/httpx/_client.py:1726: in _send_handling_redirects 250s response = await self._send_single_request(request) 250s /usr/lib/python3/dist-packages/httpx/_client.py:1763: in _send_single_request 250s response = await transport.handle_async_request(request) 250s /usr/lib/python3/dist-packages/httpx/_transports/default.py:372: in handle_async_request 250s with map_httpcore_exceptions(): 250s /usr/lib/python3.12/contextlib.py:158: in __exit__ 250s self.gen.throw(value) 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s 250s @contextlib.contextmanager 250s def map_httpcore_exceptions() -> typing.Iterator[None]: 250s try: 250s yield 250s except Exception as exc: 250s mapped_exc = None 250s 250s for from_exc, to_exc in HTTPCORE_EXC_MAP.items(): 250s if not isinstance(exc, from_exc): 250s continue 250s # We want to map to the most specific exception we can find. 250s # Eg if `exc` is an `httpcore.ReadTimeout`, we want to map to 250s # `httpx.ReadTimeout`, not just `httpx.TimeoutException`. 250s if mapped_exc is None or issubclass(to_exc, mapped_exc): 250s mapped_exc = to_exc 250s 250s if mapped_exc is None: # pragma: no cover 250s raise 250s 250s message = str(exc) 250s > raise mapped_exc(message) from exc 250s E httpx.ProxyError: 503 Service Unavailable 250s 250s /usr/lib/python3/dist-packages/httpx/_transports/default.py:86: ProxyError 250s ________ test_add_token_to_streaming_request[assert_token_in_body-body] ________ 250s 250s @contextlib.contextmanager 250s def map_httpcore_exceptions() -> typing.Iterator[None]: 250s try: 250s > yield 250s 250s /usr/lib/python3/dist-packages/httpx/_transports/default.py:69: 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s /usr/lib/python3/dist-packages/httpx/_transports/default.py:373: in handle_async_request 250s resp = await self._pool.handle_async_request(req) 250s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:216: in handle_async_request 250s raise exc from None 250s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:196: in handle_async_request 250s response = await connection.handle_async_request( 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s 250s self = 250s request = 250s 250s async def handle_async_request(self, request: Request) -> Response: 250s timeouts = request.extensions.get("timeout", {}) 250s timeout = timeouts.get("connect", None) 250s 250s async with self._connect_lock: 250s if not self._connected: 250s target = b"%b:%d" % (self._remote_origin.host, self._remote_origin.port) 250s 250s connect_url = URL( 250s scheme=self._proxy_origin.scheme, 250s host=self._proxy_origin.host, 250s port=self._proxy_origin.port, 250s target=target, 250s ) 250s connect_headers = merge_headers( 250s [(b"Host", target), (b"Accept", b"*/*")], self._proxy_headers 250s ) 250s connect_request = Request( 250s method=b"CONNECT", 250s url=connect_url, 250s headers=connect_headers, 250s extensions=request.extensions, 250s ) 250s connect_response = await self._connection.handle_async_request( 250s connect_request 250s ) 250s 250s if connect_response.status < 200 or connect_response.status > 299: 250s reason_bytes = connect_response.extensions.get("reason_phrase", b"") 250s reason_str = reason_bytes.decode("ascii", errors="ignore") 250s msg = "%d %s" % (connect_response.status, reason_str) 250s await self._connection.aclose() 250s > raise ProxyError(msg) 250s E httpcore.ProxyError: 503 Service Unavailable 250s 250s /usr/lib/python3/dist-packages/httpcore/_async/http_proxy.py:298: ProxyError 250s 250s The above exception was the direct cause of the following exception: 250s 250s assert_func = 250s token_placement = 'body' 250s 250s @pytest.mark.asyncio 250s @pytest.mark.parametrize( 250s "assert_func, token_placement", 250s [ 250s (assert_token_in_header, "header"), 250s (assert_token_in_body, "body"), 250s (assert_token_in_uri, "uri") 250s ] 250s ) 250s async def test_add_token_to_streaming_request(assert_func, token_placement): 250s mock_response = AsyncMockDispatch({'a': 'a'}, assert_func=assert_func) 250s async with AsyncOAuth2Client( 250s 'foo', 250s token=default_token, 250s token_placement=token_placement, 250s app=mock_response 250s ) as client: 250s > async with client.stream("GET", 'https://i.b') as stream: 250s 250s tests/clients/test_httpx/test_async_oauth2_client.py:85: 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s /usr/lib/python3.12/contextlib.py:210: in __aenter__ 250s return await anext(self.gen) 250s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:103: in stream 250s async with super().stream( 250s /usr/lib/python3.12/contextlib.py:210: in __aenter__ 250s return await anext(self.gen) 250s /usr/lib/python3/dist-packages/httpx/_client.py:1617: in stream 250s response = await self.send( 250s /usr/lib/python3/dist-packages/httpx/_client.py:1661: in send 250s response = await self._send_handling_auth( 250s /usr/lib/python3/dist-packages/httpx/_client.py:1689: in _send_handling_auth 250s response = await self._send_handling_redirects( 250s /usr/lib/python3/dist-packages/httpx/_client.py:1726: in _send_handling_redirects 250s response = await self._send_single_request(request) 250s /usr/lib/python3/dist-packages/httpx/_client.py:1763: in _send_single_request 250s response = await transport.handle_async_request(request) 250s /usr/lib/python3/dist-packages/httpx/_transports/default.py:372: in handle_async_request 250s with map_httpcore_exceptions(): 250s /usr/lib/python3.12/contextlib.py:158: in __exit__ 250s self.gen.throw(value) 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s 250s @contextlib.contextmanager 250s def map_httpcore_exceptions() -> typing.Iterator[None]: 250s try: 250s yield 250s except Exception as exc: 250s mapped_exc = None 250s 250s for from_exc, to_exc in HTTPCORE_EXC_MAP.items(): 250s if not isinstance(exc, from_exc): 250s continue 250s # We want to map to the most specific exception we can find. 250s # Eg if `exc` is an `httpcore.ReadTimeout`, we want to map to 250s # `httpx.ReadTimeout`, not just `httpx.TimeoutException`. 250s if mapped_exc is None or issubclass(to_exc, mapped_exc): 250s mapped_exc = to_exc 250s 250s if mapped_exc is None: # pragma: no cover 250s raise 250s 250s message = str(exc) 250s > raise mapped_exc(message) from exc 250s E httpx.ProxyError: 503 Service Unavailable 250s 250s /usr/lib/python3/dist-packages/httpx/_transports/default.py:86: ProxyError 250s _________ test_add_token_to_streaming_request[assert_token_in_uri-uri] _________ 250s 250s @contextlib.contextmanager 250s def map_httpcore_exceptions() -> typing.Iterator[None]: 250s try: 250s > yield 250s 250s /usr/lib/python3/dist-packages/httpx/_transports/default.py:69: 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s /usr/lib/python3/dist-packages/httpx/_transports/default.py:373: in handle_async_request 250s resp = await self._pool.handle_async_request(req) 250s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:216: in handle_async_request 250s raise exc from None 250s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:196: in handle_async_request 250s response = await connection.handle_async_request( 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s 250s self = 250s request = 250s 250s async def handle_async_request(self, request: Request) -> Response: 250s timeouts = request.extensions.get("timeout", {}) 250s timeout = timeouts.get("connect", None) 250s 250s async with self._connect_lock: 250s if not self._connected: 250s target = b"%b:%d" % (self._remote_origin.host, self._remote_origin.port) 250s 250s connect_url = URL( 250s scheme=self._proxy_origin.scheme, 250s host=self._proxy_origin.host, 250s port=self._proxy_origin.port, 250s target=target, 250s ) 250s connect_headers = merge_headers( 250s [(b"Host", target), (b"Accept", b"*/*")], self._proxy_headers 250s ) 250s connect_request = Request( 250s method=b"CONNECT", 250s url=connect_url, 250s headers=connect_headers, 250s extensions=request.extensions, 250s ) 250s connect_response = await self._connection.handle_async_request( 250s connect_request 250s ) 250s 250s if connect_response.status < 200 or connect_response.status > 299: 250s reason_bytes = connect_response.extensions.get("reason_phrase", b"") 250s reason_str = reason_bytes.decode("ascii", errors="ignore") 250s msg = "%d %s" % (connect_response.status, reason_str) 250s await self._connection.aclose() 250s > raise ProxyError(msg) 250s E httpcore.ProxyError: 503 Service Unavailable 250s 250s /usr/lib/python3/dist-packages/httpcore/_async/http_proxy.py:298: ProxyError 250s 250s The above exception was the direct cause of the following exception: 250s 250s assert_func = 250s token_placement = 'uri' 250s 250s @pytest.mark.asyncio 250s @pytest.mark.parametrize( 250s "assert_func, token_placement", 250s [ 250s (assert_token_in_header, "header"), 250s (assert_token_in_body, "body"), 250s (assert_token_in_uri, "uri") 250s ] 250s ) 250s async def test_add_token_to_streaming_request(assert_func, token_placement): 250s mock_response = AsyncMockDispatch({'a': 'a'}, assert_func=assert_func) 250s async with AsyncOAuth2Client( 250s 'foo', 250s token=default_token, 250s token_placement=token_placement, 250s app=mock_response 250s ) as client: 250s > async with client.stream("GET", 'https://i.b') as stream: 250s 250s tests/clients/test_httpx/test_async_oauth2_client.py:85: 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s /usr/lib/python3.12/contextlib.py:210: in __aenter__ 250s return await anext(self.gen) 250s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:103: in stream 250s async with super().stream( 250s /usr/lib/python3.12/contextlib.py:210: in __aenter__ 250s return await anext(self.gen) 250s /usr/lib/python3/dist-packages/httpx/_client.py:1617: in stream 250s response = await self.send( 250s /usr/lib/python3/dist-packages/httpx/_client.py:1661: in send 250s response = await self._send_handling_auth( 250s /usr/lib/python3/dist-packages/httpx/_client.py:1689: in _send_handling_auth 250s response = await self._send_handling_redirects( 250s /usr/lib/python3/dist-packages/httpx/_client.py:1726: in _send_handling_redirects 250s response = await self._send_single_request(request) 250s /usr/lib/python3/dist-packages/httpx/_client.py:1763: in _send_single_request 250s response = await transport.handle_async_request(request) 250s /usr/lib/python3/dist-packages/httpx/_transports/default.py:372: in handle_async_request 250s with map_httpcore_exceptions(): 250s /usr/lib/python3.12/contextlib.py:158: in __exit__ 250s self.gen.throw(value) 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s 250s @contextlib.contextmanager 250s def map_httpcore_exceptions() -> typing.Iterator[None]: 250s try: 250s yield 250s except Exception as exc: 250s mapped_exc = None 250s 250s for from_exc, to_exc in HTTPCORE_EXC_MAP.items(): 250s if not isinstance(exc, from_exc): 250s continue 250s # We want to map to the most specific exception we can find. 250s # Eg if `exc` is an `httpcore.ReadTimeout`, we want to map to 250s # `httpx.ReadTimeout`, not just `httpx.TimeoutException`. 250s if mapped_exc is None or issubclass(to_exc, mapped_exc): 250s mapped_exc = to_exc 250s 250s if mapped_exc is None: # pragma: no cover 250s raise 250s 250s message = str(exc) 250s > raise mapped_exc(message) from exc 250s E httpx.ProxyError: 503 Service Unavailable 250s 250s /usr/lib/python3/dist-packages/httpx/_transports/default.py:86: ProxyError 250s ____________________________ test_fetch_token_post _____________________________ 250s 250s @pytest.mark.asyncio 250s async def test_fetch_token_post(): 250s url = 'https://example.com/token' 250s 250s async def assert_func(request): 250s content = await request.body() 250s content = content.decode() 250s assert 'code=v' in content 250s assert 'client_id=' in content 250s assert 'grant_type=authorization_code' in content 250s 250s mock_response = AsyncMockDispatch(default_token, assert_func=assert_func) 250s async with AsyncOAuth2Client('foo', app=mock_response) as client: 250s > token = await client.fetch_token(url, authorization_response='https://i.b/?code=v') 250s 250s tests/clients/test_httpx/test_async_oauth2_client.py:156: 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:138: in _fetch_token 250s return self.parse_response_token(resp) 250s /usr/lib/python3/dist-packages/authlib/oauth2/client.py:342: in parse_response_token 250s token = resp.json() 250s /usr/lib/python3/dist-packages/httpx/_models.py:764: in json 250s return jsonlib.loads(self.content, **kwargs) 250s /usr/lib/python3.12/json/__init__.py:346: in loads 250s return _default_decoder.decode(s) 250s /usr/lib/python3.12/json/decoder.py:337: in decode 250s obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s 250s self = 250s s = '\n\n\t\t\n\t\n\n' 250s idx = 0 250s 250s def raw_decode(self, s, idx=0): 250s """Decode a JSON document from ``s`` (a ``str`` beginning with 250s a JSON document) and return a 2-tuple of the Python 250s representation and the index in ``s`` where the document ended. 250s 250s This can be used to decode a JSON document from a string that may 250s have extraneous data at the end. 250s 250s """ 250s try: 250s obj, end = self.scan_once(s, idx) 250s except StopIteration as err: 250s > raise JSONDecodeError("Expecting value", s, err.value) from None 250s E json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) 250s 250s /usr/lib/python3.12/json/decoder.py:355: JSONDecodeError 250s _____________________________ test_fetch_token_get _____________________________ 250s 250s @pytest.mark.asyncio 250s async def test_fetch_token_get(): 250s url = 'https://example.com/token' 250s 250s async def assert_func(request): 250s url = str(request.url) 250s assert 'code=v' in url 250s assert 'client_id=' in url 250s assert 'grant_type=authorization_code' in url 250s 250s mock_response = AsyncMockDispatch(default_token, assert_func=assert_func) 250s async with AsyncOAuth2Client('foo', app=mock_response) as client: 250s authorization_response = 'https://i.b/?code=v' 250s > token = await client.fetch_token( 250s url, authorization_response=authorization_response, method='GET') 250s 250s tests/clients/test_httpx/test_async_oauth2_client.py:186: 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:138: in _fetch_token 250s return self.parse_response_token(resp) 250s /usr/lib/python3/dist-packages/authlib/oauth2/client.py:342: in parse_response_token 250s token = resp.json() 250s /usr/lib/python3/dist-packages/httpx/_models.py:764: in json 250s return jsonlib.loads(self.content, **kwargs) 250s /usr/lib/python3.12/json/__init__.py:346: in loads 250s return _default_decoder.decode(s) 250s /usr/lib/python3.12/json/decoder.py:337: in decode 250s obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s 250s self = 250s s = '\n\n\n Example Domain\n\n \n \n

More information...

\n\n\n\n' 250s idx = 0 250s 250s def raw_decode(self, s, idx=0): 250s """Decode a JSON document from ``s`` (a ``str`` beginning with 250s a JSON document) and return a 2-tuple of the Python 250s representation and the index in ``s`` where the document ended. 250s 250s This can be used to decode a JSON document from a string that may 250s have extraneous data at the end. 250s 250s """ 250s try: 250s obj, end = self.scan_once(s, idx) 250s except StopIteration as err: 250s > raise JSONDecodeError("Expecting value", s, err.value) from None 250s E json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) 250s 250s /usr/lib/python3.12/json/decoder.py:355: JSONDecodeError 250s __________________ test_token_auth_method_client_secret_post ___________________ 250s 250s @pytest.mark.asyncio 250s async def test_token_auth_method_client_secret_post(): 250s url = 'https://example.com/token' 250s 250s async def assert_func(request): 250s content = await request.body() 250s content = content.decode() 250s assert 'code=v' in content 250s assert 'client_id=' in content 250s assert 'client_secret=bar' in content 250s assert 'grant_type=authorization_code' in content 250s 250s mock_response = AsyncMockDispatch(default_token, assert_func=assert_func) 250s async with AsyncOAuth2Client( 250s 'foo', 'bar', 250s token_endpoint_auth_method='client_secret_post', 250s app=mock_response 250s ) as client: 250s > token = await client.fetch_token(url, code='v') 250s 250s tests/clients/test_httpx/test_async_oauth2_client.py:220: 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:138: in _fetch_token 250s return self.parse_response_token(resp) 250s /usr/lib/python3/dist-packages/authlib/oauth2/client.py:342: in parse_response_token 250s token = resp.json() 250s /usr/lib/python3/dist-packages/httpx/_models.py:764: in json 250s return jsonlib.loads(self.content, **kwargs) 250s /usr/lib/python3.12/json/__init__.py:346: in loads 250s return _default_decoder.decode(s) 250s /usr/lib/python3.12/json/decoder.py:337: in decode 250s obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s 250s self = 250s s = '\n\n\t\t\n\t\n\n' 250s idx = 0 250s 250s def raw_decode(self, s, idx=0): 250s """Decode a JSON document from ``s`` (a ``str`` beginning with 250s a JSON document) and return a 2-tuple of the Python 250s representation and the index in ``s`` where the document ended. 250s 250s This can be used to decode a JSON document from a string that may 250s have extraneous data at the end. 250s 250s """ 250s try: 250s obj, end = self.scan_once(s, idx) 250s except StopIteration as err: 250s > raise JSONDecodeError("Expecting value", s, err.value) from None 250s E json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) 250s 250s /usr/lib/python3.12/json/decoder.py:355: JSONDecodeError 250s _______________________ test_access_token_response_hook ________________________ 250s 250s @pytest.mark.asyncio 250s async def test_access_token_response_hook(): 250s url = 'https://example.com/token' 250s 250s def _access_token_response_hook(resp): 250s assert resp.json() == default_token 250s return resp 250s 250s access_token_response_hook = mock.Mock(side_effect=_access_token_response_hook) 250s app = AsyncMockDispatch(default_token) 250s async with AsyncOAuth2Client('foo', token=default_token, app=app) as sess: 250s sess.register_compliance_hook( 250s 'access_token_response', 250s access_token_response_hook 250s ) 250s > assert await sess.fetch_token(url) == default_token 250s 250s tests/clients/test_httpx/test_async_oauth2_client.py:240: 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:136: in _fetch_token 250s resp = hook(resp) 250s /usr/lib/python3.12/unittest/mock.py:1134: in __call__ 250s return self._mock_call(*args, **kwargs) 250s /usr/lib/python3.12/unittest/mock.py:1138: in _mock_call 250s return self._execute_mock_call(*args, **kwargs) 250s /usr/lib/python3.12/unittest/mock.py:1199: in _execute_mock_call 250s result = effect(*args, **kwargs) 250s tests/clients/test_httpx/test_async_oauth2_client.py:230: in _access_token_response_hook 250s assert resp.json() == default_token 250s /usr/lib/python3/dist-packages/httpx/_models.py:764: in json 250s return jsonlib.loads(self.content, **kwargs) 250s /usr/lib/python3.12/json/__init__.py:346: in loads 250s return _default_decoder.decode(s) 250s /usr/lib/python3.12/json/decoder.py:337: in decode 250s obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s 250s self = 250s s = '\n\n\t\t\n\t\n\n' 250s idx = 0 250s 250s def raw_decode(self, s, idx=0): 250s """Decode a JSON document from ``s`` (a ``str`` beginning with 250s a JSON document) and return a 2-tuple of the Python 250s representation and the index in ``s`` where the document ended. 250s 250s This can be used to decode a JSON document from a string that may 250s have extraneous data at the end. 250s 250s """ 250s try: 250s obj, end = self.scan_once(s, idx) 250s except StopIteration as err: 250s > raise JSONDecodeError("Expecting value", s, err.value) from None 250s E json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) 250s 250s /usr/lib/python3.12/json/decoder.py:355: JSONDecodeError 250s ___________________________ test_password_grant_type ___________________________ 250s 250s @pytest.mark.asyncio 250s async def test_password_grant_type(): 250s url = 'https://example.com/token' 250s 250s async def assert_func(request): 250s content = await request.body() 250s content = content.decode() 250s assert 'username=v' in content 250s assert 'scope=profile' in content 250s assert 'grant_type=password' in content 250s 250s app = AsyncMockDispatch(default_token, assert_func=assert_func) 250s async with AsyncOAuth2Client('foo', scope='profile', app=app) as sess: 250s > token = await sess.fetch_token(url, username='v', password='v') 250s 250s tests/clients/test_httpx/test_async_oauth2_client.py:257: 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:138: in _fetch_token 250s return self.parse_response_token(resp) 250s /usr/lib/python3/dist-packages/authlib/oauth2/client.py:342: in parse_response_token 250s token = resp.json() 250s /usr/lib/python3/dist-packages/httpx/_models.py:764: in json 250s return jsonlib.loads(self.content, **kwargs) 250s /usr/lib/python3.12/json/__init__.py:346: in loads 250s return _default_decoder.decode(s) 250s /usr/lib/python3.12/json/decoder.py:337: in decode 250s obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s 250s self = 250s s = '\n\n\t\t\n\t\n\n' 250s idx = 0 250s 250s def raw_decode(self, s, idx=0): 250s """Decode a JSON document from ``s`` (a ``str`` beginning with 250s a JSON document) and return a 2-tuple of the Python 250s representation and the index in ``s`` where the document ended. 250s 250s This can be used to decode a JSON document from a string that may 250s have extraneous data at the end. 250s 250s """ 250s try: 250s obj, end = self.scan_once(s, idx) 250s except StopIteration as err: 250s > raise JSONDecodeError("Expecting value", s, err.value) from None 250s E json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) 250s 250s /usr/lib/python3.12/json/decoder.py:355: JSONDecodeError 250s _________________________ test_client_credentials_type _________________________ 250s 250s @pytest.mark.asyncio 250s async def test_client_credentials_type(): 250s url = 'https://example.com/token' 250s 250s async def assert_func(request): 250s content = await request.body() 250s content = content.decode() 250s assert 'scope=profile' in content 250s assert 'grant_type=client_credentials' in content 250s 250s app = AsyncMockDispatch(default_token, assert_func=assert_func) 250s async with AsyncOAuth2Client('foo', scope='profile', app=app) as sess: 250s > token = await sess.fetch_token(url) 250s 250s tests/clients/test_httpx/test_async_oauth2_client.py:277: 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:138: in _fetch_token 250s return self.parse_response_token(resp) 250s /usr/lib/python3/dist-packages/authlib/oauth2/client.py:342: in parse_response_token 250s token = resp.json() 250s /usr/lib/python3/dist-packages/httpx/_models.py:764: in json 250s return jsonlib.loads(self.content, **kwargs) 250s /usr/lib/python3.12/json/__init__.py:346: in loads 250s return _default_decoder.decode(s) 250s /usr/lib/python3.12/json/decoder.py:337: in decode 250s obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s 250s self = 250s s = '\n\n\t\t\n\t\n\n' 250s idx = 0 250s 250s def raw_decode(self, s, idx=0): 250s """Decode a JSON document from ``s`` (a ``str`` beginning with 250s a JSON document) and return a 2-tuple of the Python 250s representation and the index in ``s`` where the document ended. 250s 250s This can be used to decode a JSON document from a string that may 250s have extraneous data at the end. 250s 250s """ 250s try: 250s obj, end = self.scan_once(s, idx) 250s except StopIteration as err: 250s > raise JSONDecodeError("Expecting value", s, err.value) from None 250s E json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) 250s 250s /usr/lib/python3.12/json/decoder.py:355: JSONDecodeError 250s ______________ test_cleans_previous_token_before_fetching_new_one ______________ 250s 250s @pytest.mark.asyncio 250s async def test_cleans_previous_token_before_fetching_new_one(): 250s now = int(time.time()) 250s new_token = deepcopy(default_token) 250s past = now - 7200 250s default_token['expires_at'] = past 250s new_token['expires_at'] = now + 3600 250s url = 'https://example.com/token' 250s 250s app = AsyncMockDispatch(new_token) 250s with mock.patch('time.time', lambda: now): 250s async with AsyncOAuth2Client('foo', token=default_token, app=app) as sess: 250s > assert await sess.fetch_token(url) == new_token 250s 250s tests/clients/test_httpx/test_async_oauth2_client.py:296: 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:138: in _fetch_token 250s return self.parse_response_token(resp) 250s /usr/lib/python3/dist-packages/authlib/oauth2/client.py:342: in parse_response_token 250s token = resp.json() 250s /usr/lib/python3/dist-packages/httpx/_models.py:764: in json 250s return jsonlib.loads(self.content, **kwargs) 250s /usr/lib/python3.12/json/__init__.py:346: in loads 250s return _default_decoder.decode(s) 250s /usr/lib/python3.12/json/decoder.py:337: in decode 250s obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s 250s self = 250s s = '\n\n\t\t\n\t\n\n' 250s idx = 0 250s 250s def raw_decode(self, s, idx=0): 250s """Decode a JSON document from ``s`` (a ``str`` beginning with 250s a JSON document) and return a 2-tuple of the Python 250s representation and the index in ``s`` where the document ended. 250s 250s This can be used to decode a JSON document from a string that may 250s have extraneous data at the end. 250s 250s """ 250s try: 250s obj, end = self.scan_once(s, idx) 250s except StopIteration as err: 250s > raise JSONDecodeError("Expecting value", s, err.value) from None 250s E json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) 250s 250s /usr/lib/python3.12/json/decoder.py:355: JSONDecodeError 250s ___________________________ test_auto_refresh_token ____________________________ 250s 250s @contextlib.contextmanager 250s def map_httpcore_exceptions() -> typing.Iterator[None]: 250s try: 250s > yield 250s 250s /usr/lib/python3/dist-packages/httpx/_transports/default.py:69: 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s /usr/lib/python3/dist-packages/httpx/_transports/default.py:373: in handle_async_request 250s resp = await self._pool.handle_async_request(req) 250s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:216: in handle_async_request 250s raise exc from None 250s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:196: in handle_async_request 250s response = await connection.handle_async_request( 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s 250s self = 250s request = 250s 250s async def handle_async_request(self, request: Request) -> Response: 250s timeouts = request.extensions.get("timeout", {}) 250s timeout = timeouts.get("connect", None) 250s 250s async with self._connect_lock: 250s if not self._connected: 250s target = b"%b:%d" % (self._remote_origin.host, self._remote_origin.port) 250s 250s connect_url = URL( 250s scheme=self._proxy_origin.scheme, 250s host=self._proxy_origin.host, 250s port=self._proxy_origin.port, 250s target=target, 250s ) 250s connect_headers = merge_headers( 250s [(b"Host", target), (b"Accept", b"*/*")], self._proxy_headers 250s ) 250s connect_request = Request( 250s method=b"CONNECT", 250s url=connect_url, 250s headers=connect_headers, 250s extensions=request.extensions, 250s ) 250s connect_response = await self._connection.handle_async_request( 250s connect_request 250s ) 250s 250s if connect_response.status < 200 or connect_response.status > 299: 250s reason_bytes = connect_response.extensions.get("reason_phrase", b"") 250s reason_str = reason_bytes.decode("ascii", errors="ignore") 250s msg = "%d %s" % (connect_response.status, reason_str) 250s await self._connection.aclose() 250s > raise ProxyError(msg) 250s E httpcore.ProxyError: 503 Service Unavailable 250s 250s /usr/lib/python3/dist-packages/httpcore/_async/http_proxy.py:298: ProxyError 250s 250s The above exception was the direct cause of the following exception: 250s 250s @pytest.mark.asyncio 250s async def test_auto_refresh_token(): 250s 250s async def _update_token(token, refresh_token=None, access_token=None): 250s assert refresh_token == 'b' 250s assert token == default_token 250s 250s update_token = mock.Mock(side_effect=_update_token) 250s 250s old_token = dict( 250s access_token='a', refresh_token='b', 250s token_type='bearer', expires_at=100 250s ) 250s 250s app = AsyncMockDispatch(default_token) 250s async with AsyncOAuth2Client( 250s 'foo', token=old_token, token_endpoint='https://i.b/token', 250s update_token=update_token, app=app 250s ) as sess: 250s > await sess.get('https://i.b/user') 250s 250s tests/clients/test_httpx/test_async_oauth2_client.py:324: 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s /usr/lib/python3/dist-packages/httpx/_client.py:1801: in get 250s return await self.request( 250s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:86: in request 250s await self.ensure_active_token(self.token) 250s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:113: in ensure_active_token 250s await self.refresh_token(url, refresh_token=refresh_token) 250s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:142: in _refresh_token 250s resp = await self.post( 250s /usr/lib/python3/dist-packages/httpx/_client.py:1892: in post 250s return await self.request( 250s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:90: in request 250s return await super().request( 250s /usr/lib/python3/dist-packages/httpx/_client.py:1574: in request 250s return await self.send(request, auth=auth, follow_redirects=follow_redirects) 250s /usr/lib/python3/dist-packages/httpx/_client.py:1661: in send 250s response = await self._send_handling_auth( 250s /usr/lib/python3/dist-packages/httpx/_client.py:1689: in _send_handling_auth 250s response = await self._send_handling_redirects( 250s /usr/lib/python3/dist-packages/httpx/_client.py:1726: in _send_handling_redirects 250s response = await self._send_single_request(request) 250s /usr/lib/python3/dist-packages/httpx/_client.py:1763: in _send_single_request 250s response = await transport.handle_async_request(request) 250s /usr/lib/python3/dist-packages/httpx/_transports/default.py:372: in handle_async_request 250s with map_httpcore_exceptions(): 250s /usr/lib/python3.12/contextlib.py:158: in __exit__ 250s self.gen.throw(value) 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s 250s @contextlib.contextmanager 250s def map_httpcore_exceptions() -> typing.Iterator[None]: 250s try: 250s yield 250s except Exception as exc: 250s mapped_exc = None 250s 250s for from_exc, to_exc in HTTPCORE_EXC_MAP.items(): 250s if not isinstance(exc, from_exc): 250s continue 250s # We want to map to the most specific exception we can find. 250s # Eg if `exc` is an `httpcore.ReadTimeout`, we want to map to 250s # `httpx.ReadTimeout`, not just `httpx.TimeoutException`. 250s if mapped_exc is None or issubclass(to_exc, mapped_exc): 250s mapped_exc = to_exc 250s 250s if mapped_exc is None: # pragma: no cover 250s raise 250s 250s message = str(exc) 250s > raise mapped_exc(message) from exc 250s E httpx.ProxyError: 503 Service Unavailable 250s 250s /usr/lib/python3/dist-packages/httpx/_transports/default.py:86: ProxyError 250s ___________________________ test_auto_refresh_token2 ___________________________ 250s 250s @contextlib.contextmanager 250s def map_httpcore_exceptions() -> typing.Iterator[None]: 250s try: 250s > yield 250s 250s /usr/lib/python3/dist-packages/httpx/_transports/default.py:69: 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s /usr/lib/python3/dist-packages/httpx/_transports/default.py:373: in handle_async_request 250s resp = await self._pool.handle_async_request(req) 250s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:216: in handle_async_request 250s raise exc from None 250s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:196: in handle_async_request 250s response = await connection.handle_async_request( 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s 250s self = 250s request = 250s 250s async def handle_async_request(self, request: Request) -> Response: 250s timeouts = request.extensions.get("timeout", {}) 250s timeout = timeouts.get("connect", None) 250s 250s async with self._connect_lock: 250s if not self._connected: 250s target = b"%b:%d" % (self._remote_origin.host, self._remote_origin.port) 250s 250s connect_url = URL( 250s scheme=self._proxy_origin.scheme, 250s host=self._proxy_origin.host, 250s port=self._proxy_origin.port, 250s target=target, 250s ) 250s connect_headers = merge_headers( 250s [(b"Host", target), (b"Accept", b"*/*")], self._proxy_headers 250s ) 250s connect_request = Request( 250s method=b"CONNECT", 250s url=connect_url, 250s headers=connect_headers, 250s extensions=request.extensions, 250s ) 250s connect_response = await self._connection.handle_async_request( 250s connect_request 250s ) 250s 250s if connect_response.status < 200 or connect_response.status > 299: 250s reason_bytes = connect_response.extensions.get("reason_phrase", b"") 250s reason_str = reason_bytes.decode("ascii", errors="ignore") 250s msg = "%d %s" % (connect_response.status, reason_str) 250s await self._connection.aclose() 250s > raise ProxyError(msg) 250s E httpcore.ProxyError: 503 Service Unavailable 250s 250s /usr/lib/python3/dist-packages/httpcore/_async/http_proxy.py:298: ProxyError 250s 250s The above exception was the direct cause of the following exception: 250s 250s @pytest.mark.asyncio 250s async def test_auto_refresh_token2(): 250s 250s async def _update_token(token, refresh_token=None, access_token=None): 250s assert access_token == 'a' 250s assert token == default_token 250s 250s update_token = mock.Mock(side_effect=_update_token) 250s 250s old_token = dict( 250s access_token='a', 250s token_type='bearer', 250s expires_at=100 250s ) 250s 250s app = AsyncMockDispatch(default_token) 250s 250s async with AsyncOAuth2Client( 250s 'foo', token=old_token, 250s token_endpoint='https://i.b/token', 250s grant_type='client_credentials', 250s app=app, 250s ) as client: 250s > await client.get('https://i.b/user') 250s 250s tests/clients/test_httpx/test_async_oauth2_client.py:363: 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s /usr/lib/python3/dist-packages/httpx/_client.py:1801: in get 250s return await self.request( 250s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:86: in request 250s await self.ensure_active_token(self.token) 250s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:116: in ensure_active_token 250s new_token = await self.fetch_token(url, grant_type='client_credentials') 250s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:125: in _fetch_token 250s resp = await self.post( 250s /usr/lib/python3/dist-packages/httpx/_client.py:1892: in post 250s return await self.request( 250s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:90: in request 250s return await super().request( 250s /usr/lib/python3/dist-packages/httpx/_client.py:1574: in request 250s return await self.send(request, auth=auth, follow_redirects=follow_redirects) 250s /usr/lib/python3/dist-packages/httpx/_client.py:1661: in send 250s response = await self._send_handling_auth( 250s /usr/lib/python3/dist-packages/httpx/_client.py:1689: in _send_handling_auth 250s response = await self._send_handling_redirects( 250s /usr/lib/python3/dist-packages/httpx/_client.py:1726: in _send_handling_redirects 250s response = await self._send_single_request(request) 250s /usr/lib/python3/dist-packages/httpx/_client.py:1763: in _send_single_request 250s response = await transport.handle_async_request(request) 250s /usr/lib/python3/dist-packages/httpx/_transports/default.py:372: in handle_async_request 250s with map_httpcore_exceptions(): 250s /usr/lib/python3.12/contextlib.py:158: in __exit__ 250s self.gen.throw(value) 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s 250s @contextlib.contextmanager 250s def map_httpcore_exceptions() -> typing.Iterator[None]: 250s try: 250s yield 250s except Exception as exc: 250s mapped_exc = None 250s 250s for from_exc, to_exc in HTTPCORE_EXC_MAP.items(): 250s if not isinstance(exc, from_exc): 250s continue 250s # We want to map to the most specific exception we can find. 250s # Eg if `exc` is an `httpcore.ReadTimeout`, we want to map to 250s # `httpx.ReadTimeout`, not just `httpx.TimeoutException`. 250s if mapped_exc is None or issubclass(to_exc, mapped_exc): 250s mapped_exc = to_exc 250s 250s if mapped_exc is None: # pragma: no cover 250s raise 250s 250s message = str(exc) 250s > raise mapped_exc(message) from exc 250s E httpx.ProxyError: 503 Service Unavailable 250s 250s /usr/lib/python3/dist-packages/httpx/_transports/default.py:86: ProxyError 250s ___________________________ test_auto_refresh_token3 ___________________________ 250s 250s @contextlib.contextmanager 250s def map_httpcore_exceptions() -> typing.Iterator[None]: 250s try: 250s > yield 250s 250s /usr/lib/python3/dist-packages/httpx/_transports/default.py:69: 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s /usr/lib/python3/dist-packages/httpx/_transports/default.py:373: in handle_async_request 250s resp = await self._pool.handle_async_request(req) 250s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:216: in handle_async_request 250s raise exc from None 250s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:196: in handle_async_request 250s response = await connection.handle_async_request( 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s 250s self = 250s request = 250s 250s async def handle_async_request(self, request: Request) -> Response: 250s timeouts = request.extensions.get("timeout", {}) 250s timeout = timeouts.get("connect", None) 250s 250s async with self._connect_lock: 250s if not self._connected: 250s target = b"%b:%d" % (self._remote_origin.host, self._remote_origin.port) 250s 250s connect_url = URL( 250s scheme=self._proxy_origin.scheme, 250s host=self._proxy_origin.host, 250s port=self._proxy_origin.port, 250s target=target, 250s ) 250s connect_headers = merge_headers( 250s [(b"Host", target), (b"Accept", b"*/*")], self._proxy_headers 250s ) 250s connect_request = Request( 250s method=b"CONNECT", 250s url=connect_url, 250s headers=connect_headers, 250s extensions=request.extensions, 250s ) 250s connect_response = await self._connection.handle_async_request( 250s connect_request 250s ) 250s 250s if connect_response.status < 200 or connect_response.status > 299: 250s reason_bytes = connect_response.extensions.get("reason_phrase", b"") 250s reason_str = reason_bytes.decode("ascii", errors="ignore") 250s msg = "%d %s" % (connect_response.status, reason_str) 250s await self._connection.aclose() 250s > raise ProxyError(msg) 250s E httpcore.ProxyError: 503 Service Unavailable 250s 250s /usr/lib/python3/dist-packages/httpcore/_async/http_proxy.py:298: ProxyError 250s 250s The above exception was the direct cause of the following exception: 250s 250s @pytest.mark.asyncio 250s async def test_auto_refresh_token3(): 250s async def _update_token(token, refresh_token=None, access_token=None): 250s assert access_token == 'a' 250s assert token == default_token 250s 250s update_token = mock.Mock(side_effect=_update_token) 250s 250s old_token = dict( 250s access_token='a', 250s token_type='bearer', 250s expires_at=100 250s ) 250s 250s app = AsyncMockDispatch(default_token) 250s 250s async with AsyncOAuth2Client( 250s 'foo', token=old_token, token_endpoint='https://i.b/token', 250s update_token=update_token, grant_type='client_credentials', 250s app=app, 250s ) as client: 250s > await client.post('https://i.b/user', json={'foo': 'bar'}) 250s 250s tests/clients/test_httpx/test_async_oauth2_client.py:396: 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s /usr/lib/python3/dist-packages/httpx/_client.py:1892: in post 250s return await self.request( 250s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:86: in request 250s await self.ensure_active_token(self.token) 250s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:116: in ensure_active_token 250s new_token = await self.fetch_token(url, grant_type='client_credentials') 250s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:125: in _fetch_token 250s resp = await self.post( 250s /usr/lib/python3/dist-packages/httpx/_client.py:1892: in post 250s return await self.request( 250s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:90: in request 250s return await super().request( 250s /usr/lib/python3/dist-packages/httpx/_client.py:1574: in request 250s return await self.send(request, auth=auth, follow_redirects=follow_redirects) 250s /usr/lib/python3/dist-packages/httpx/_client.py:1661: in send 250s response = await self._send_handling_auth( 250s /usr/lib/python3/dist-packages/httpx/_client.py:1689: in _send_handling_auth 250s response = await self._send_handling_redirects( 250s /usr/lib/python3/dist-packages/httpx/_client.py:1726: in _send_handling_redirects 250s response = await self._send_single_request(request) 250s /usr/lib/python3/dist-packages/httpx/_client.py:1763: in _send_single_request 250s response = await transport.handle_async_request(request) 250s /usr/lib/python3/dist-packages/httpx/_transports/default.py:372: in handle_async_request 250s with map_httpcore_exceptions(): 250s /usr/lib/python3.12/contextlib.py:158: in __exit__ 250s self.gen.throw(value) 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s 250s @contextlib.contextmanager 250s def map_httpcore_exceptions() -> typing.Iterator[None]: 250s try: 250s yield 250s except Exception as exc: 250s mapped_exc = None 250s 250s for from_exc, to_exc in HTTPCORE_EXC_MAP.items(): 250s if not isinstance(exc, from_exc): 250s continue 250s # We want to map to the most specific exception we can find. 250s # Eg if `exc` is an `httpcore.ReadTimeout`, we want to map to 250s # `httpx.ReadTimeout`, not just `httpx.TimeoutException`. 250s if mapped_exc is None or issubclass(to_exc, mapped_exc): 250s mapped_exc = to_exc 250s 250s if mapped_exc is None: # pragma: no cover 250s raise 250s 250s message = str(exc) 250s > raise mapped_exc(message) from exc 250s E httpx.ProxyError: 503 Service Unavailable 250s 250s /usr/lib/python3/dist-packages/httpx/_transports/default.py:86: ProxyError 250s ___________________________ test_auto_refresh_token4 ___________________________ 250s 250s @contextlib.contextmanager 250s def map_httpcore_exceptions() -> typing.Iterator[None]: 250s try: 250s > yield 250s 250s /usr/lib/python3/dist-packages/httpx/_transports/default.py:69: 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s /usr/lib/python3/dist-packages/httpx/_transports/default.py:373: in handle_async_request 250s resp = await self._pool.handle_async_request(req) 250s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:216: in handle_async_request 250s raise exc from None 250s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:196: in handle_async_request 250s response = await connection.handle_async_request( 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s 250s self = 250s request = 250s 250s async def handle_async_request(self, request: Request) -> Response: 250s timeouts = request.extensions.get("timeout", {}) 250s timeout = timeouts.get("connect", None) 250s 250s async with self._connect_lock: 250s if not self._connected: 250s target = b"%b:%d" % (self._remote_origin.host, self._remote_origin.port) 250s 250s connect_url = URL( 250s scheme=self._proxy_origin.scheme, 250s host=self._proxy_origin.host, 250s port=self._proxy_origin.port, 250s target=target, 250s ) 250s connect_headers = merge_headers( 250s [(b"Host", target), (b"Accept", b"*/*")], self._proxy_headers 250s ) 250s connect_request = Request( 250s method=b"CONNECT", 250s url=connect_url, 250s headers=connect_headers, 250s extensions=request.extensions, 250s ) 250s connect_response = await self._connection.handle_async_request( 250s connect_request 250s ) 250s 250s if connect_response.status < 200 or connect_response.status > 299: 250s reason_bytes = connect_response.extensions.get("reason_phrase", b"") 250s reason_str = reason_bytes.decode("ascii", errors="ignore") 250s msg = "%d %s" % (connect_response.status, reason_str) 250s await self._connection.aclose() 250s > raise ProxyError(msg) 250s E httpcore.ProxyError: 503 Service Unavailable 250s 250s /usr/lib/python3/dist-packages/httpcore/_async/http_proxy.py:298: ProxyError 250s 250s The above exception was the direct cause of the following exception: 250s 250s @pytest.mark.asyncio 250s async def test_auto_refresh_token4(): 250s async def _update_token(token, refresh_token=None, access_token=None): 250s # This test only makes sense if the expired token is refreshed 250s token["expires_at"] = int(time.time()) + 3600 250s # artificial sleep to force other coroutines to wake 250s await asyncio.sleep(0.1) 250s 250s update_token = mock.Mock(side_effect=_update_token) 250s 250s old_token = dict( 250s access_token='old', 250s token_type='bearer', 250s expires_at=100 250s ) 250s 250s app = AsyncMockDispatch(default_token) 250s 250s async with AsyncOAuth2Client( 250s 'foo', token=old_token, token_endpoint='https://i.b/token', 250s update_token=update_token, grant_type='client_credentials', 250s app=app, 250s ) as client: 250s coroutines = [client.get('https://i.b/user') for x in range(10)] 250s > await asyncio.gather(*coroutines) 250s 250s tests/clients/test_httpx/test_async_oauth2_client.py:423: 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s /usr/lib/python3/dist-packages/httpx/_client.py:1801: in get 250s return await self.request( 250s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:86: in request 250s await self.ensure_active_token(self.token) 250s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:116: in ensure_active_token 250s new_token = await self.fetch_token(url, grant_type='client_credentials') 250s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:125: in _fetch_token 250s resp = await self.post( 250s /usr/lib/python3/dist-packages/httpx/_client.py:1892: in post 250s return await self.request( 250s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:90: in request 250s return await super().request( 250s /usr/lib/python3/dist-packages/httpx/_client.py:1574: in request 250s return await self.send(request, auth=auth, follow_redirects=follow_redirects) 250s /usr/lib/python3/dist-packages/httpx/_client.py:1661: in send 250s response = await self._send_handling_auth( 250s /usr/lib/python3/dist-packages/httpx/_client.py:1689: in _send_handling_auth 250s response = await self._send_handling_redirects( 250s /usr/lib/python3/dist-packages/httpx/_client.py:1726: in _send_handling_redirects 250s response = await self._send_single_request(request) 250s /usr/lib/python3/dist-packages/httpx/_client.py:1763: in _send_single_request 250s response = await transport.handle_async_request(request) 250s /usr/lib/python3/dist-packages/httpx/_transports/default.py:372: in handle_async_request 250s with map_httpcore_exceptions(): 250s /usr/lib/python3.12/contextlib.py:158: in __exit__ 250s self.gen.throw(value) 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s 250s @contextlib.contextmanager 250s def map_httpcore_exceptions() -> typing.Iterator[None]: 250s try: 250s yield 250s except Exception as exc: 250s mapped_exc = None 250s 250s for from_exc, to_exc in HTTPCORE_EXC_MAP.items(): 250s if not isinstance(exc, from_exc): 250s continue 250s # We want to map to the most specific exception we can find. 250s # Eg if `exc` is an `httpcore.ReadTimeout`, we want to map to 250s # `httpx.ReadTimeout`, not just `httpx.TimeoutException`. 250s if mapped_exc is None or issubclass(to_exc, mapped_exc): 250s mapped_exc = to_exc 250s 250s if mapped_exc is None: # pragma: no cover 250s raise 250s 250s message = str(exc) 250s > raise mapped_exc(message) from exc 250s E httpx.ProxyError: 503 Service Unavailable 250s 250s /usr/lib/python3/dist-packages/httpx/_transports/default.py:86: ProxyError 250s ______________________________ test_revoke_token _______________________________ 250s 250s @contextlib.contextmanager 250s def map_httpcore_exceptions() -> typing.Iterator[None]: 250s try: 250s > yield 250s 250s /usr/lib/python3/dist-packages/httpx/_transports/default.py:69: 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s /usr/lib/python3/dist-packages/httpx/_transports/default.py:373: in handle_async_request 250s resp = await self._pool.handle_async_request(req) 250s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:216: in handle_async_request 250s raise exc from None 250s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:196: in handle_async_request 250s response = await connection.handle_async_request( 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s 250s self = 250s request = 250s 250s async def handle_async_request(self, request: Request) -> Response: 250s timeouts = request.extensions.get("timeout", {}) 250s timeout = timeouts.get("connect", None) 250s 250s async with self._connect_lock: 250s if not self._connected: 250s target = b"%b:%d" % (self._remote_origin.host, self._remote_origin.port) 250s 250s connect_url = URL( 250s scheme=self._proxy_origin.scheme, 250s host=self._proxy_origin.host, 250s port=self._proxy_origin.port, 250s target=target, 250s ) 250s connect_headers = merge_headers( 250s [(b"Host", target), (b"Accept", b"*/*")], self._proxy_headers 250s ) 250s connect_request = Request( 250s method=b"CONNECT", 250s url=connect_url, 250s headers=connect_headers, 250s extensions=request.extensions, 250s ) 250s connect_response = await self._connection.handle_async_request( 250s connect_request 250s ) 250s 250s if connect_response.status < 200 or connect_response.status > 299: 250s reason_bytes = connect_response.extensions.get("reason_phrase", b"") 250s reason_str = reason_bytes.decode("ascii", errors="ignore") 250s msg = "%d %s" % (connect_response.status, reason_str) 250s await self._connection.aclose() 250s > raise ProxyError(msg) 250s E httpcore.ProxyError: 503 Service Unavailable 250s 250s /usr/lib/python3/dist-packages/httpcore/_async/http_proxy.py:298: ProxyError 250s 250s The above exception was the direct cause of the following exception: 250s 250s @pytest.mark.asyncio 250s async def test_revoke_token(): 250s answer = {'status': 'ok'} 250s app = AsyncMockDispatch(answer) 250s 250s async with AsyncOAuth2Client('a', app=app) as sess: 250s > resp = await sess.revoke_token('https://i.b/token', 'hi') 250s 250s tests/clients/test_httpx/test_async_oauth2_client.py:432: 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s /usr/lib/python3/dist-packages/httpx/_client.py:1892: in post 250s return await self.request( 250s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:90: in request 250s return await super().request( 250s /usr/lib/python3/dist-packages/httpx/_client.py:1574: in request 250s return await self.send(request, auth=auth, follow_redirects=follow_redirects) 250s /usr/lib/python3/dist-packages/httpx/_client.py:1661: in send 250s response = await self._send_handling_auth( 250s /usr/lib/python3/dist-packages/httpx/_client.py:1689: in _send_handling_auth 250s response = await self._send_handling_redirects( 250s /usr/lib/python3/dist-packages/httpx/_client.py:1726: in _send_handling_redirects 250s response = await self._send_single_request(request) 250s /usr/lib/python3/dist-packages/httpx/_client.py:1763: in _send_single_request 250s response = await transport.handle_async_request(request) 250s /usr/lib/python3/dist-packages/httpx/_transports/default.py:372: in handle_async_request 250s with map_httpcore_exceptions(): 250s /usr/lib/python3.12/contextlib.py:158: in __exit__ 250s self.gen.throw(value) 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s 250s @contextlib.contextmanager 250s def map_httpcore_exceptions() -> typing.Iterator[None]: 250s try: 250s yield 250s except Exception as exc: 250s mapped_exc = None 250s 250s for from_exc, to_exc in HTTPCORE_EXC_MAP.items(): 250s if not isinstance(exc, from_exc): 250s continue 250s # We want to map to the most specific exception we can find. 250s # Eg if `exc` is an `httpcore.ReadTimeout`, we want to map to 250s # `httpx.ReadTimeout`, not just `httpx.TimeoutException`. 250s if mapped_exc is None or issubclass(to_exc, mapped_exc): 250s mapped_exc = to_exc 250s 250s if mapped_exc is None: # pragma: no cover 250s raise 250s 250s message = str(exc) 250s > raise mapped_exc(message) from exc 250s E httpx.ProxyError: 503 Service Unavailable 250s 250s /usr/lib/python3/dist-packages/httpx/_transports/default.py:86: ProxyError 250s ____________________________ test_oauth1_authorize _____________________________ 250s 250s @contextlib.contextmanager 250s def map_httpcore_exceptions() -> typing.Iterator[None]: 250s try: 250s > yield 250s 250s /usr/lib/python3/dist-packages/httpx/_transports/default.py:69: 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s /usr/lib/python3/dist-packages/httpx/_transports/default.py:373: in handle_async_request 250s resp = await self._pool.handle_async_request(req) 250s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:216: in handle_async_request 250s raise exc from None 250s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:196: in handle_async_request 250s response = await connection.handle_async_request( 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s 250s self = 250s request = 250s 250s async def handle_async_request(self, request: Request) -> Response: 250s timeouts = request.extensions.get("timeout", {}) 250s timeout = timeouts.get("connect", None) 250s 250s async with self._connect_lock: 250s if not self._connected: 250s target = b"%b:%d" % (self._remote_origin.host, self._remote_origin.port) 250s 250s connect_url = URL( 250s scheme=self._proxy_origin.scheme, 250s host=self._proxy_origin.host, 250s port=self._proxy_origin.port, 250s target=target, 250s ) 250s connect_headers = merge_headers( 250s [(b"Host", target), (b"Accept", b"*/*")], self._proxy_headers 250s ) 250s connect_request = Request( 250s method=b"CONNECT", 250s url=connect_url, 250s headers=connect_headers, 250s extensions=request.extensions, 250s ) 250s connect_response = await self._connection.handle_async_request( 250s connect_request 250s ) 250s 250s if connect_response.status < 200 or connect_response.status > 299: 250s reason_bytes = connect_response.extensions.get("reason_phrase", b"") 250s reason_str = reason_bytes.decode("ascii", errors="ignore") 250s msg = "%d %s" % (connect_response.status, reason_str) 250s await self._connection.aclose() 250s > raise ProxyError(msg) 250s E httpcore.ProxyError: 503 Service Unavailable 250s 250s /usr/lib/python3/dist-packages/httpcore/_async/http_proxy.py:298: ProxyError 250s 250s The above exception was the direct cause of the following exception: 250s 250s @pytest.mark.asyncio 250s async def test_oauth1_authorize(): 250s oauth = OAuth() 250s app = AsyncPathMapDispatch({ 250s '/request-token': {'body': 'oauth_token=foo&oauth_verifier=baz'}, 250s '/token': {'body': 'oauth_token=a&oauth_token_secret=b'}, 250s }) 250s client = oauth.register( 250s 'dev', 250s client_id='dev', 250s client_secret='dev', 250s request_token_url='https://i.b/request-token', 250s api_base_url='https://i.b/api', 250s access_token_url='https://i.b/token', 250s authorize_url='https://i.b/authorize', 250s client_kwargs={ 250s 'app': app, 250s } 250s ) 250s 250s req_scope = {'type': 'http', 'session': {}} 250s req = Request(req_scope) 250s > resp = await client.authorize_redirect(req, 'https://b.com/bar') 250s 250s tests/clients/test_starlette/test_oauth_client.py:62: 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s /usr/lib/python3/dist-packages/authlib/integrations/starlette_client/apps.py:34: in authorize_redirect 250s rv = await self.create_authorization_url(redirect_uri, **kwargs) 250s /usr/lib/python3/dist-packages/authlib/integrations/base_client/async_app.py:38: in create_authorization_url 250s request_token = await client.fetch_request_token(self.request_token_url, **params) 250s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth1_client.py:68: in _fetch_token 250s resp = await self.post(url, **kwargs) 250s /usr/lib/python3/dist-packages/httpx/_client.py:1892: in post 250s return await self.request( 250s /usr/lib/python3/dist-packages/httpx/_client.py:1574: in request 250s return await self.send(request, auth=auth, follow_redirects=follow_redirects) 250s /usr/lib/python3/dist-packages/httpx/_client.py:1661: in send 250s response = await self._send_handling_auth( 250s /usr/lib/python3/dist-packages/httpx/_client.py:1689: in _send_handling_auth 250s response = await self._send_handling_redirects( 250s /usr/lib/python3/dist-packages/httpx/_client.py:1726: in _send_handling_redirects 250s response = await self._send_single_request(request) 250s /usr/lib/python3/dist-packages/httpx/_client.py:1763: in _send_single_request 250s response = await transport.handle_async_request(request) 250s /usr/lib/python3/dist-packages/httpx/_transports/default.py:372: in handle_async_request 250s with map_httpcore_exceptions(): 250s /usr/lib/python3.12/contextlib.py:158: in __exit__ 250s self.gen.throw(value) 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s 250s @contextlib.contextmanager 250s def map_httpcore_exceptions() -> typing.Iterator[None]: 250s try: 250s yield 250s except Exception as exc: 250s mapped_exc = None 250s 250s for from_exc, to_exc in HTTPCORE_EXC_MAP.items(): 250s if not isinstance(exc, from_exc): 250s continue 250s # We want to map to the most specific exception we can find. 250s # Eg if `exc` is an `httpcore.ReadTimeout`, we want to map to 250s # `httpx.ReadTimeout`, not just `httpx.TimeoutException`. 250s if mapped_exc is None or issubclass(to_exc, mapped_exc): 250s mapped_exc = to_exc 250s 250s if mapped_exc is None: # pragma: no cover 250s raise 250s 250s message = str(exc) 250s > raise mapped_exc(message) from exc 250s E httpx.ProxyError: 503 Service Unavailable 250s 250s /usr/lib/python3/dist-packages/httpx/_transports/default.py:86: ProxyError 250s ____________________________ test_oauth2_authorize _____________________________ 250s 250s @contextlib.contextmanager 250s def map_httpcore_exceptions() -> typing.Iterator[None]: 250s try: 250s > yield 250s 250s /usr/lib/python3/dist-packages/httpx/_transports/default.py:69: 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s /usr/lib/python3/dist-packages/httpx/_transports/default.py:373: in handle_async_request 250s resp = await self._pool.handle_async_request(req) 250s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:216: in handle_async_request 250s raise exc from None 250s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:196: in handle_async_request 250s response = await connection.handle_async_request( 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s 250s self = 250s request = 250s 250s async def handle_async_request(self, request: Request) -> Response: 250s timeouts = request.extensions.get("timeout", {}) 250s timeout = timeouts.get("connect", None) 250s 250s async with self._connect_lock: 250s if not self._connected: 250s target = b"%b:%d" % (self._remote_origin.host, self._remote_origin.port) 250s 250s connect_url = URL( 250s scheme=self._proxy_origin.scheme, 250s host=self._proxy_origin.host, 250s port=self._proxy_origin.port, 250s target=target, 250s ) 250s connect_headers = merge_headers( 250s [(b"Host", target), (b"Accept", b"*/*")], self._proxy_headers 250s ) 250s connect_request = Request( 250s method=b"CONNECT", 250s url=connect_url, 250s headers=connect_headers, 250s extensions=request.extensions, 250s ) 250s connect_response = await self._connection.handle_async_request( 250s connect_request 250s ) 250s 250s if connect_response.status < 200 or connect_response.status > 299: 250s reason_bytes = connect_response.extensions.get("reason_phrase", b"") 250s reason_str = reason_bytes.decode("ascii", errors="ignore") 250s msg = "%d %s" % (connect_response.status, reason_str) 250s await self._connection.aclose() 250s > raise ProxyError(msg) 250s E httpcore.ProxyError: 503 Service Unavailable 250s 250s /usr/lib/python3/dist-packages/httpcore/_async/http_proxy.py:298: ProxyError 250s 250s The above exception was the direct cause of the following exception: 250s 250s @pytest.mark.asyncio 250s async def test_oauth2_authorize(): 250s oauth = OAuth() 250s app = AsyncPathMapDispatch({ 250s '/token': {'body': get_bearer_token()} 250s }) 250s client = oauth.register( 250s 'dev', 250s client_id='dev', 250s client_secret='dev', 250s api_base_url='https://i.b/api', 250s access_token_url='https://i.b/token', 250s authorize_url='https://i.b/authorize', 250s client_kwargs={ 250s 'app': app, 250s } 250s ) 250s 250s req_scope = {'type': 'http', 'session': {}} 250s req = Request(req_scope) 250s resp = await client.authorize_redirect(req, 'https://b.com/bar') 250s assert resp.status_code == 302 250s url = resp.headers.get('Location') 250s assert 'state=' in url 250s state = dict(url_decode(urlparse.urlparse(url).query))['state'] 250s 250s assert f'_state_dev_{state}' in req.session 250s 250s req_scope.update( 250s { 250s 'path': '/', 250s 'query_string': f'code=a&state={state}', 250s 'session': req.session, 250s } 250s ) 250s req = Request(req_scope) 250s > token = await client.authorize_access_token(req) 250s 250s tests/clients/test_starlette/test_oauth_client.py:108: 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s /usr/lib/python3/dist-packages/authlib/integrations/starlette_client/apps.py:81: in authorize_access_token 250s token = await self.fetch_access_token(**params, **kwargs) 250s /usr/lib/python3/dist-packages/authlib/integrations/base_client/async_app.py:125: in fetch_access_token 250s token = await client.fetch_token(token_endpoint, **params) 250s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:125: in _fetch_token 250s resp = await self.post( 250s /usr/lib/python3/dist-packages/httpx/_client.py:1892: in post 250s return await self.request( 250s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:90: in request 250s return await super().request( 250s /usr/lib/python3/dist-packages/httpx/_client.py:1574: in request 250s return await self.send(request, auth=auth, follow_redirects=follow_redirects) 250s /usr/lib/python3/dist-packages/httpx/_client.py:1661: in send 250s response = await self._send_handling_auth( 250s /usr/lib/python3/dist-packages/httpx/_client.py:1689: in _send_handling_auth 250s response = await self._send_handling_redirects( 250s /usr/lib/python3/dist-packages/httpx/_client.py:1726: in _send_handling_redirects 250s response = await self._send_single_request(request) 250s /usr/lib/python3/dist-packages/httpx/_client.py:1763: in _send_single_request 250s response = await transport.handle_async_request(request) 250s /usr/lib/python3/dist-packages/httpx/_transports/default.py:372: in handle_async_request 250s with map_httpcore_exceptions(): 250s /usr/lib/python3.12/contextlib.py:158: in __exit__ 250s self.gen.throw(value) 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s 250s @contextlib.contextmanager 250s def map_httpcore_exceptions() -> typing.Iterator[None]: 250s try: 250s yield 250s except Exception as exc: 250s mapped_exc = None 250s 250s for from_exc, to_exc in HTTPCORE_EXC_MAP.items(): 250s if not isinstance(exc, from_exc): 250s continue 250s # We want to map to the most specific exception we can find. 250s # Eg if `exc` is an `httpcore.ReadTimeout`, we want to map to 250s # `httpx.ReadTimeout`, not just `httpx.TimeoutException`. 250s if mapped_exc is None or issubclass(to_exc, mapped_exc): 250s mapped_exc = to_exc 250s 250s if mapped_exc is None: # pragma: no cover 250s raise 250s 250s message = str(exc) 250s > raise mapped_exc(message) from exc 250s E httpx.ProxyError: 503 Service Unavailable 250s 250s /usr/lib/python3/dist-packages/httpx/_transports/default.py:86: ProxyError 250s _____________________ test_oauth2_authorize_code_challenge _____________________ 250s 250s @contextlib.contextmanager 250s def map_httpcore_exceptions() -> typing.Iterator[None]: 250s try: 250s > yield 250s 250s /usr/lib/python3/dist-packages/httpx/_transports/default.py:69: 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s /usr/lib/python3/dist-packages/httpx/_transports/default.py:373: in handle_async_request 250s resp = await self._pool.handle_async_request(req) 250s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:216: in handle_async_request 250s raise exc from None 250s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:196: in handle_async_request 250s response = await connection.handle_async_request( 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s 250s self = 250s request = 250s 250s async def handle_async_request(self, request: Request) -> Response: 250s timeouts = request.extensions.get("timeout", {}) 250s timeout = timeouts.get("connect", None) 250s 250s async with self._connect_lock: 250s if not self._connected: 250s target = b"%b:%d" % (self._remote_origin.host, self._remote_origin.port) 250s 250s connect_url = URL( 250s scheme=self._proxy_origin.scheme, 250s host=self._proxy_origin.host, 250s port=self._proxy_origin.port, 250s target=target, 250s ) 250s connect_headers = merge_headers( 250s [(b"Host", target), (b"Accept", b"*/*")], self._proxy_headers 250s ) 250s connect_request = Request( 250s method=b"CONNECT", 250s url=connect_url, 250s headers=connect_headers, 250s extensions=request.extensions, 250s ) 250s connect_response = await self._connection.handle_async_request( 250s connect_request 250s ) 250s 250s if connect_response.status < 200 or connect_response.status > 299: 250s reason_bytes = connect_response.extensions.get("reason_phrase", b"") 250s reason_str = reason_bytes.decode("ascii", errors="ignore") 250s msg = "%d %s" % (connect_response.status, reason_str) 250s await self._connection.aclose() 250s > raise ProxyError(msg) 250s E httpcore.ProxyError: 503 Service Unavailable 250s 250s /usr/lib/python3/dist-packages/httpcore/_async/http_proxy.py:298: ProxyError 250s 250s The above exception was the direct cause of the following exception: 250s 250s @pytest.mark.asyncio 250s async def test_oauth2_authorize_code_challenge(): 250s app = AsyncPathMapDispatch({ 250s '/token': {'body': get_bearer_token()} 250s }) 250s oauth = OAuth() 250s client = oauth.register( 250s 'dev', 250s client_id='dev', 250s api_base_url='https://i.b/api', 250s access_token_url='https://i.b/token', 250s authorize_url='https://i.b/authorize', 250s client_kwargs={ 250s 'code_challenge_method': 'S256', 250s 'app': app, 250s }, 250s ) 250s 250s req_scope = {'type': 'http', 'session': {}} 250s req = Request(req_scope) 250s 250s resp = await client.authorize_redirect(req, redirect_uri='https://b.com/bar') 250s assert resp.status_code == 302 250s 250s url = resp.headers.get('Location') 250s assert 'code_challenge=' in url 250s assert 'code_challenge_method=S256' in url 250s 250s state = dict(url_decode(urlparse.urlparse(url).query))['state'] 250s state_data = req.session[f'_state_dev_{state}']['data'] 250s 250s verifier = state_data['code_verifier'] 250s assert verifier is not None 250s 250s req_scope.update( 250s { 250s 'path': '/', 250s 'query_string': f'code=a&state={state}'.encode(), 250s 'session': req.session, 250s } 250s ) 250s req = Request(req_scope) 250s 250s > token = await client.authorize_access_token(req) 250s 250s tests/clients/test_starlette/test_oauth_client.py:183: 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s /usr/lib/python3/dist-packages/authlib/integrations/starlette_client/apps.py:81: in authorize_access_token 250s token = await self.fetch_access_token(**params, **kwargs) 250s /usr/lib/python3/dist-packages/authlib/integrations/base_client/async_app.py:125: in fetch_access_token 250s token = await client.fetch_token(token_endpoint, **params) 250s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:125: in _fetch_token 250s resp = await self.post( 250s /usr/lib/python3/dist-packages/httpx/_client.py:1892: in post 250s return await self.request( 250s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:90: in request 250s return await super().request( 250s /usr/lib/python3/dist-packages/httpx/_client.py:1574: in request 250s return await self.send(request, auth=auth, follow_redirects=follow_redirects) 250s /usr/lib/python3/dist-packages/httpx/_client.py:1661: in send 250s response = await self._send_handling_auth( 250s /usr/lib/python3/dist-packages/httpx/_client.py:1689: in _send_handling_auth 250s response = await self._send_handling_redirects( 250s /usr/lib/python3/dist-packages/httpx/_client.py:1726: in _send_handling_redirects 250s response = await self._send_single_request(request) 250s /usr/lib/python3/dist-packages/httpx/_client.py:1763: in _send_single_request 250s response = await transport.handle_async_request(request) 250s /usr/lib/python3/dist-packages/httpx/_transports/default.py:372: in handle_async_request 250s with map_httpcore_exceptions(): 250s /usr/lib/python3.12/contextlib.py:158: in __exit__ 250s self.gen.throw(value) 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s 250s @contextlib.contextmanager 250s def map_httpcore_exceptions() -> typing.Iterator[None]: 250s try: 250s yield 250s except Exception as exc: 250s mapped_exc = None 250s 250s for from_exc, to_exc in HTTPCORE_EXC_MAP.items(): 250s if not isinstance(exc, from_exc): 250s continue 250s # We want to map to the most specific exception we can find. 250s # Eg if `exc` is an `httpcore.ReadTimeout`, we want to map to 250s # `httpx.ReadTimeout`, not just `httpx.TimeoutException`. 250s if mapped_exc is None or issubclass(to_exc, mapped_exc): 250s mapped_exc = to_exc 250s 250s if mapped_exc is None: # pragma: no cover 250s raise 250s 250s message = str(exc) 250s > raise mapped_exc(message) from exc 250s E httpx.ProxyError: 503 Service Unavailable 250s 250s /usr/lib/python3/dist-packages/httpx/_transports/default.py:86: ProxyError 250s ______________________ test_with_fetch_token_in_register _______________________ 250s 250s @contextlib.contextmanager 250s def map_httpcore_exceptions() -> typing.Iterator[None]: 250s try: 250s > yield 250s 250s /usr/lib/python3/dist-packages/httpx/_transports/default.py:69: 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s /usr/lib/python3/dist-packages/httpx/_transports/default.py:373: in handle_async_request 250s resp = await self._pool.handle_async_request(req) 250s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:216: in handle_async_request 250s raise exc from None 250s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:196: in handle_async_request 250s response = await connection.handle_async_request( 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s 250s self = 250s request = 250s 250s async def handle_async_request(self, request: Request) -> Response: 250s timeouts = request.extensions.get("timeout", {}) 250s timeout = timeouts.get("connect", None) 250s 250s async with self._connect_lock: 250s if not self._connected: 250s target = b"%b:%d" % (self._remote_origin.host, self._remote_origin.port) 250s 250s connect_url = URL( 250s scheme=self._proxy_origin.scheme, 250s host=self._proxy_origin.host, 250s port=self._proxy_origin.port, 250s target=target, 250s ) 250s connect_headers = merge_headers( 250s [(b"Host", target), (b"Accept", b"*/*")], self._proxy_headers 250s ) 250s connect_request = Request( 250s method=b"CONNECT", 250s url=connect_url, 250s headers=connect_headers, 250s extensions=request.extensions, 250s ) 250s connect_response = await self._connection.handle_async_request( 250s connect_request 250s ) 250s 250s if connect_response.status < 200 or connect_response.status > 299: 250s reason_bytes = connect_response.extensions.get("reason_phrase", b"") 250s reason_str = reason_bytes.decode("ascii", errors="ignore") 250s msg = "%d %s" % (connect_response.status, reason_str) 250s await self._connection.aclose() 250s > raise ProxyError(msg) 250s E httpcore.ProxyError: 503 Service Unavailable 250s 250s /usr/lib/python3/dist-packages/httpcore/_async/http_proxy.py:298: ProxyError 250s 250s The above exception was the direct cause of the following exception: 250s 250s @pytest.mark.asyncio 250s async def test_with_fetch_token_in_register(): 250s async def fetch_token(request): 250s return {'access_token': 'dev', 'token_type': 'bearer'} 250s 250s app = AsyncPathMapDispatch({ 250s '/user': {'body': {'sub': '123'}} 250s }) 250s oauth = OAuth() 250s client = oauth.register( 250s 'dev', 250s client_id='dev', 250s client_secret='dev', 250s api_base_url='https://i.b/api', 250s access_token_url='https://i.b/token', 250s authorize_url='https://i.b/authorize', 250s fetch_token=fetch_token, 250s client_kwargs={ 250s 'app': app, 250s } 250s ) 250s 250s req_scope = {'type': 'http', 'session': {}} 250s req = Request(req_scope) 250s > resp = await client.get('/user', request=req) 250s 250s tests/clients/test_starlette/test_oauth_client.py:211: 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s /usr/lib/python3/dist-packages/authlib/integrations/base_client/async_app.py:86: in request 250s return await _http_request(self, session, method, url, token, kwargs) 250s /usr/lib/python3/dist-packages/authlib/integrations/base_client/async_app.py:144: in _http_request 250s return await session.request(method, url, **kwargs) 250s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:90: in request 250s return await super().request( 250s /usr/lib/python3/dist-packages/httpx/_client.py:1574: in request 250s return await self.send(request, auth=auth, follow_redirects=follow_redirects) 250s /usr/lib/python3/dist-packages/httpx/_client.py:1661: in send 250s response = await self._send_handling_auth( 250s /usr/lib/python3/dist-packages/httpx/_client.py:1689: in _send_handling_auth 250s response = await self._send_handling_redirects( 250s /usr/lib/python3/dist-packages/httpx/_client.py:1726: in _send_handling_redirects 250s response = await self._send_single_request(request) 250s /usr/lib/python3/dist-packages/httpx/_client.py:1763: in _send_single_request 250s response = await transport.handle_async_request(request) 250s /usr/lib/python3/dist-packages/httpx/_transports/default.py:372: in handle_async_request 250s with map_httpcore_exceptions(): 250s /usr/lib/python3.12/contextlib.py:158: in __exit__ 250s self.gen.throw(value) 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s 250s @contextlib.contextmanager 250s def map_httpcore_exceptions() -> typing.Iterator[None]: 250s try: 250s yield 250s except Exception as exc: 250s mapped_exc = None 250s 250s for from_exc, to_exc in HTTPCORE_EXC_MAP.items(): 250s if not isinstance(exc, from_exc): 250s continue 250s # We want to map to the most specific exception we can find. 250s # Eg if `exc` is an `httpcore.ReadTimeout`, we want to map to 250s # `httpx.ReadTimeout`, not just `httpx.TimeoutException`. 250s if mapped_exc is None or issubclass(to_exc, mapped_exc): 250s mapped_exc = to_exc 250s 250s if mapped_exc is None: # pragma: no cover 250s raise 250s 250s message = str(exc) 250s > raise mapped_exc(message) from exc 250s E httpx.ProxyError: 503 Service Unavailable 250s 250s /usr/lib/python3/dist-packages/httpx/_transports/default.py:86: ProxyError 250s ________________________ test_with_fetch_token_in_oauth ________________________ 250s 250s @contextlib.contextmanager 250s def map_httpcore_exceptions() -> typing.Iterator[None]: 250s try: 250s > yield 250s 250s /usr/lib/python3/dist-packages/httpx/_transports/default.py:69: 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s /usr/lib/python3/dist-packages/httpx/_transports/default.py:373: in handle_async_request 250s resp = await self._pool.handle_async_request(req) 250s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:216: in handle_async_request 250s raise exc from None 250s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:196: in handle_async_request 250s response = await connection.handle_async_request( 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s 250s self = 250s request = 250s 250s async def handle_async_request(self, request: Request) -> Response: 250s timeouts = request.extensions.get("timeout", {}) 250s timeout = timeouts.get("connect", None) 250s 250s async with self._connect_lock: 250s if not self._connected: 250s target = b"%b:%d" % (self._remote_origin.host, self._remote_origin.port) 250s 250s connect_url = URL( 250s scheme=self._proxy_origin.scheme, 250s host=self._proxy_origin.host, 250s port=self._proxy_origin.port, 250s target=target, 250s ) 250s connect_headers = merge_headers( 250s [(b"Host", target), (b"Accept", b"*/*")], self._proxy_headers 250s ) 250s connect_request = Request( 250s method=b"CONNECT", 250s url=connect_url, 250s headers=connect_headers, 250s extensions=request.extensions, 250s ) 250s connect_response = await self._connection.handle_async_request( 250s connect_request 250s ) 250s 250s if connect_response.status < 200 or connect_response.status > 299: 250s reason_bytes = connect_response.extensions.get("reason_phrase", b"") 250s reason_str = reason_bytes.decode("ascii", errors="ignore") 250s msg = "%d %s" % (connect_response.status, reason_str) 250s await self._connection.aclose() 250s > raise ProxyError(msg) 250s E httpcore.ProxyError: 503 Service Unavailable 250s 250s /usr/lib/python3/dist-packages/httpcore/_async/http_proxy.py:298: ProxyError 250s 250s The above exception was the direct cause of the following exception: 250s 250s @pytest.mark.asyncio 250s async def test_with_fetch_token_in_oauth(): 250s async def fetch_token(name, request): 250s return {'access_token': 'dev', 'token_type': 'bearer'} 250s 250s app = AsyncPathMapDispatch({ 250s '/user': {'body': {'sub': '123'}} 250s }) 250s oauth = OAuth(fetch_token=fetch_token) 250s client = oauth.register( 250s 'dev', 250s client_id='dev', 250s client_secret='dev', 250s api_base_url='https://i.b/api', 250s access_token_url='https://i.b/token', 250s authorize_url='https://i.b/authorize', 250s client_kwargs={ 250s 'app': app, 250s } 250s ) 250s 250s req_scope = {'type': 'http', 'session': {}} 250s req = Request(req_scope) 250s > resp = await client.get('/user', request=req) 250s 250s tests/clients/test_starlette/test_oauth_client.py:238: 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s /usr/lib/python3/dist-packages/authlib/integrations/base_client/async_app.py:86: in request 250s return await _http_request(self, session, method, url, token, kwargs) 250s /usr/lib/python3/dist-packages/authlib/integrations/base_client/async_app.py:144: in _http_request 250s return await session.request(method, url, **kwargs) 250s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:90: in request 250s return await super().request( 250s /usr/lib/python3/dist-packages/httpx/_client.py:1574: in request 250s return await self.send(request, auth=auth, follow_redirects=follow_redirects) 250s /usr/lib/python3/dist-packages/httpx/_client.py:1661: in send 250s response = await self._send_handling_auth( 250s /usr/lib/python3/dist-packages/httpx/_client.py:1689: in _send_handling_auth 250s response = await self._send_handling_redirects( 250s /usr/lib/python3/dist-packages/httpx/_client.py:1726: in _send_handling_redirects 250s response = await self._send_single_request(request) 250s /usr/lib/python3/dist-packages/httpx/_client.py:1763: in _send_single_request 250s response = await transport.handle_async_request(request) 250s /usr/lib/python3/dist-packages/httpx/_transports/default.py:372: in handle_async_request 250s with map_httpcore_exceptions(): 250s /usr/lib/python3.12/contextlib.py:158: in __exit__ 250s self.gen.throw(value) 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s 250s @contextlib.contextmanager 250s def map_httpcore_exceptions() -> typing.Iterator[None]: 250s try: 250s yield 250s except Exception as exc: 250s mapped_exc = None 250s 250s for from_exc, to_exc in HTTPCORE_EXC_MAP.items(): 250s if not isinstance(exc, from_exc): 250s continue 250s # We want to map to the most specific exception we can find. 250s # Eg if `exc` is an `httpcore.ReadTimeout`, we want to map to 250s # `httpx.ReadTimeout`, not just `httpx.TimeoutException`. 250s if mapped_exc is None or issubclass(to_exc, mapped_exc): 250s mapped_exc = to_exc 250s 250s if mapped_exc is None: # pragma: no cover 250s raise 250s 250s message = str(exc) 250s > raise mapped_exc(message) from exc 250s E httpx.ProxyError: 503 Service Unavailable 250s 250s /usr/lib/python3/dist-packages/httpx/_transports/default.py:86: ProxyError 250s _________________________ test_request_withhold_token __________________________ 250s 250s @contextlib.contextmanager 250s def map_httpcore_exceptions() -> typing.Iterator[None]: 250s try: 250s > yield 250s 250s /usr/lib/python3/dist-packages/httpx/_transports/default.py:69: 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s /usr/lib/python3/dist-packages/httpx/_transports/default.py:373: in handle_async_request 250s resp = await self._pool.handle_async_request(req) 250s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:216: in handle_async_request 250s raise exc from None 250s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:196: in handle_async_request 250s response = await connection.handle_async_request( 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s 250s self = 250s request = 250s 250s async def handle_async_request(self, request: Request) -> Response: 250s timeouts = request.extensions.get("timeout", {}) 250s timeout = timeouts.get("connect", None) 250s 250s async with self._connect_lock: 250s if not self._connected: 250s target = b"%b:%d" % (self._remote_origin.host, self._remote_origin.port) 250s 250s connect_url = URL( 250s scheme=self._proxy_origin.scheme, 250s host=self._proxy_origin.host, 250s port=self._proxy_origin.port, 250s target=target, 250s ) 250s connect_headers = merge_headers( 250s [(b"Host", target), (b"Accept", b"*/*")], self._proxy_headers 250s ) 250s connect_request = Request( 250s method=b"CONNECT", 250s url=connect_url, 250s headers=connect_headers, 250s extensions=request.extensions, 250s ) 250s connect_response = await self._connection.handle_async_request( 250s connect_request 250s ) 250s 250s if connect_response.status < 200 or connect_response.status > 299: 250s reason_bytes = connect_response.extensions.get("reason_phrase", b"") 250s reason_str = reason_bytes.decode("ascii", errors="ignore") 250s msg = "%d %s" % (connect_response.status, reason_str) 250s await self._connection.aclose() 250s > raise ProxyError(msg) 250s E httpcore.ProxyError: 503 Service Unavailable 250s 250s /usr/lib/python3/dist-packages/httpcore/_async/http_proxy.py:298: ProxyError 250s 250s The above exception was the direct cause of the following exception: 250s 250s @pytest.mark.asyncio 250s async def test_request_withhold_token(): 250s oauth = OAuth() 250s app = AsyncPathMapDispatch({ 250s '/user': {'body': {'sub': '123'}} 250s }) 250s client = oauth.register( 250s "dev", 250s client_id="dev", 250s client_secret="dev", 250s api_base_url="https://i.b/api", 250s access_token_url="https://i.b/token", 250s authorize_url="https://i.b/authorize", 250s client_kwargs={ 250s 'app': app, 250s } 250s ) 250s req_scope = {'type': 'http', 'session': {}} 250s req = Request(req_scope) 250s > resp = await client.get('/user', request=req, withhold_token=True) 250s 250s tests/clients/test_starlette/test_oauth_client.py:261: 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s /usr/lib/python3/dist-packages/authlib/integrations/base_client/async_app.py:86: in request 250s return await _http_request(self, session, method, url, token, kwargs) 250s /usr/lib/python3/dist-packages/authlib/integrations/base_client/async_app.py:136: in _http_request 250s return await session.request(method, url, **kwargs) 250s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:90: in request 250s return await super().request( 250s /usr/lib/python3/dist-packages/httpx/_client.py:1574: in request 250s return await self.send(request, auth=auth, follow_redirects=follow_redirects) 250s /usr/lib/python3/dist-packages/httpx/_client.py:1661: in send 250s response = await self._send_handling_auth( 250s /usr/lib/python3/dist-packages/httpx/_client.py:1689: in _send_handling_auth 250s response = await self._send_handling_redirects( 250s /usr/lib/python3/dist-packages/httpx/_client.py:1726: in _send_handling_redirects 250s response = await self._send_single_request(request) 250s /usr/lib/python3/dist-packages/httpx/_client.py:1763: in _send_single_request 250s response = await transport.handle_async_request(request) 250s /usr/lib/python3/dist-packages/httpx/_transports/default.py:372: in handle_async_request 250s with map_httpcore_exceptions(): 250s /usr/lib/python3.12/contextlib.py:158: in __exit__ 250s self.gen.throw(value) 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s 250s @contextlib.contextmanager 250s def map_httpcore_exceptions() -> typing.Iterator[None]: 250s try: 250s yield 250s except Exception as exc: 250s mapped_exc = None 250s 250s for from_exc, to_exc in HTTPCORE_EXC_MAP.items(): 250s if not isinstance(exc, from_exc): 250s continue 250s # We want to map to the most specific exception we can find. 250s # Eg if `exc` is an `httpcore.ReadTimeout`, we want to map to 250s # `httpx.ReadTimeout`, not just `httpx.TimeoutException`. 250s if mapped_exc is None or issubclass(to_exc, mapped_exc): 250s mapped_exc = to_exc 250s 250s if mapped_exc is None: # pragma: no cover 250s raise 250s 250s message = str(exc) 250s > raise mapped_exc(message) from exc 250s E httpx.ProxyError: 503 Service Unavailable 250s 250s /usr/lib/python3/dist-packages/httpx/_transports/default.py:86: ProxyError 250s _____________________ test_oauth2_authorize_with_metadata ______________________ 250s 250s @contextlib.contextmanager 250s def map_httpcore_exceptions() -> typing.Iterator[None]: 250s try: 250s > yield 250s 250s /usr/lib/python3/dist-packages/httpx/_transports/default.py:69: 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s /usr/lib/python3/dist-packages/httpx/_transports/default.py:373: in handle_async_request 250s resp = await self._pool.handle_async_request(req) 250s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:216: in handle_async_request 250s raise exc from None 250s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:196: in handle_async_request 250s response = await connection.handle_async_request( 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s 250s self = 250s request = 250s 250s async def handle_async_request(self, request: Request) -> Response: 250s timeouts = request.extensions.get("timeout", {}) 250s timeout = timeouts.get("connect", None) 250s 250s async with self._connect_lock: 250s if not self._connected: 250s target = b"%b:%d" % (self._remote_origin.host, self._remote_origin.port) 250s 250s connect_url = URL( 250s scheme=self._proxy_origin.scheme, 250s host=self._proxy_origin.host, 250s port=self._proxy_origin.port, 250s target=target, 250s ) 250s connect_headers = merge_headers( 250s [(b"Host", target), (b"Accept", b"*/*")], self._proxy_headers 250s ) 250s connect_request = Request( 250s method=b"CONNECT", 250s url=connect_url, 250s headers=connect_headers, 250s extensions=request.extensions, 250s ) 250s connect_response = await self._connection.handle_async_request( 250s connect_request 250s ) 250s 250s if connect_response.status < 200 or connect_response.status > 299: 250s reason_bytes = connect_response.extensions.get("reason_phrase", b"") 250s reason_str = reason_bytes.decode("ascii", errors="ignore") 250s msg = "%d %s" % (connect_response.status, reason_str) 250s await self._connection.aclose() 250s > raise ProxyError(msg) 250s E httpcore.ProxyError: 503 Service Unavailable 250s 250s /usr/lib/python3/dist-packages/httpcore/_async/http_proxy.py:298: ProxyError 250s 250s The above exception was the direct cause of the following exception: 250s 250s @pytest.mark.asyncio 250s async def test_oauth2_authorize_with_metadata(): 250s oauth = OAuth() 250s app = AsyncPathMapDispatch({ 250s '/.well-known/openid-configuration': {'body': { 250s 'authorization_endpoint': 'https://i.b/authorize' 250s }} 250s }) 250s client = oauth.register( 250s 'dev', 250s client_id='dev', 250s client_secret='dev', 250s api_base_url='https://i.b/api', 250s access_token_url='https://i.b/token', 250s server_metadata_url='https://i.b/.well-known/openid-configuration', 250s client_kwargs={ 250s 'app': app, 250s } 250s ) 250s req_scope = {'type': 'http', 'session': {}} 250s req = Request(req_scope) 250s > resp = await client.authorize_redirect(req, 'https://b.com/bar') 250s 250s tests/clients/test_starlette/test_oauth_client.py:302: 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s /usr/lib/python3/dist-packages/authlib/integrations/starlette_client/apps.py:34: in authorize_redirect 250s rv = await self.create_authorization_url(redirect_uri, **kwargs) 250s /usr/lib/python3/dist-packages/authlib/integrations/base_client/async_app.py:95: in create_authorization_url 250s metadata = await self.load_server_metadata() 250s /usr/lib/python3/dist-packages/authlib/integrations/base_client/async_app.py:76: in load_server_metadata 250s resp = await client.request('GET', self._server_metadata_url, withhold_token=True) 250s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:90: in request 250s return await super().request( 250s /usr/lib/python3/dist-packages/httpx/_client.py:1574: in request 250s return await self.send(request, auth=auth, follow_redirects=follow_redirects) 250s /usr/lib/python3/dist-packages/httpx/_client.py:1661: in send 250s response = await self._send_handling_auth( 250s /usr/lib/python3/dist-packages/httpx/_client.py:1689: in _send_handling_auth 250s response = await self._send_handling_redirects( 250s /usr/lib/python3/dist-packages/httpx/_client.py:1726: in _send_handling_redirects 250s response = await self._send_single_request(request) 250s /usr/lib/python3/dist-packages/httpx/_client.py:1763: in _send_single_request 250s response = await transport.handle_async_request(request) 250s /usr/lib/python3/dist-packages/httpx/_transports/default.py:372: in handle_async_request 250s with map_httpcore_exceptions(): 250s /usr/lib/python3.12/contextlib.py:158: in __exit__ 250s self.gen.throw(value) 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s 250s @contextlib.contextmanager 250s def map_httpcore_exceptions() -> typing.Iterator[None]: 250s try: 250s yield 250s except Exception as exc: 250s mapped_exc = None 250s 250s for from_exc, to_exc in HTTPCORE_EXC_MAP.items(): 250s if not isinstance(exc, from_exc): 250s continue 250s # We want to map to the most specific exception we can find. 250s # Eg if `exc` is an `httpcore.ReadTimeout`, we want to map to 250s # `httpx.ReadTimeout`, not just `httpx.TimeoutException`. 250s if mapped_exc is None or issubclass(to_exc, mapped_exc): 250s mapped_exc = to_exc 250s 250s if mapped_exc is None: # pragma: no cover 250s raise 250s 250s message = str(exc) 250s > raise mapped_exc(message) from exc 250s E httpx.ProxyError: 503 Service Unavailable 250s 250s /usr/lib/python3/dist-packages/httpx/_transports/default.py:86: ProxyError 250s _____________________________ test_fetch_userinfo ______________________________ 250s 250s @contextlib.contextmanager 250s def map_httpcore_exceptions() -> typing.Iterator[None]: 250s try: 250s > yield 250s 250s /usr/lib/python3/dist-packages/httpx/_transports/default.py:69: 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s /usr/lib/python3/dist-packages/httpx/_transports/default.py:373: in handle_async_request 250s resp = await self._pool.handle_async_request(req) 250s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:216: in handle_async_request 250s raise exc from None 250s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:196: in handle_async_request 250s response = await connection.handle_async_request( 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s 250s self = 250s request = 250s 250s async def handle_async_request(self, request: Request) -> Response: 250s timeouts = request.extensions.get("timeout", {}) 250s timeout = timeouts.get("connect", None) 250s 250s async with self._connect_lock: 250s if not self._connected: 250s target = b"%b:%d" % (self._remote_origin.host, self._remote_origin.port) 250s 250s connect_url = URL( 250s scheme=self._proxy_origin.scheme, 250s host=self._proxy_origin.host, 250s port=self._proxy_origin.port, 250s target=target, 250s ) 250s connect_headers = merge_headers( 250s [(b"Host", target), (b"Accept", b"*/*")], self._proxy_headers 250s ) 250s connect_request = Request( 250s method=b"CONNECT", 250s url=connect_url, 250s headers=connect_headers, 250s extensions=request.extensions, 250s ) 250s connect_response = await self._connection.handle_async_request( 250s connect_request 250s ) 250s 250s if connect_response.status < 200 or connect_response.status > 299: 250s reason_bytes = connect_response.extensions.get("reason_phrase", b"") 250s reason_str = reason_bytes.decode("ascii", errors="ignore") 250s msg = "%d %s" % (connect_response.status, reason_str) 250s await self._connection.aclose() 250s > raise ProxyError(msg) 250s E httpcore.ProxyError: 503 Service Unavailable 250s 250s /usr/lib/python3/dist-packages/httpcore/_async/http_proxy.py:298: ProxyError 250s 250s The above exception was the direct cause of the following exception: 250s 250s @pytest.mark.asyncio 250s async def test_fetch_userinfo(): 250s > await run_fetch_userinfo({'sub': '123'}) 250s 250s tests/clients/test_starlette/test_user_mixin.py:42: 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s tests/clients/test_starlette/test_user_mixin.py:36: in run_fetch_userinfo 250s user = await client.userinfo(request=req) 250s /usr/lib/python3/dist-packages/authlib/integrations/base_client/async_openid.py:29: in userinfo 250s resp = await self.get(metadata['userinfo_endpoint'], **kwargs) 250s /usr/lib/python3/dist-packages/authlib/integrations/base_client/async_app.py:86: in request 250s return await _http_request(self, session, method, url, token, kwargs) 250s /usr/lib/python3/dist-packages/authlib/integrations/base_client/async_app.py:144: in _http_request 250s return await session.request(method, url, **kwargs) 250s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:90: in request 250s return await super().request( 250s /usr/lib/python3/dist-packages/httpx/_client.py:1574: in request 250s return await self.send(request, auth=auth, follow_redirects=follow_redirects) 250s /usr/lib/python3/dist-packages/httpx/_client.py:1661: in send 250s response = await self._send_handling_auth( 250s /usr/lib/python3/dist-packages/httpx/_client.py:1689: in _send_handling_auth 250s response = await self._send_handling_redirects( 250s /usr/lib/python3/dist-packages/httpx/_client.py:1726: in _send_handling_redirects 250s response = await self._send_single_request(request) 250s /usr/lib/python3/dist-packages/httpx/_client.py:1763: in _send_single_request 250s response = await transport.handle_async_request(request) 250s /usr/lib/python3/dist-packages/httpx/_transports/default.py:372: in handle_async_request 250s with map_httpcore_exceptions(): 250s /usr/lib/python3.12/contextlib.py:158: in __exit__ 250s self.gen.throw(value) 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s 250s @contextlib.contextmanager 250s def map_httpcore_exceptions() -> typing.Iterator[None]: 250s try: 250s yield 250s except Exception as exc: 250s mapped_exc = None 250s 250s for from_exc, to_exc in HTTPCORE_EXC_MAP.items(): 250s if not isinstance(exc, from_exc): 250s continue 250s # We want to map to the most specific exception we can find. 250s # Eg if `exc` is an `httpcore.ReadTimeout`, we want to map to 250s # `httpx.ReadTimeout`, not just `httpx.TimeoutException`. 250s if mapped_exc is None or issubclass(to_exc, mapped_exc): 250s mapped_exc = to_exc 250s 250s if mapped_exc is None: # pragma: no cover 250s raise 250s 250s message = str(exc) 250s > raise mapped_exc(message) from exc 250s E httpx.ProxyError: 503 Service Unavailable 250s 250s /usr/lib/python3/dist-packages/httpx/_transports/default.py:86: ProxyError 250s __________________________ test_force_fetch_jwks_uri ___________________________ 250s 250s @contextlib.contextmanager 250s def map_httpcore_exceptions() -> typing.Iterator[None]: 250s try: 250s > yield 250s 250s /usr/lib/python3/dist-packages/httpx/_transports/default.py:69: 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s /usr/lib/python3/dist-packages/httpx/_transports/default.py:373: in handle_async_request 250s resp = await self._pool.handle_async_request(req) 250s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:216: in handle_async_request 250s raise exc from None 250s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:196: in handle_async_request 250s response = await connection.handle_async_request( 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s 250s self = 250s request = 250s 250s async def handle_async_request(self, request: Request) -> Response: 250s timeouts = request.extensions.get("timeout", {}) 250s timeout = timeouts.get("connect", None) 250s 250s async with self._connect_lock: 250s if not self._connected: 250s target = b"%b:%d" % (self._remote_origin.host, self._remote_origin.port) 250s 250s connect_url = URL( 250s scheme=self._proxy_origin.scheme, 250s host=self._proxy_origin.host, 250s port=self._proxy_origin.port, 250s target=target, 250s ) 250s connect_headers = merge_headers( 250s [(b"Host", target), (b"Accept", b"*/*")], self._proxy_headers 250s ) 250s connect_request = Request( 250s method=b"CONNECT", 250s url=connect_url, 250s headers=connect_headers, 250s extensions=request.extensions, 250s ) 250s connect_response = await self._connection.handle_async_request( 250s connect_request 250s ) 250s 250s if connect_response.status < 200 or connect_response.status > 299: 250s reason_bytes = connect_response.extensions.get("reason_phrase", b"") 250s reason_str = reason_bytes.decode("ascii", errors="ignore") 250s msg = "%d %s" % (connect_response.status, reason_str) 250s await self._connection.aclose() 250s > raise ProxyError(msg) 250s E httpcore.ProxyError: 503 Service Unavailable 250s 250s /usr/lib/python3/dist-packages/httpcore/_async/http_proxy.py:298: ProxyError 250s 250s The above exception was the direct cause of the following exception: 250s 250s @pytest.mark.asyncio 250s async def test_force_fetch_jwks_uri(): 250s secret_keys = read_key_file('jwks_private.json') 250s token = get_bearer_token() 250s id_token = generate_id_token( 250s token, {'sub': '123'}, secret_keys, 250s alg='RS256', iss='https://i.b', 250s aud='dev', exp=3600, nonce='n', 250s ) 250s token['id_token'] = id_token 250s 250s app = AsyncPathMapDispatch({ 250s '/jwks': {'body': read_key_file('jwks_public.json')} 250s }) 250s 250s oauth = OAuth() 250s client = oauth.register( 250s 'dev', 250s client_id='dev', 250s client_secret='dev', 250s fetch_token=get_bearer_token, 250s jwks_uri='https://i.b/jwks', 250s issuer='https://i.b', 250s client_kwargs={ 250s 'app': app, 250s } 250s ) 250s > user = await client.parse_id_token(token, nonce='n') 250s 250s tests/clients/test_starlette/test_user_mixin.py:129: 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s /usr/lib/python3/dist-packages/authlib/integrations/base_client/async_openid.py:56: in parse_id_token 250s jwk_set = await self.fetch_jwk_set() 250s /usr/lib/python3/dist-packages/authlib/integrations/base_client/async_openid.py:19: in fetch_jwk_set 250s resp = await client.request('GET', uri, withhold_token=True) 250s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:90: in request 250s return await super().request( 250s /usr/lib/python3/dist-packages/httpx/_client.py:1574: in request 250s return await self.send(request, auth=auth, follow_redirects=follow_redirects) 250s /usr/lib/python3/dist-packages/httpx/_client.py:1661: in send 250s response = await self._send_handling_auth( 250s /usr/lib/python3/dist-packages/httpx/_client.py:1689: in _send_handling_auth 250s response = await self._send_handling_redirects( 250s /usr/lib/python3/dist-packages/httpx/_client.py:1726: in _send_handling_redirects 250s response = await self._send_single_request(request) 250s /usr/lib/python3/dist-packages/httpx/_client.py:1763: in _send_single_request 250s response = await transport.handle_async_request(request) 250s /usr/lib/python3/dist-packages/httpx/_transports/default.py:372: in handle_async_request 250s with map_httpcore_exceptions(): 250s /usr/lib/python3.12/contextlib.py:158: in __exit__ 250s self.gen.throw(value) 250s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 250s 250s @contextlib.contextmanager 250s def map_httpcore_exceptions() -> typing.Iterator[None]: 250s try: 250s yield 250s except Exception as exc: 250s mapped_exc = None 250s 250s for from_exc, to_exc in HTTPCORE_EXC_MAP.items(): 250s if not isinstance(exc, from_exc): 250s continue 250s # We want to map to the most specific exception we can find. 250s # Eg if `exc` is an `httpcore.ReadTimeout`, we want to map to 250s # `httpx.ReadTimeout`, not just `httpx.TimeoutException`. 250s if mapped_exc is None or issubclass(to_exc, mapped_exc): 250s mapped_exc = to_exc 250s 250s if mapped_exc is None: # pragma: no cover 250s raise 250s 250s message = str(exc) 250s > raise mapped_exc(message) from exc 250s E httpx.ProxyError: 503 Service Unavailable 250s 250s /usr/lib/python3/dist-packages/httpx/_transports/default.py:86: ProxyError 250s =============================== warnings summary =============================== 250s ../../../usr/lib/python3/dist-packages/httpx/_client.py:1426: 2 warnings 250s tests/clients/test_httpx/test_async_assertion_client.py: 2 warnings 250s tests/clients/test_httpx/test_async_oauth1_client.py: 7 warnings 250s tests/clients/test_httpx/test_async_oauth2_client.py: 19 warnings 250s tests/clients/test_starlette/test_oauth_client.py: 9 warnings 250s tests/clients/test_starlette/test_user_mixin.py: 2 warnings 250s /usr/lib/python3/dist-packages/httpx/_client.py:1426: DeprecationWarning: The 'app' shortcut is now deprecated. Use the explicit style 'transport=ASGITransport(app=...)' instead. 250s warnings.warn(message, DeprecationWarning) 250s 250s tests/clients/test_flask/test_oauth_client.py::FlaskOAuthTest::test_openid_authorize 250s /usr/lib/python3/dist-packages/authlib/jose/jwk.py:14: AuthlibDeprecationWarning: Please use ``JsonWebKey`` directly. 250s deprecate('Please use ``JsonWebKey`` directly.') 250s 250s tests/clients/test_httpx/test_assertion_client.py: 3 warnings 250s tests/clients/test_httpx/test_oauth1_client.py: 7 warnings 250s tests/clients/test_httpx/test_oauth2_client.py: 23 warnings 250s /usr/lib/python3/dist-packages/httpx/_client.py:680: DeprecationWarning: The 'app' shortcut is now deprecated. Use the explicit style 'transport=WSGITransport(app=...)' instead. 250s warnings.warn(message, DeprecationWarning) 250s 250s tests/clients/test_httpx/test_async_oauth2_client.py::test_httpx_client_stream_match[client0] 250s tests/clients/test_httpx/test_async_oauth2_client.py::test_httpx_client_stream_match[client1] 250s /usr/lib/python3/dist-packages/_pytest/python.py:183: PytestUnhandledCoroutineWarning: async def functions are not natively supported and have been skipped. 250s You need to install a suitable plugin for your async framework, for example: 250s - anyio 250s - pytest-asyncio 250s - pytest-tornasync 250s - pytest-trio 250s - pytest-twisted 250s warnings.warn(PytestUnhandledCoroutineWarning(msg.format(nodeid))) 250s 250s -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html 250s =========================== short test summary info ============================ 250s FAILED tests/clients/test_httpx/test_async_assertion_client.py::test_refresh_token 250s FAILED tests/clients/test_httpx/test_async_oauth1_client.py::test_fetch_request_token_via_header 250s FAILED tests/clients/test_httpx/test_async_oauth1_client.py::test_fetch_request_token_via_body 250s FAILED tests/clients/test_httpx/test_async_oauth1_client.py::test_fetch_request_token_via_query 250s FAILED tests/clients/test_httpx/test_async_oauth1_client.py::test_fetch_access_token 250s FAILED tests/clients/test_httpx/test_async_oauth1_client.py::test_get_via_header 250s FAILED tests/clients/test_httpx/test_async_oauth1_client.py::test_get_via_body 250s FAILED tests/clients/test_httpx/test_async_oauth1_client.py::test_get_via_query 250s FAILED tests/clients/test_httpx/test_async_oauth2_client.py::test_add_token_get_request[assert_token_in_header-header] 250s FAILED tests/clients/test_httpx/test_async_oauth2_client.py::test_add_token_get_request[assert_token_in_body-body] 250s FAILED tests/clients/test_httpx/test_async_oauth2_client.py::test_add_token_get_request[assert_token_in_uri-uri] 250s FAILED tests/clients/test_httpx/test_async_oauth2_client.py::test_add_token_to_streaming_request[assert_token_in_header-header] 250s FAILED tests/clients/test_httpx/test_async_oauth2_client.py::test_add_token_to_streaming_request[assert_token_in_body-body] 250s FAILED tests/clients/test_httpx/test_async_oauth2_client.py::test_add_token_to_streaming_request[assert_token_in_uri-uri] 250s FAILED tests/clients/test_httpx/test_async_oauth2_client.py::test_fetch_token_post 250s FAILED tests/clients/test_httpx/test_async_oauth2_client.py::test_fetch_token_get 250s FAILED tests/clients/test_httpx/test_async_oauth2_client.py::test_token_auth_method_client_secret_post 250s FAILED tests/clients/test_httpx/test_async_oauth2_client.py::test_access_token_response_hook 250s FAILED tests/clients/test_httpx/test_async_oauth2_client.py::test_password_grant_type 250s FAILED tests/clients/test_httpx/test_async_oauth2_client.py::test_client_credentials_type 250s FAILED tests/clients/test_httpx/test_async_oauth2_client.py::test_cleans_previous_token_before_fetching_new_one 250s FAILED tests/clients/test_httpx/test_async_oauth2_client.py::test_auto_refresh_token 250s FAILED tests/clients/test_httpx/test_async_oauth2_client.py::test_auto_refresh_token2 250s FAILED tests/clients/test_httpx/test_async_oauth2_client.py::test_auto_refresh_token3 250s FAILED tests/clients/test_httpx/test_async_oauth2_client.py::test_auto_refresh_token4 250s FAILED tests/clients/test_httpx/test_async_oauth2_client.py::test_revoke_token 250s FAILED tests/clients/test_starlette/test_oauth_client.py::test_oauth1_authorize 250s FAILED tests/clients/test_starlette/test_oauth_client.py::test_oauth2_authorize 250s FAILED tests/clients/test_starlette/test_oauth_client.py::test_oauth2_authorize_code_challenge 250s FAILED tests/clients/test_starlette/test_oauth_client.py::test_with_fetch_token_in_register 250s FAILED tests/clients/test_starlette/test_oauth_client.py::test_with_fetch_token_in_oauth 250s FAILED tests/clients/test_starlette/test_oauth_client.py::test_request_withhold_token 250s FAILED tests/clients/test_starlette/test_oauth_client.py::test_oauth2_authorize_with_metadata 250s FAILED tests/clients/test_starlette/test_user_mixin.py::test_fetch_userinfo 250s FAILED tests/clients/test_starlette/test_user_mixin.py::test_force_fetch_jwks_uri 250s =========== 35 failed, 130 passed, 2 skipped, 77 warnings in 25.98s ============ 251s autopkgtest [10:28:58]: test unittests3: -----------------------] 255s autopkgtest [10:29:02]: test unittests3: - - - - - - - - - - results - - - - - - - - - - 255s unittests3 FAIL non-zero exit status 1 259s autopkgtest [10:29:06]: @@@@@@@@@@@@@@@@@@@@ summary 259s unittests3 FAIL non-zero exit status 1