0s autopkgtest [21:25:10]: starting date and time: 2024-11-12 21:25:10+0000 0s autopkgtest [21:25:10]: git checkout: 6f3be7a8 Fix armhf LXD image generation for plucky 0s autopkgtest [21:25:10]: host juju-7f2275-prod-proposed-migration-environment-20; command line: /home/ubuntu/autopkgtest/runner/autopkgtest --output-dir /tmp/autopkgtest-work.uzv5vg5d/out --timeout-copy=6000 --setup-commands /home/ubuntu/autopkgtest-cloud/worker-config-production/setup-canonical.sh --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 -- ssh -s /home/ubuntu/autopkgtest/ssh-setup/nova -- --flavor autopkgtest-s390x --security-groups autopkgtest-juju-7f2275-prod-proposed-migration-environment-20@bos03-s390x-5.secgroup --name adt-plucky-s390x-python-authlib-20241112-212509-juju-7f2275-prod-proposed-migration-environment-20-4cbfce54-fe2b-4de1-8ce7-27546175e038 --image adt/ubuntu-plucky-s390x-server --keyname testbed-juju-7f2275-prod-proposed-migration-environment-20 --net-id=net_prod-proposed-migration-s390x -e TERM=linux -e ''"'"'http_proxy=http://squid.internal:3128'"'"'' -e ''"'"'https_proxy=http://squid.internal:3128'"'"'' -e ''"'"'no_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'"'"'' --mirror=http://ftpmaster.internal/ubuntu/ 94s autopkgtest [21:26:44]: testbed dpkg architecture: s390x 94s autopkgtest [21:26:44]: testbed apt version: 2.9.8 94s autopkgtest [21:26:44]: @@@@@@@@@@@@@@@@@@@@ test bed setup 95s Get:1 http://ftpmaster.internal/ubuntu plucky-proposed InRelease [73.9 kB] 95s Get:2 http://ftpmaster.internal/ubuntu plucky-proposed/multiverse Sources [15.3 kB] 96s Get:3 http://ftpmaster.internal/ubuntu plucky-proposed/universe Sources [849 kB] 96s Get:4 http://ftpmaster.internal/ubuntu plucky-proposed/restricted Sources [7016 B] 96s Get:5 http://ftpmaster.internal/ubuntu plucky-proposed/main Sources [87.6 kB] 96s Get:6 http://ftpmaster.internal/ubuntu plucky-proposed/main s390x Packages [99.7 kB] 96s Get:7 http://ftpmaster.internal/ubuntu plucky-proposed/universe s390x Packages [573 kB] 96s Get:8 http://ftpmaster.internal/ubuntu plucky-proposed/multiverse s390x Packages [16.6 kB] 96s Fetched 1722 kB in 1s (2102 kB/s) 96s Reading package lists... 98s Reading package lists... 98s Building dependency tree... 98s Reading state information... 98s Calculating upgrade... 98s The following packages will be upgraded: 98s apport apport-core-dump-handler libarchive13t64 libclang-cpp18 libedit2 98s libllvm18 python3-apport python3-cffi-backend python3-problem-report 99s 9 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 99s Need to get 49.5 MB of archives. 99s After this operation, 7168 B disk space will be freed. 99s Get:1 http://ftpmaster.internal/ubuntu plucky/main s390x python3-problem-report all 2.30.0-0ubuntu5 [25.0 kB] 99s Get:2 http://ftpmaster.internal/ubuntu plucky/main s390x python3-apport all 2.30.0-0ubuntu5 [93.2 kB] 99s Get:3 http://ftpmaster.internal/ubuntu plucky/main s390x apport-core-dump-handler all 2.30.0-0ubuntu5 [17.9 kB] 99s Get:4 http://ftpmaster.internal/ubuntu plucky/main s390x apport all 2.30.0-0ubuntu5 [83.0 kB] 99s Get:5 http://ftpmaster.internal/ubuntu plucky/main s390x python3-cffi-backend s390x 1.17.1-2 [81.5 kB] 99s Get:6 http://ftpmaster.internal/ubuntu plucky/main s390x libedit2 s390x 3.1-20240808-1 [107 kB] 99s Get:7 http://ftpmaster.internal/ubuntu plucky/main s390x libarchive13t64 s390x 3.7.4-1.1 [416 kB] 99s Get:8 http://ftpmaster.internal/ubuntu plucky/main s390x libclang-cpp18 s390x 1:18.1.8-12 [15.8 MB] 100s Get:9 http://ftpmaster.internal/ubuntu plucky/main s390x libllvm18 s390x 1:18.1.8-12 [32.9 MB] 102s Fetched 49.5 MB in 4s (12.9 MB/s) 103s (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 ... 55522 files and directories currently installed.) 103s Preparing to unpack .../0-python3-problem-report_2.30.0-0ubuntu5_all.deb ... 103s Unpacking python3-problem-report (2.30.0-0ubuntu5) over (2.30.0-0ubuntu4) ... 103s Preparing to unpack .../1-python3-apport_2.30.0-0ubuntu5_all.deb ... 103s Unpacking python3-apport (2.30.0-0ubuntu5) over (2.30.0-0ubuntu4) ... 103s Preparing to unpack .../2-apport-core-dump-handler_2.30.0-0ubuntu5_all.deb ... 103s Unpacking apport-core-dump-handler (2.30.0-0ubuntu5) over (2.30.0-0ubuntu4) ... 103s Preparing to unpack .../3-apport_2.30.0-0ubuntu5_all.deb ... 103s Unpacking apport (2.30.0-0ubuntu5) over (2.30.0-0ubuntu4) ... 103s Preparing to unpack .../4-python3-cffi-backend_1.17.1-2_s390x.deb ... 103s Unpacking python3-cffi-backend:s390x (1.17.1-2) over (1.17.1-1) ... 103s Preparing to unpack .../5-libedit2_3.1-20240808-1_s390x.deb ... 103s Unpacking libedit2:s390x (3.1-20240808-1) over (3.1-20240517-1) ... 103s Preparing to unpack .../6-libarchive13t64_3.7.4-1.1_s390x.deb ... 103s Unpacking libarchive13t64:s390x (3.7.4-1.1) over (3.7.4-1ubuntu1) ... 103s Preparing to unpack .../7-libclang-cpp18_1%3a18.1.8-12_s390x.deb ... 103s Unpacking libclang-cpp18 (1:18.1.8-12) over (1:18.1.8-11) ... 103s Preparing to unpack .../8-libllvm18_1%3a18.1.8-12_s390x.deb ... 103s Unpacking libllvm18:s390x (1:18.1.8-12) over (1:18.1.8-11) ... 104s Setting up python3-problem-report (2.30.0-0ubuntu5) ... 104s Setting up libedit2:s390x (3.1-20240808-1) ... 104s Setting up python3-apport (2.30.0-0ubuntu5) ... 104s Setting up libarchive13t64:s390x (3.7.4-1.1) ... 104s Setting up python3-cffi-backend:s390x (1.17.1-2) ... 104s Setting up libllvm18:s390x (1:18.1.8-12) ... 104s Setting up libclang-cpp18 (1:18.1.8-12) ... 104s Setting up apport-core-dump-handler (2.30.0-0ubuntu5) ... 105s Setting up apport (2.30.0-0ubuntu5) ... 105s Installing new version of config file /etc/apport/crashdb.conf ... 105s apport-autoreport.service is a disabled or a static unit not running, not starting it. 105s Processing triggers for libc-bin (2.40-1ubuntu3) ... 105s Processing triggers for man-db (2.12.1-3) ... 106s Reading package lists... 106s Building dependency tree... 106s Reading state information... 106s 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 107s Hit:1 http://ftpmaster.internal/ubuntu plucky-proposed InRelease 107s Hit:2 http://ftpmaster.internal/ubuntu plucky InRelease 107s Hit:3 http://ftpmaster.internal/ubuntu plucky-updates InRelease 107s Hit:4 http://ftpmaster.internal/ubuntu plucky-security InRelease 108s Reading package lists... 108s Reading package lists... 108s Building dependency tree... 108s Reading state information... 108s Calculating upgrade... 108s 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 108s Reading package lists... 108s Building dependency tree... 108s Reading state information... 108s 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 109s autopkgtest [21:26:59]: rebooting testbed after setup commands that affected boot 112s autopkgtest-virt-ssh: WARNING: ssh connection failed. Retrying in 3 seconds... 128s autopkgtest [21:27:18]: testbed running kernel: Linux 6.11.0-8-generic #8-Ubuntu SMP Mon Sep 16 12:49:35 UTC 2024 131s autopkgtest [21:27:21]: @@@@@@@@@@@@@@@@@@@@ apt-source python-authlib 133s Get:1 http://ftpmaster.internal/ubuntu plucky/universe python-authlib 1.3.2-2 (dsc) [2494 B] 133s Get:2 http://ftpmaster.internal/ubuntu plucky/universe python-authlib 1.3.2-2 (tar) [321 kB] 133s Get:3 http://ftpmaster.internal/ubuntu plucky/universe python-authlib 1.3.2-2 (diff) [6156 B] 133s gpgv: Signature made Mon Oct 21 14:03:43 2024 UTC 133s gpgv: using EDDSA key EE9AD6F90520FA11F69F4824477B0DB0263A54D8 133s gpgv: issuer "stefanor@debian.org" 133s gpgv: Can't check signature: No public key 133s dpkg-source: warning: cannot verify inline signature for ./python-authlib_1.3.2-2.dsc: no acceptable signature found 133s autopkgtest [21:27:23]: testing package python-authlib version 1.3.2-2 133s autopkgtest [21:27:23]: build not needed 134s autopkgtest [21:27:24]: test unittests3: preparing testbed 139s Reading package lists... 139s Building dependency tree... 139s Reading state information... 139s Starting pkgProblemResolver with broken count: 0 139s Starting 2 pkgProblemResolver with broken count: 0 139s Done 139s The following additional packages will be installed: 139s libjs-jquery python3-all python3-anyio python3-asgiref 139s python3-async-generator python3-authlib python3-cachelib python3-click 139s python3-colorama python3-django python3-flask python3-flask-sqlalchemy 139s python3-greenlet python3-h11 python3-httpcore python3-httpx 139s python3-iniconfig python3-itsdangerous python3-packaging python3-pluggy 139s python3-pycryptodome python3-pytest python3-pytest-asyncio 139s python3-pytest-django python3-sniffio python3-sqlalchemy python3-sqlparse 139s python3-starlette python3-werkzeug 139s Suggested packages: 139s python-cachelib-doc bpython3 geoip-database-contrib gettext ipython3 139s libgdal20 libsqlite3-mod-spatialite python-django-doc python3-bcrypt 139s python3-flup python3-memcache python3-mysqldb python3-pil python3-psycopg2 139s python3-selenium python3-sqlite python3-dotenv python-flask-doc 139s python-greenlet-dev python-greenlet-doc python-sqlalchemy-doc 139s python3-asyncpg python3-pg8000 python3-psycopg2cffi python3-aiosqlite 139s python3-mariadb-connector python3-mysql.connector python3-pyodbc 139s python3-pymssql python3-cx-oracle python3-oracledb python-sqlparse-doc 139s python3-databases python-werkzeug-doc python3-lxml python3-watchdog 139s Recommended packages: 139s javascript-common python3-tz python3-simplejson python3-sqlalchemy-ext 139s python3-uvicorn | python3-daphne python3-aiofiles python3-multipart 139s python3-pyinotify 139s The following NEW packages will be installed: 139s autopkgtest-satdep libjs-jquery python3-all python3-anyio python3-asgiref 139s python3-async-generator python3-authlib python3-cachelib python3-click 139s python3-colorama python3-django python3-flask python3-flask-sqlalchemy 139s python3-greenlet python3-h11 python3-httpcore python3-httpx 139s python3-iniconfig python3-itsdangerous python3-packaging python3-pluggy 139s python3-pycryptodome python3-pytest python3-pytest-asyncio 139s python3-pytest-django python3-sniffio python3-sqlalchemy python3-sqlparse 139s python3-starlette python3-werkzeug 139s 0 upgraded, 30 newly installed, 0 to remove and 0 not upgraded. 139s Need to get 6934 kB/6935 kB of archives. 139s After this operation, 45.7 MB of additional disk space will be used. 139s Get:1 /tmp/autopkgtest.B39RNj/1-autopkgtest-satdep.deb autopkgtest-satdep s390x 0 [812 B] 139s Get:2 http://ftpmaster.internal/ubuntu plucky/main s390x libjs-jquery all 3.6.1+dfsg+~3.5.14-1 [328 kB] 140s Get:3 http://ftpmaster.internal/ubuntu plucky/main s390x python3-all s390x 3.12.6-0ubuntu1 [890 B] 140s Get:4 http://ftpmaster.internal/ubuntu plucky/universe s390x python3-sniffio all 1.3.1-1 [7262 B] 140s Get:5 http://ftpmaster.internal/ubuntu plucky/universe s390x python3-anyio all 4.4.0-1 [57.4 kB] 140s Get:6 http://ftpmaster.internal/ubuntu plucky/main s390x python3-asgiref all 3.8.1-1 [24.8 kB] 140s Get:7 http://ftpmaster.internal/ubuntu plucky/universe s390x python3-async-generator all 1.10-4 [17.5 kB] 140s Get:8 http://ftpmaster.internal/ubuntu plucky/universe s390x python3-pycryptodome s390x 3.20.0+dfsg-3 [1094 kB] 140s Get:9 http://ftpmaster.internal/ubuntu plucky/universe s390x python3-authlib all 1.3.2-2 [112 kB] 140s Get:10 http://ftpmaster.internal/ubuntu plucky/universe s390x python3-cachelib all 0.13.0-2 [20.7 kB] 140s Get:11 http://ftpmaster.internal/ubuntu plucky/main s390x python3-colorama all 0.4.6-4 [32.1 kB] 140s Get:12 http://ftpmaster.internal/ubuntu plucky/main s390x python3-click all 8.1.7-2 [79.5 kB] 140s Get:13 http://ftpmaster.internal/ubuntu plucky/main s390x python3-sqlparse all 0.5.1-2 [32.7 kB] 140s Get:14 http://ftpmaster.internal/ubuntu plucky/main s390x python3-django all 3:4.2.15-1ubuntu1 [2916 kB] 140s Get:15 http://ftpmaster.internal/ubuntu plucky/main s390x python3-itsdangerous all 2.2.0-1 [15.2 kB] 140s Get:16 http://ftpmaster.internal/ubuntu plucky/main s390x python3-werkzeug all 3.0.4-1ubuntu1 [171 kB] 140s Get:17 http://ftpmaster.internal/ubuntu plucky/main s390x python3-flask all 3.0.3-1ubuntu1 [83.2 kB] 140s Get:18 http://ftpmaster.internal/ubuntu plucky/main s390x python3-greenlet s390x 3.0.3-0ubuntu6 [156 kB] 140s Get:19 http://ftpmaster.internal/ubuntu plucky/main s390x python3-sqlalchemy all 2.0.32+ds1-1ubuntu1 [1206 kB] 140s Get:20 http://ftpmaster.internal/ubuntu plucky/universe s390x python3-flask-sqlalchemy all 3.1.1-2 [30.9 kB] 140s Get:21 http://ftpmaster.internal/ubuntu plucky/universe s390x python3-h11 all 0.14.0-1 [51.1 kB] 140s Get:22 http://ftpmaster.internal/ubuntu plucky/universe s390x python3-httpcore all 1.0.4-1 [38.8 kB] 140s Get:23 http://ftpmaster.internal/ubuntu plucky-proposed/universe s390x python3-httpx all 0.27.0-1 [60.9 kB] 140s Get:24 http://ftpmaster.internal/ubuntu plucky/universe s390x python3-iniconfig all 1.1.1-2 [6024 B] 140s Get:25 http://ftpmaster.internal/ubuntu plucky/main s390x python3-packaging all 24.1-1 [41.4 kB] 140s Get:26 http://ftpmaster.internal/ubuntu plucky/universe s390x python3-pluggy all 1.5.0-1 [21.0 kB] 140s Get:27 http://ftpmaster.internal/ubuntu plucky/universe s390x python3-pytest all 8.3.3-1 [251 kB] 140s Get:28 http://ftpmaster.internal/ubuntu plucky/universe s390x python3-pytest-asyncio all 0.20.3-1.3 [10.7 kB] 141s Get:29 http://ftpmaster.internal/ubuntu plucky/universe s390x python3-pytest-django all 4.5.2-3 [18.5 kB] 141s Get:30 http://ftpmaster.internal/ubuntu plucky/universe s390x python3-starlette all 0.38.5-0ubuntu1 [49.8 kB] 141s Fetched 6934 kB in 1s (4980 kB/s) 141s Selecting previously unselected package libjs-jquery. 141s (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 ... 55511 files and directories currently installed.) 141s Preparing to unpack .../00-libjs-jquery_3.6.1+dfsg+~3.5.14-1_all.deb ... 141s Unpacking libjs-jquery (3.6.1+dfsg+~3.5.14-1) ... 141s Selecting previously unselected package python3-all. 141s Preparing to unpack .../01-python3-all_3.12.6-0ubuntu1_s390x.deb ... 141s Unpacking python3-all (3.12.6-0ubuntu1) ... 141s Selecting previously unselected package python3-sniffio. 141s Preparing to unpack .../02-python3-sniffio_1.3.1-1_all.deb ... 141s Unpacking python3-sniffio (1.3.1-1) ... 141s Selecting previously unselected package python3-anyio. 141s Preparing to unpack .../03-python3-anyio_4.4.0-1_all.deb ... 141s Unpacking python3-anyio (4.4.0-1) ... 141s Selecting previously unselected package python3-asgiref. 141s Preparing to unpack .../04-python3-asgiref_3.8.1-1_all.deb ... 141s Unpacking python3-asgiref (3.8.1-1) ... 141s Selecting previously unselected package python3-async-generator. 141s Preparing to unpack .../05-python3-async-generator_1.10-4_all.deb ... 141s Unpacking python3-async-generator (1.10-4) ... 141s Selecting previously unselected package python3-pycryptodome. 141s Preparing to unpack .../06-python3-pycryptodome_3.20.0+dfsg-3_s390x.deb ... 141s Unpacking python3-pycryptodome (3.20.0+dfsg-3) ... 141s Selecting previously unselected package python3-authlib. 141s Preparing to unpack .../07-python3-authlib_1.3.2-2_all.deb ... 141s Unpacking python3-authlib (1.3.2-2) ... 141s Selecting previously unselected package python3-cachelib. 141s Preparing to unpack .../08-python3-cachelib_0.13.0-2_all.deb ... 141s Unpacking python3-cachelib (0.13.0-2) ... 141s Selecting previously unselected package python3-colorama. 141s Preparing to unpack .../09-python3-colorama_0.4.6-4_all.deb ... 141s Unpacking python3-colorama (0.4.6-4) ... 141s Selecting previously unselected package python3-click. 141s Preparing to unpack .../10-python3-click_8.1.7-2_all.deb ... 141s Unpacking python3-click (8.1.7-2) ... 141s Selecting previously unselected package python3-sqlparse. 141s Preparing to unpack .../11-python3-sqlparse_0.5.1-2_all.deb ... 141s Unpacking python3-sqlparse (0.5.1-2) ... 141s Selecting previously unselected package python3-django. 141s Preparing to unpack .../12-python3-django_3%3a4.2.15-1ubuntu1_all.deb ... 141s Unpacking python3-django (3:4.2.15-1ubuntu1) ... 141s Selecting previously unselected package python3-itsdangerous. 141s Preparing to unpack .../13-python3-itsdangerous_2.2.0-1_all.deb ... 141s Unpacking python3-itsdangerous (2.2.0-1) ... 141s Selecting previously unselected package python3-werkzeug. 141s Preparing to unpack .../14-python3-werkzeug_3.0.4-1ubuntu1_all.deb ... 141s Unpacking python3-werkzeug (3.0.4-1ubuntu1) ... 141s Selecting previously unselected package python3-flask. 141s Preparing to unpack .../15-python3-flask_3.0.3-1ubuntu1_all.deb ... 141s Unpacking python3-flask (3.0.3-1ubuntu1) ... 141s Selecting previously unselected package python3-greenlet. 141s Preparing to unpack .../16-python3-greenlet_3.0.3-0ubuntu6_s390x.deb ... 141s Unpacking python3-greenlet (3.0.3-0ubuntu6) ... 141s Selecting previously unselected package python3-sqlalchemy. 141s Preparing to unpack .../17-python3-sqlalchemy_2.0.32+ds1-1ubuntu1_all.deb ... 141s Unpacking python3-sqlalchemy (2.0.32+ds1-1ubuntu1) ... 142s Selecting previously unselected package python3-flask-sqlalchemy. 142s Preparing to unpack .../18-python3-flask-sqlalchemy_3.1.1-2_all.deb ... 142s Unpacking python3-flask-sqlalchemy (3.1.1-2) ... 142s Selecting previously unselected package python3-h11. 142s Preparing to unpack .../19-python3-h11_0.14.0-1_all.deb ... 142s Unpacking python3-h11 (0.14.0-1) ... 142s Selecting previously unselected package python3-httpcore. 142s Preparing to unpack .../20-python3-httpcore_1.0.4-1_all.deb ... 142s Unpacking python3-httpcore (1.0.4-1) ... 142s Selecting previously unselected package python3-httpx. 142s Preparing to unpack .../21-python3-httpx_0.27.0-1_all.deb ... 142s Unpacking python3-httpx (0.27.0-1) ... 142s Selecting previously unselected package python3-iniconfig. 142s Preparing to unpack .../22-python3-iniconfig_1.1.1-2_all.deb ... 142s Unpacking python3-iniconfig (1.1.1-2) ... 142s Selecting previously unselected package python3-packaging. 142s Preparing to unpack .../23-python3-packaging_24.1-1_all.deb ... 142s Unpacking python3-packaging (24.1-1) ... 142s Selecting previously unselected package python3-pluggy. 142s Preparing to unpack .../24-python3-pluggy_1.5.0-1_all.deb ... 142s Unpacking python3-pluggy (1.5.0-1) ... 142s Selecting previously unselected package python3-pytest. 142s Preparing to unpack .../25-python3-pytest_8.3.3-1_all.deb ... 142s Unpacking python3-pytest (8.3.3-1) ... 142s Selecting previously unselected package python3-pytest-asyncio. 142s Preparing to unpack .../26-python3-pytest-asyncio_0.20.3-1.3_all.deb ... 142s Unpacking python3-pytest-asyncio (0.20.3-1.3) ... 142s Selecting previously unselected package python3-pytest-django. 142s Preparing to unpack .../27-python3-pytest-django_4.5.2-3_all.deb ... 142s Unpacking python3-pytest-django (4.5.2-3) ... 142s Selecting previously unselected package python3-starlette. 142s Preparing to unpack .../28-python3-starlette_0.38.5-0ubuntu1_all.deb ... 142s Unpacking python3-starlette (0.38.5-0ubuntu1) ... 142s Selecting previously unselected package autopkgtest-satdep. 142s Preparing to unpack .../29-1-autopkgtest-satdep.deb ... 142s Unpacking autopkgtest-satdep (0) ... 142s Setting up python3-iniconfig (1.1.1-2) ... 142s Setting up python3-sniffio (1.3.1-1) ... 142s Setting up python3-async-generator (1.10-4) ... 142s Setting up python3-anyio (4.4.0-1) ... 142s Setting up python3-colorama (0.4.6-4) ... 142s Setting up python3-pycryptodome (3.20.0+dfsg-3) ... 143s Setting up python3-itsdangerous (2.2.0-1) ... 143s Setting up python3-all (3.12.6-0ubuntu1) ... 143s Setting up python3-starlette (0.38.5-0ubuntu1) ... 143s Setting up python3-click (8.1.7-2) ... 143s Setting up python3-packaging (24.1-1) ... 143s Setting up python3-sqlparse (0.5.1-2) ... 143s Setting up python3-greenlet (3.0.3-0ubuntu6) ... 143s Setting up python3-h11 (0.14.0-1) ... 143s Setting up python3-pluggy (1.5.0-1) ... 143s Setting up python3-cachelib (0.13.0-2) ... 144s Setting up libjs-jquery (3.6.1+dfsg+~3.5.14-1) ... 144s Setting up python3-asgiref (3.8.1-1) ... 144s Setting up python3-authlib (1.3.2-2) ... 144s Setting up python3-httpcore (1.0.4-1) ... 144s Setting up python3-django (3:4.2.15-1ubuntu1) ... 145s Setting up python3-pytest (8.3.3-1) ... 145s Setting up python3-pytest-django (4.5.2-3) ... 146s Setting up python3-sqlalchemy (2.0.32+ds1-1ubuntu1) ... 147s Setting up python3-httpx (0.27.0-1) ... 147s Setting up python3-werkzeug (3.0.4-1ubuntu1) ... 147s Setting up python3-pytest-asyncio (0.20.3-1.3) ... 147s Setting up python3-flask (3.0.3-1ubuntu1) ... 147s Setting up python3-flask-sqlalchemy (3.1.1-2) ... 147s Setting up autopkgtest-satdep (0) ... 147s Processing triggers for man-db (2.12.1-3) ... 150s (Reading database ... 63368 files and directories currently installed.) 150s Removing autopkgtest-satdep (0) ... 150s autopkgtest [21:27:40]: test unittests3: [----------------------- 151s === python3.12 === 151s ============================= test session starts ============================== 151s platform linux -- Python 3.12.7, pytest-8.3.3, pluggy-1.5.0 151s rootdir: /tmp/autopkgtest.B39RNj/autopkgtest_tmp 151s configfile: setup.cfg 151s plugins: django-4.5.2, typeguard-4.4.1, anyio-4.4.0, asyncio-0.20.3 151s asyncio: mode=Mode.STRICT 151s collected 101 items 151s 151s tests/core/test_oauth2/test_rfc6749_misc.py ...... [ 5%] 152s tests/core/test_oauth2/test_rfc7523.py ........................ [ 29%] 152s tests/core/test_oauth2/test_rfc7591.py ...... [ 35%] 152s tests/core/test_oauth2/test_rfc7662.py ...... [ 41%] 152s tests/core/test_oauth2/test_rfc8414.py .......................... [ 67%] 152s tests/core/test_oidc/test_core.py .......... [ 77%] 152s tests/core/test_oidc/test_discovery.py ....................... [100%] 152s 152s ============================= 101 passed in 1.07s ============================== 153s ============================= test session starts ============================== 153s platform linux -- Python 3.12.7, pytest-8.3.3, pluggy-1.5.0 153s django: settings: tests.clients.test_django.settings (from env) 153s rootdir: /tmp/autopkgtest.B39RNj/autopkgtest_tmp 153s configfile: setup.cfg 153s plugins: django-4.5.2, typeguard-4.4.1, anyio-4.4.0, asyncio-0.20.3 153s asyncio: mode=Mode.STRICT 153s collected 169 items 153s 153s tests/clients/test_django/test_oauth_client.py ............. [ 7%] 153s tests/clients/test_flask/test_oauth_client.py .................... [ 19%] 153s tests/clients/test_flask/test_user_mixin.py ..... [ 22%] 153s tests/clients/test_httpx/test_assertion_client.py .. [ 23%] 153s tests/clients/test_httpx/test_async_assertion_client.py F. [ 24%] 158s tests/clients/test_httpx/test_async_oauth1_client.py FFFFFFF [ 28%] 164s tests/clients/test_httpx/test_async_oauth2_client.py FFFFFFss...FFFFFFF. [ 40%] 166s FFFFF. [ 43%] 166s tests/clients/test_httpx/test_oauth1_client.py ....... [ 47%] 166s tests/clients/test_httpx/test_oauth2_client.py ...................... [ 60%] 166s tests/clients/test_requests/test_assertion_session.py .. [ 62%] 166s tests/clients/test_requests/test_oauth1_session.py ................ [ 71%] 166s tests/clients/test_requests/test_oauth2_session.py ..................... [ 84%] 166s ........... [ 90%] 168s tests/clients/test_starlette/test_oauth_client.py ...FF.FFFF.F [ 97%] 169s tests/clients/test_starlette/test_user_mixin.py F..F [100%] 169s 169s =================================== FAILURES =================================== 169s ______________________________ test_refresh_token ______________________________ 169s 169s @contextlib.contextmanager 169s def map_httpcore_exceptions() -> typing.Iterator[None]: 169s try: 169s > yield 169s 169s /usr/lib/python3/dist-packages/httpx/_transports/default.py:69: 169s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 169s /usr/lib/python3/dist-packages/httpx/_transports/default.py:373: in handle_async_request 169s resp = await self._pool.handle_async_request(req) 169s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:216: in handle_async_request 169s raise exc from None 169s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:196: in handle_async_request 169s response = await connection.handle_async_request( 169s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 169s 169s self = 169s request = 169s 169s async def handle_async_request(self, request: Request) -> Response: 169s timeouts = request.extensions.get("timeout", {}) 169s timeout = timeouts.get("connect", None) 169s 169s async with self._connect_lock: 169s if not self._connected: 169s target = b"%b:%d" % (self._remote_origin.host, self._remote_origin.port) 169s 169s connect_url = URL( 169s scheme=self._proxy_origin.scheme, 169s host=self._proxy_origin.host, 169s port=self._proxy_origin.port, 169s target=target, 169s ) 169s connect_headers = merge_headers( 169s [(b"Host", target), (b"Accept", b"*/*")], self._proxy_headers 169s ) 169s connect_request = Request( 169s method=b"CONNECT", 169s url=connect_url, 169s headers=connect_headers, 169s extensions=request.extensions, 169s ) 169s connect_response = await self._connection.handle_async_request( 169s connect_request 169s ) 169s 169s if connect_response.status < 200 or connect_response.status > 299: 169s reason_bytes = connect_response.extensions.get("reason_phrase", b"") 169s reason_str = reason_bytes.decode("ascii", errors="ignore") 169s msg = "%d %s" % (connect_response.status, reason_str) 169s await self._connection.aclose() 169s > raise ProxyError(msg) 169s E httpcore.ProxyError: 503 Service Unavailable 169s 169s /usr/lib/python3/dist-packages/httpcore/_async/http_proxy.py:298: ProxyError 169s 169s The above exception was the direct cause of the following exception: 169s 169s @pytest.mark.asyncio 169s async def test_refresh_token(): 169s async def verifier(request): 169s content = await request.body() 169s if str(request.url) == 'https://i.b/token': 169s assert b'assertion=' in content 169s 169s async with AsyncAssertionClient( 169s 'https://i.b/token', 169s grant_type=AsyncAssertionClient.JWT_BEARER_GRANT_TYPE, 169s issuer='foo', 169s subject='foo', 169s audience='foo', 169s alg='HS256', 169s key='secret', 169s app=AsyncMockDispatch(default_token, assert_func=verifier) 169s ) as client: 169s > await client.get('https://i.b') 169s 169s tests/clients/test_httpx/test_async_assertion_client.py:33: 169s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 169s /usr/lib/python3/dist-packages/httpx/_client.py:1801: in get 169s return await self.request( 169s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/assertion_client.py:38: in request 169s await self.refresh_token() 169s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/assertion_client.py:45: in _refresh_token 169s resp = await self.request( 169s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/assertion_client.py:41: in request 169s return await super().request( 169s /usr/lib/python3/dist-packages/httpx/_client.py:1574: in request 169s return await self.send(request, auth=auth, follow_redirects=follow_redirects) 169s /usr/lib/python3/dist-packages/httpx/_client.py:1661: in send 169s response = await self._send_handling_auth( 169s /usr/lib/python3/dist-packages/httpx/_client.py:1689: in _send_handling_auth 169s response = await self._send_handling_redirects( 169s /usr/lib/python3/dist-packages/httpx/_client.py:1726: in _send_handling_redirects 169s response = await self._send_single_request(request) 169s /usr/lib/python3/dist-packages/httpx/_client.py:1763: in _send_single_request 169s response = await transport.handle_async_request(request) 169s /usr/lib/python3/dist-packages/httpx/_transports/default.py:372: in handle_async_request 169s with map_httpcore_exceptions(): 169s /usr/lib/python3.12/contextlib.py:158: in __exit__ 169s self.gen.throw(value) 169s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 169s 169s @contextlib.contextmanager 169s def map_httpcore_exceptions() -> typing.Iterator[None]: 169s try: 169s yield 169s except Exception as exc: 169s mapped_exc = None 169s 169s for from_exc, to_exc in HTTPCORE_EXC_MAP.items(): 169s if not isinstance(exc, from_exc): 169s continue 169s # We want to map to the most specific exception we can find. 169s # Eg if `exc` is an `httpcore.ReadTimeout`, we want to map to 169s # `httpx.ReadTimeout`, not just `httpx.TimeoutException`. 169s if mapped_exc is None or issubclass(to_exc, mapped_exc): 169s mapped_exc = to_exc 169s 169s if mapped_exc is None: # pragma: no cover 169s raise 169s 169s message = str(exc) 169s > raise mapped_exc(message) from exc 169s E httpx.ProxyError: 503 Service Unavailable 169s 169s /usr/lib/python3/dist-packages/httpx/_transports/default.py:86: ProxyError 169s _____________________ test_fetch_request_token_via_header ______________________ 169s 169s @pytest.mark.asyncio 169s async def test_fetch_request_token_via_header(): 169s request_token = {'oauth_token': '1', 'oauth_token_secret': '2'} 169s 169s async def assert_func(request): 169s auth_header = request.headers.get('authorization') 169s assert 'oauth_consumer_key="id"' in auth_header 169s assert 'oauth_signature=' in auth_header 169s 169s app = AsyncMockDispatch(request_token, assert_func=assert_func) 169s async with AsyncOAuth1Client('id', 'secret', app=app) as client: 169s > response = await client.fetch_request_token(oauth_url) 169s 169s tests/clients/test_httpx/test_async_oauth1_client.py:24: 169s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 169s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth1_client.py:70: in _fetch_token 169s token = self.parse_response_token(resp.status_code, to_unicode(text)) 169s /usr/lib/python3/dist-packages/authlib/oauth1/client.py:152: in parse_response_token 169s self.handle_error('fetch_token_denied', message) 169s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 169s 169s error_type = 'fetch_token_denied' 169s error_description = "Token request failed with code 405, response was ''." 169s 169s @staticmethod 169s def handle_error(error_type, error_description): 169s > raise OAuthError(error_type, error_description) 169s E authlib.integrations.base_client.errors.OAuthError: fetch_token_denied: Token request failed with code 405, response was ''. 169s 169s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth1_client.py:76: OAuthError 169s ______________________ test_fetch_request_token_via_body _______________________ 169s 169s @pytest.mark.asyncio 169s async def test_fetch_request_token_via_body(): 169s request_token = {'oauth_token': '1', 'oauth_token_secret': '2'} 169s 169s async def assert_func(request): 169s auth_header = request.headers.get('authorization') 169s assert auth_header is None 169s 169s content = await request.body() 169s assert b'oauth_consumer_key=id' in content 169s assert b'&oauth_signature=' in content 169s 169s mock_response = AsyncMockDispatch(request_token, assert_func=assert_func) 169s 169s async with AsyncOAuth1Client( 169s 'id', 'secret', signature_type=SIGNATURE_TYPE_BODY, 169s app=mock_response, 169s ) as client: 169s > response = await client.fetch_request_token(oauth_url) 169s 169s tests/clients/test_httpx/test_async_oauth1_client.py:47: 169s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 169s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth1_client.py:70: in _fetch_token 169s token = self.parse_response_token(resp.status_code, to_unicode(text)) 169s /usr/lib/python3/dist-packages/authlib/oauth1/client.py:152: in parse_response_token 169s self.handle_error('fetch_token_denied', message) 169s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 169s 169s error_type = 'fetch_token_denied' 169s error_description = "Token request failed with code 405, response was ''." 169s 169s @staticmethod 169s def handle_error(error_type, error_description): 169s > raise OAuthError(error_type, error_description) 169s E authlib.integrations.base_client.errors.OAuthError: fetch_token_denied: Token request failed with code 405, response was ''. 169s 169s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth1_client.py:76: OAuthError 169s ______________________ test_fetch_request_token_via_query ______________________ 169s 169s @pytest.mark.asyncio 169s async def test_fetch_request_token_via_query(): 169s request_token = {'oauth_token': '1', 'oauth_token_secret': '2'} 169s 169s async def assert_func(request): 169s auth_header = request.headers.get('authorization') 169s assert auth_header is None 169s 169s url = str(request.url) 169s assert 'oauth_consumer_key=id' in url 169s assert '&oauth_signature=' in url 169s 169s mock_response = AsyncMockDispatch(request_token, assert_func=assert_func) 169s 169s async with AsyncOAuth1Client( 169s 'id', 'secret', signature_type=SIGNATURE_TYPE_QUERY, 169s app=mock_response, 169s ) as client: 169s > response = await client.fetch_request_token(oauth_url) 169s 169s tests/clients/test_httpx/test_async_oauth1_client.py:70: 169s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 169s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth1_client.py:70: in _fetch_token 169s token = self.parse_response_token(resp.status_code, to_unicode(text)) 169s /usr/lib/python3/dist-packages/authlib/oauth1/client.py:152: in parse_response_token 169s self.handle_error('fetch_token_denied', message) 169s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 169s 169s error_type = 'fetch_token_denied' 169s error_description = "Token request failed with code 405, response was ''." 169s 169s @staticmethod 169s def handle_error(error_type, error_description): 169s > raise OAuthError(error_type, error_description) 169s E authlib.integrations.base_client.errors.OAuthError: fetch_token_denied: Token request failed with code 405, response was ''. 169s 169s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth1_client.py:76: OAuthError 169s ___________________________ test_fetch_access_token ____________________________ 169s 169s @pytest.mark.asyncio 169s async def test_fetch_access_token(): 169s request_token = {'oauth_token': '1', 'oauth_token_secret': '2'} 169s 169s async def assert_func(request): 169s auth_header = request.headers.get('authorization') 169s assert 'oauth_verifier="d"' in auth_header 169s assert 'oauth_token="foo"' in auth_header 169s assert 'oauth_consumer_key="id"' in auth_header 169s assert 'oauth_signature=' in auth_header 169s 169s mock_response = AsyncMockDispatch(request_token, assert_func=assert_func) 169s async with AsyncOAuth1Client( 169s 'id', 'secret', token='foo', token_secret='bar', 169s app=mock_response, 169s ) as client: 169s with pytest.raises(OAuthError): 169s await client.fetch_access_token(oauth_url) 169s 169s > response = await client.fetch_access_token(oauth_url, verifier='d') 169s 169s tests/clients/test_httpx/test_async_oauth1_client.py:94: 169s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 169s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth1_client.py:63: in fetch_access_token 169s token = await self._fetch_token(url, **kwargs) 169s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth1_client.py:70: in _fetch_token 169s token = self.parse_response_token(resp.status_code, to_unicode(text)) 169s /usr/lib/python3/dist-packages/authlib/oauth1/client.py:152: in parse_response_token 169s self.handle_error('fetch_token_denied', message) 169s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 169s 169s error_type = 'fetch_token_denied' 169s error_description = "Token request failed with code 405, response was ''." 169s 169s @staticmethod 169s def handle_error(error_type, error_description): 169s > raise OAuthError(error_type, error_description) 169s E authlib.integrations.base_client.errors.OAuthError: fetch_token_denied: Token request failed with code 405, response was ''. 169s 169s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth1_client.py:76: OAuthError 169s _____________________________ test_get_via_header ______________________________ 169s 169s @pytest.mark.asyncio 169s async def test_get_via_header(): 169s mock_response = AsyncMockDispatch(b'hello') 169s async with AsyncOAuth1Client( 169s 'id', 'secret', token='foo', token_secret='bar', 169s app=mock_response, 169s ) as client: 169s response = await client.get('https://example.com/') 169s 169s > assert response.content == b'hello' 169s E AssertionError: assert b'\n\n' == b'hello' 169s E 169s E At index 0 diff: b'<' != b'h' 169s E Use -v to get more diff 169s 169s tests/clients/test_httpx/test_async_oauth1_client.py:108: AssertionError 169s ______________________________ test_get_via_body _______________________________ 169s 169s @pytest.mark.asyncio 169s async def test_get_via_body(): 169s async def assert_func(request): 169s content = await request.body() 169s assert b'oauth_token=foo' in content 169s assert b'oauth_consumer_key=id' in content 169s assert b'oauth_signature=' in content 169s 169s mock_response = AsyncMockDispatch(b'hello', assert_func=assert_func) 169s async with AsyncOAuth1Client( 169s 'id', 'secret', token='foo', token_secret='bar', 169s signature_type=SIGNATURE_TYPE_BODY, 169s app=mock_response, 169s ) as client: 169s response = await client.post('https://example.com/') 169s 169s > assert response.content == b'hello' 169s E AssertionError: assert b'' == b'hello' 169s E 169s E Use -v to get more diff 169s 169s tests/clients/test_httpx/test_async_oauth1_client.py:132: AssertionError 169s ______________________________ test_get_via_query ______________________________ 169s 169s @pytest.mark.asyncio 169s async def test_get_via_query(): 169s mock_response = AsyncMockDispatch(b'hello') 169s async with AsyncOAuth1Client( 169s 'id', 'secret', token='foo', token_secret='bar', 169s signature_type=SIGNATURE_TYPE_QUERY, 169s app=mock_response, 169s ) as client: 169s response = await client.get('https://example.com/') 169s 169s > assert response.content == b'hello' 169s E AssertionError: assert b'\n\n' == b'hello' 169s E 169s E At index 0 diff: b'<' != b'h' 169s E Use -v to get more diff 169s 169s tests/clients/test_httpx/test_async_oauth1_client.py:149: AssertionError 169s __________ test_add_token_get_request[assert_token_in_header-header] ___________ 169s 169s @contextlib.contextmanager 169s def map_httpcore_exceptions() -> typing.Iterator[None]: 169s try: 169s > yield 169s 169s /usr/lib/python3/dist-packages/httpx/_transports/default.py:69: 169s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 169s /usr/lib/python3/dist-packages/httpx/_transports/default.py:373: in handle_async_request 169s resp = await self._pool.handle_async_request(req) 169s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:216: in handle_async_request 169s raise exc from None 169s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:196: in handle_async_request 169s response = await connection.handle_async_request( 169s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 169s 169s self = 169s request = 169s 169s async def handle_async_request(self, request: Request) -> Response: 169s timeouts = request.extensions.get("timeout", {}) 169s timeout = timeouts.get("connect", None) 169s 169s async with self._connect_lock: 169s if not self._connected: 169s target = b"%b:%d" % (self._remote_origin.host, self._remote_origin.port) 169s 169s connect_url = URL( 169s scheme=self._proxy_origin.scheme, 169s host=self._proxy_origin.host, 169s port=self._proxy_origin.port, 169s target=target, 169s ) 169s connect_headers = merge_headers( 169s [(b"Host", target), (b"Accept", b"*/*")], self._proxy_headers 169s ) 169s connect_request = Request( 169s method=b"CONNECT", 169s url=connect_url, 169s headers=connect_headers, 169s extensions=request.extensions, 169s ) 169s connect_response = await self._connection.handle_async_request( 169s connect_request 169s ) 169s 169s if connect_response.status < 200 or connect_response.status > 299: 169s reason_bytes = connect_response.extensions.get("reason_phrase", b"") 169s reason_str = reason_bytes.decode("ascii", errors="ignore") 169s msg = "%d %s" % (connect_response.status, reason_str) 169s await self._connection.aclose() 169s > raise ProxyError(msg) 169s E httpcore.ProxyError: 503 Service Unavailable 169s 169s /usr/lib/python3/dist-packages/httpcore/_async/http_proxy.py:298: ProxyError 169s 169s The above exception was the direct cause of the following exception: 169s 169s assert_func = 169s token_placement = 'header' 169s 169s @pytest.mark.asyncio 169s @pytest.mark.parametrize( 169s "assert_func, token_placement", 169s [ 169s (assert_token_in_header, "header"), 169s (assert_token_in_body, "body"), 169s (assert_token_in_uri, "uri") 169s ] 169s ) 169s async def test_add_token_get_request(assert_func, token_placement): 169s mock_response = AsyncMockDispatch({'a': 'a'}, assert_func=assert_func) 169s async with AsyncOAuth2Client( 169s 'foo', 169s token=default_token, 169s token_placement=token_placement, 169s app=mock_response 169s ) as client: 169s > resp = await client.get('https://i.b') 169s 169s tests/clients/test_httpx/test_async_oauth2_client.py:62: 169s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 169s /usr/lib/python3/dist-packages/httpx/_client.py:1801: in get 169s return await self.request( 169s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:90: in request 169s return await super().request( 169s /usr/lib/python3/dist-packages/httpx/_client.py:1574: in request 169s return await self.send(request, auth=auth, follow_redirects=follow_redirects) 169s /usr/lib/python3/dist-packages/httpx/_client.py:1661: in send 169s response = await self._send_handling_auth( 169s /usr/lib/python3/dist-packages/httpx/_client.py:1689: in _send_handling_auth 169s response = await self._send_handling_redirects( 169s /usr/lib/python3/dist-packages/httpx/_client.py:1726: in _send_handling_redirects 169s response = await self._send_single_request(request) 169s /usr/lib/python3/dist-packages/httpx/_client.py:1763: in _send_single_request 169s response = await transport.handle_async_request(request) 169s /usr/lib/python3/dist-packages/httpx/_transports/default.py:372: in handle_async_request 169s with map_httpcore_exceptions(): 169s /usr/lib/python3.12/contextlib.py:158: in __exit__ 169s self.gen.throw(value) 169s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 169s 169s @contextlib.contextmanager 169s def map_httpcore_exceptions() -> typing.Iterator[None]: 169s try: 169s yield 169s except Exception as exc: 169s mapped_exc = None 169s 169s for from_exc, to_exc in HTTPCORE_EXC_MAP.items(): 169s if not isinstance(exc, from_exc): 169s continue 169s # We want to map to the most specific exception we can find. 169s # Eg if `exc` is an `httpcore.ReadTimeout`, we want to map to 169s # `httpx.ReadTimeout`, not just `httpx.TimeoutException`. 169s if mapped_exc is None or issubclass(to_exc, mapped_exc): 169s mapped_exc = to_exc 169s 169s if mapped_exc is None: # pragma: no cover 169s raise 169s 169s message = str(exc) 169s > raise mapped_exc(message) from exc 169s E httpx.ProxyError: 503 Service Unavailable 169s 169s /usr/lib/python3/dist-packages/httpx/_transports/default.py:86: ProxyError 169s ____________ test_add_token_get_request[assert_token_in_body-body] _____________ 169s 169s @contextlib.contextmanager 169s def map_httpcore_exceptions() -> typing.Iterator[None]: 169s try: 169s > yield 169s 169s /usr/lib/python3/dist-packages/httpx/_transports/default.py:69: 169s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 169s /usr/lib/python3/dist-packages/httpx/_transports/default.py:373: in handle_async_request 169s resp = await self._pool.handle_async_request(req) 169s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:216: in handle_async_request 169s raise exc from None 169s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:196: in handle_async_request 169s response = await connection.handle_async_request( 169s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 169s 169s self = 169s request = 169s 169s async def handle_async_request(self, request: Request) -> Response: 169s timeouts = request.extensions.get("timeout", {}) 169s timeout = timeouts.get("connect", None) 169s 169s async with self._connect_lock: 169s if not self._connected: 169s target = b"%b:%d" % (self._remote_origin.host, self._remote_origin.port) 169s 169s connect_url = URL( 169s scheme=self._proxy_origin.scheme, 169s host=self._proxy_origin.host, 169s port=self._proxy_origin.port, 169s target=target, 169s ) 169s connect_headers = merge_headers( 169s [(b"Host", target), (b"Accept", b"*/*")], self._proxy_headers 169s ) 169s connect_request = Request( 169s method=b"CONNECT", 169s url=connect_url, 169s headers=connect_headers, 169s extensions=request.extensions, 169s ) 169s connect_response = await self._connection.handle_async_request( 169s connect_request 169s ) 169s 169s if connect_response.status < 200 or connect_response.status > 299: 169s reason_bytes = connect_response.extensions.get("reason_phrase", b"") 169s reason_str = reason_bytes.decode("ascii", errors="ignore") 169s msg = "%d %s" % (connect_response.status, reason_str) 169s await self._connection.aclose() 169s > raise ProxyError(msg) 169s E httpcore.ProxyError: 503 Service Unavailable 169s 169s /usr/lib/python3/dist-packages/httpcore/_async/http_proxy.py:298: ProxyError 169s 169s The above exception was the direct cause of the following exception: 169s 169s assert_func = 169s token_placement = 'body' 169s 169s @pytest.mark.asyncio 169s @pytest.mark.parametrize( 169s "assert_func, token_placement", 169s [ 169s (assert_token_in_header, "header"), 169s (assert_token_in_body, "body"), 169s (assert_token_in_uri, "uri") 169s ] 169s ) 169s async def test_add_token_get_request(assert_func, token_placement): 169s mock_response = AsyncMockDispatch({'a': 'a'}, assert_func=assert_func) 169s async with AsyncOAuth2Client( 169s 'foo', 169s token=default_token, 169s token_placement=token_placement, 169s app=mock_response 169s ) as client: 169s > resp = await client.get('https://i.b') 169s 169s tests/clients/test_httpx/test_async_oauth2_client.py:62: 169s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 169s /usr/lib/python3/dist-packages/httpx/_client.py:1801: in get 169s return await self.request( 169s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:90: in request 169s return await super().request( 169s /usr/lib/python3/dist-packages/httpx/_client.py:1574: in request 169s return await self.send(request, auth=auth, follow_redirects=follow_redirects) 169s /usr/lib/python3/dist-packages/httpx/_client.py:1661: in send 169s response = await self._send_handling_auth( 169s /usr/lib/python3/dist-packages/httpx/_client.py:1689: in _send_handling_auth 169s response = await self._send_handling_redirects( 169s /usr/lib/python3/dist-packages/httpx/_client.py:1726: in _send_handling_redirects 169s response = await self._send_single_request(request) 169s /usr/lib/python3/dist-packages/httpx/_client.py:1763: in _send_single_request 169s response = await transport.handle_async_request(request) 169s /usr/lib/python3/dist-packages/httpx/_transports/default.py:372: in handle_async_request 169s with map_httpcore_exceptions(): 169s /usr/lib/python3.12/contextlib.py:158: in __exit__ 169s self.gen.throw(value) 169s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 169s 169s @contextlib.contextmanager 169s def map_httpcore_exceptions() -> typing.Iterator[None]: 169s try: 169s yield 169s except Exception as exc: 169s mapped_exc = None 169s 169s for from_exc, to_exc in HTTPCORE_EXC_MAP.items(): 169s if not isinstance(exc, from_exc): 169s continue 169s # We want to map to the most specific exception we can find. 169s # Eg if `exc` is an `httpcore.ReadTimeout`, we want to map to 169s # `httpx.ReadTimeout`, not just `httpx.TimeoutException`. 169s if mapped_exc is None or issubclass(to_exc, mapped_exc): 169s mapped_exc = to_exc 169s 169s if mapped_exc is None: # pragma: no cover 169s raise 169s 169s message = str(exc) 169s > raise mapped_exc(message) from exc 169s E httpx.ProxyError: 503 Service Unavailable 169s 169s /usr/lib/python3/dist-packages/httpx/_transports/default.py:86: ProxyError 169s _____________ test_add_token_get_request[assert_token_in_uri-uri] ______________ 169s 169s @contextlib.contextmanager 169s def map_httpcore_exceptions() -> typing.Iterator[None]: 169s try: 169s > yield 169s 169s /usr/lib/python3/dist-packages/httpx/_transports/default.py:69: 169s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 169s /usr/lib/python3/dist-packages/httpx/_transports/default.py:373: in handle_async_request 169s resp = await self._pool.handle_async_request(req) 169s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:216: in handle_async_request 169s raise exc from None 169s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:196: in handle_async_request 169s response = await connection.handle_async_request( 169s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 169s 169s self = 169s request = 169s 169s async def handle_async_request(self, request: Request) -> Response: 169s timeouts = request.extensions.get("timeout", {}) 169s timeout = timeouts.get("connect", None) 169s 169s async with self._connect_lock: 169s if not self._connected: 169s target = b"%b:%d" % (self._remote_origin.host, self._remote_origin.port) 169s 169s connect_url = URL( 169s scheme=self._proxy_origin.scheme, 169s host=self._proxy_origin.host, 169s port=self._proxy_origin.port, 169s target=target, 169s ) 169s connect_headers = merge_headers( 169s [(b"Host", target), (b"Accept", b"*/*")], self._proxy_headers 169s ) 169s connect_request = Request( 169s method=b"CONNECT", 169s url=connect_url, 169s headers=connect_headers, 169s extensions=request.extensions, 169s ) 169s connect_response = await self._connection.handle_async_request( 169s connect_request 169s ) 169s 169s if connect_response.status < 200 or connect_response.status > 299: 169s reason_bytes = connect_response.extensions.get("reason_phrase", b"") 169s reason_str = reason_bytes.decode("ascii", errors="ignore") 169s msg = "%d %s" % (connect_response.status, reason_str) 169s await self._connection.aclose() 169s > raise ProxyError(msg) 169s E httpcore.ProxyError: 503 Service Unavailable 169s 169s /usr/lib/python3/dist-packages/httpcore/_async/http_proxy.py:298: ProxyError 169s 169s The above exception was the direct cause of the following exception: 169s 169s assert_func = 169s token_placement = 'uri' 169s 169s @pytest.mark.asyncio 169s @pytest.mark.parametrize( 169s "assert_func, token_placement", 169s [ 169s (assert_token_in_header, "header"), 169s (assert_token_in_body, "body"), 169s (assert_token_in_uri, "uri") 169s ] 169s ) 169s async def test_add_token_get_request(assert_func, token_placement): 169s mock_response = AsyncMockDispatch({'a': 'a'}, assert_func=assert_func) 169s async with AsyncOAuth2Client( 169s 'foo', 169s token=default_token, 169s token_placement=token_placement, 169s app=mock_response 169s ) as client: 169s > resp = await client.get('https://i.b') 169s 169s tests/clients/test_httpx/test_async_oauth2_client.py:62: 169s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 169s /usr/lib/python3/dist-packages/httpx/_client.py:1801: in get 169s return await self.request( 169s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:90: in request 169s return await super().request( 169s /usr/lib/python3/dist-packages/httpx/_client.py:1574: in request 169s return await self.send(request, auth=auth, follow_redirects=follow_redirects) 169s /usr/lib/python3/dist-packages/httpx/_client.py:1661: in send 169s response = await self._send_handling_auth( 169s /usr/lib/python3/dist-packages/httpx/_client.py:1689: in _send_handling_auth 169s response = await self._send_handling_redirects( 169s /usr/lib/python3/dist-packages/httpx/_client.py:1726: in _send_handling_redirects 169s response = await self._send_single_request(request) 169s /usr/lib/python3/dist-packages/httpx/_client.py:1763: in _send_single_request 169s response = await transport.handle_async_request(request) 169s /usr/lib/python3/dist-packages/httpx/_transports/default.py:372: in handle_async_request 169s with map_httpcore_exceptions(): 169s /usr/lib/python3.12/contextlib.py:158: in __exit__ 169s self.gen.throw(value) 169s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 169s 169s @contextlib.contextmanager 169s def map_httpcore_exceptions() -> typing.Iterator[None]: 169s try: 169s yield 169s except Exception as exc: 169s mapped_exc = None 169s 169s for from_exc, to_exc in HTTPCORE_EXC_MAP.items(): 169s if not isinstance(exc, from_exc): 169s continue 169s # We want to map to the most specific exception we can find. 169s # Eg if `exc` is an `httpcore.ReadTimeout`, we want to map to 169s # `httpx.ReadTimeout`, not just `httpx.TimeoutException`. 169s if mapped_exc is None or issubclass(to_exc, mapped_exc): 169s mapped_exc = to_exc 169s 169s if mapped_exc is None: # pragma: no cover 169s raise 169s 169s message = str(exc) 169s > raise mapped_exc(message) from exc 169s E httpx.ProxyError: 503 Service Unavailable 169s 169s /usr/lib/python3/dist-packages/httpx/_transports/default.py:86: ProxyError 169s ______ test_add_token_to_streaming_request[assert_token_in_header-header] ______ 169s 169s @contextlib.contextmanager 169s def map_httpcore_exceptions() -> typing.Iterator[None]: 169s try: 169s > yield 169s 169s /usr/lib/python3/dist-packages/httpx/_transports/default.py:69: 169s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 169s /usr/lib/python3/dist-packages/httpx/_transports/default.py:373: in handle_async_request 169s resp = await self._pool.handle_async_request(req) 169s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:216: in handle_async_request 169s raise exc from None 169s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:196: in handle_async_request 169s response = await connection.handle_async_request( 169s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 169s 169s self = 169s request = 169s 169s async def handle_async_request(self, request: Request) -> Response: 169s timeouts = request.extensions.get("timeout", {}) 169s timeout = timeouts.get("connect", None) 169s 169s async with self._connect_lock: 169s if not self._connected: 169s target = b"%b:%d" % (self._remote_origin.host, self._remote_origin.port) 169s 169s connect_url = URL( 169s scheme=self._proxy_origin.scheme, 169s host=self._proxy_origin.host, 169s port=self._proxy_origin.port, 169s target=target, 169s ) 169s connect_headers = merge_headers( 169s [(b"Host", target), (b"Accept", b"*/*")], self._proxy_headers 169s ) 169s connect_request = Request( 169s method=b"CONNECT", 169s url=connect_url, 169s headers=connect_headers, 169s extensions=request.extensions, 169s ) 169s connect_response = await self._connection.handle_async_request( 169s connect_request 169s ) 169s 169s if connect_response.status < 200 or connect_response.status > 299: 169s reason_bytes = connect_response.extensions.get("reason_phrase", b"") 169s reason_str = reason_bytes.decode("ascii", errors="ignore") 169s msg = "%d %s" % (connect_response.status, reason_str) 169s await self._connection.aclose() 169s > raise ProxyError(msg) 169s E httpcore.ProxyError: 503 Service Unavailable 169s 169s /usr/lib/python3/dist-packages/httpcore/_async/http_proxy.py:298: ProxyError 169s 169s The above exception was the direct cause of the following exception: 169s 169s assert_func = 169s token_placement = 'header' 169s 169s @pytest.mark.asyncio 169s @pytest.mark.parametrize( 169s "assert_func, token_placement", 169s [ 169s (assert_token_in_header, "header"), 169s (assert_token_in_body, "body"), 169s (assert_token_in_uri, "uri") 169s ] 169s ) 169s async def test_add_token_to_streaming_request(assert_func, token_placement): 169s mock_response = AsyncMockDispatch({'a': 'a'}, assert_func=assert_func) 169s async with AsyncOAuth2Client( 169s 'foo', 169s token=default_token, 169s token_placement=token_placement, 169s app=mock_response 169s ) as client: 169s > async with client.stream("GET", 'https://i.b') as stream: 169s 169s tests/clients/test_httpx/test_async_oauth2_client.py:85: 169s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 169s /usr/lib/python3.12/contextlib.py:210: in __aenter__ 169s return await anext(self.gen) 169s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:103: in stream 169s async with super().stream( 169s /usr/lib/python3.12/contextlib.py:210: in __aenter__ 169s return await anext(self.gen) 169s /usr/lib/python3/dist-packages/httpx/_client.py:1617: in stream 169s response = await self.send( 169s /usr/lib/python3/dist-packages/httpx/_client.py:1661: in send 169s response = await self._send_handling_auth( 169s /usr/lib/python3/dist-packages/httpx/_client.py:1689: in _send_handling_auth 169s response = await self._send_handling_redirects( 169s /usr/lib/python3/dist-packages/httpx/_client.py:1726: in _send_handling_redirects 169s response = await self._send_single_request(request) 169s /usr/lib/python3/dist-packages/httpx/_client.py:1763: in _send_single_request 169s response = await transport.handle_async_request(request) 169s /usr/lib/python3/dist-packages/httpx/_transports/default.py:372: in handle_async_request 169s with map_httpcore_exceptions(): 169s /usr/lib/python3.12/contextlib.py:158: in __exit__ 169s self.gen.throw(value) 169s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 169s 169s @contextlib.contextmanager 169s def map_httpcore_exceptions() -> typing.Iterator[None]: 169s try: 169s yield 169s except Exception as exc: 169s mapped_exc = None 169s 169s for from_exc, to_exc in HTTPCORE_EXC_MAP.items(): 169s if not isinstance(exc, from_exc): 169s continue 169s # We want to map to the most specific exception we can find. 169s # Eg if `exc` is an `httpcore.ReadTimeout`, we want to map to 169s # `httpx.ReadTimeout`, not just `httpx.TimeoutException`. 169s if mapped_exc is None or issubclass(to_exc, mapped_exc): 169s mapped_exc = to_exc 169s 169s if mapped_exc is None: # pragma: no cover 169s raise 169s 169s message = str(exc) 169s > raise mapped_exc(message) from exc 169s E httpx.ProxyError: 503 Service Unavailable 169s 169s /usr/lib/python3/dist-packages/httpx/_transports/default.py:86: ProxyError 169s ________ test_add_token_to_streaming_request[assert_token_in_body-body] ________ 169s 169s @contextlib.contextmanager 169s def map_httpcore_exceptions() -> typing.Iterator[None]: 169s try: 169s > yield 169s 169s /usr/lib/python3/dist-packages/httpx/_transports/default.py:69: 169s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 169s /usr/lib/python3/dist-packages/httpx/_transports/default.py:373: in handle_async_request 169s resp = await self._pool.handle_async_request(req) 169s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:216: in handle_async_request 169s raise exc from None 169s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:196: in handle_async_request 169s response = await connection.handle_async_request( 169s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 169s 169s self = 169s request = 169s 169s async def handle_async_request(self, request: Request) -> Response: 169s timeouts = request.extensions.get("timeout", {}) 169s timeout = timeouts.get("connect", None) 169s 169s async with self._connect_lock: 169s if not self._connected: 169s target = b"%b:%d" % (self._remote_origin.host, self._remote_origin.port) 169s 169s connect_url = URL( 169s scheme=self._proxy_origin.scheme, 169s host=self._proxy_origin.host, 169s port=self._proxy_origin.port, 169s target=target, 169s ) 169s connect_headers = merge_headers( 169s [(b"Host", target), (b"Accept", b"*/*")], self._proxy_headers 169s ) 169s connect_request = Request( 169s method=b"CONNECT", 169s url=connect_url, 169s headers=connect_headers, 169s extensions=request.extensions, 169s ) 169s connect_response = await self._connection.handle_async_request( 169s connect_request 169s ) 169s 169s if connect_response.status < 200 or connect_response.status > 299: 169s reason_bytes = connect_response.extensions.get("reason_phrase", b"") 169s reason_str = reason_bytes.decode("ascii", errors="ignore") 169s msg = "%d %s" % (connect_response.status, reason_str) 169s await self._connection.aclose() 169s > raise ProxyError(msg) 169s E httpcore.ProxyError: 503 Service Unavailable 169s 169s /usr/lib/python3/dist-packages/httpcore/_async/http_proxy.py:298: ProxyError 169s 169s The above exception was the direct cause of the following exception: 169s 169s assert_func = 169s token_placement = 'body' 169s 169s @pytest.mark.asyncio 169s @pytest.mark.parametrize( 169s "assert_func, token_placement", 169s [ 169s (assert_token_in_header, "header"), 169s (assert_token_in_body, "body"), 169s (assert_token_in_uri, "uri") 169s ] 169s ) 169s async def test_add_token_to_streaming_request(assert_func, token_placement): 169s mock_response = AsyncMockDispatch({'a': 'a'}, assert_func=assert_func) 169s async with AsyncOAuth2Client( 169s 'foo', 169s token=default_token, 169s token_placement=token_placement, 169s app=mock_response 169s ) as client: 169s > async with client.stream("GET", 'https://i.b') as stream: 169s 169s tests/clients/test_httpx/test_async_oauth2_client.py:85: 169s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 169s /usr/lib/python3.12/contextlib.py:210: in __aenter__ 169s return await anext(self.gen) 169s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:103: in stream 169s async with super().stream( 169s /usr/lib/python3.12/contextlib.py:210: in __aenter__ 169s return await anext(self.gen) 169s /usr/lib/python3/dist-packages/httpx/_client.py:1617: in stream 169s response = await self.send( 169s /usr/lib/python3/dist-packages/httpx/_client.py:1661: in send 169s response = await self._send_handling_auth( 169s /usr/lib/python3/dist-packages/httpx/_client.py:1689: in _send_handling_auth 169s response = await self._send_handling_redirects( 169s /usr/lib/python3/dist-packages/httpx/_client.py:1726: in _send_handling_redirects 169s response = await self._send_single_request(request) 169s /usr/lib/python3/dist-packages/httpx/_client.py:1763: in _send_single_request 169s response = await transport.handle_async_request(request) 169s /usr/lib/python3/dist-packages/httpx/_transports/default.py:372: in handle_async_request 169s with map_httpcore_exceptions(): 169s /usr/lib/python3.12/contextlib.py:158: in __exit__ 169s self.gen.throw(value) 169s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 169s 169s @contextlib.contextmanager 169s def map_httpcore_exceptions() -> typing.Iterator[None]: 169s try: 169s yield 169s except Exception as exc: 169s mapped_exc = None 169s 169s for from_exc, to_exc in HTTPCORE_EXC_MAP.items(): 169s if not isinstance(exc, from_exc): 169s continue 169s # We want to map to the most specific exception we can find. 169s # Eg if `exc` is an `httpcore.ReadTimeout`, we want to map to 169s # `httpx.ReadTimeout`, not just `httpx.TimeoutException`. 169s if mapped_exc is None or issubclass(to_exc, mapped_exc): 169s mapped_exc = to_exc 169s 169s if mapped_exc is None: # pragma: no cover 169s raise 169s 169s message = str(exc) 169s > raise mapped_exc(message) from exc 169s E httpx.ProxyError: 503 Service Unavailable 169s 169s /usr/lib/python3/dist-packages/httpx/_transports/default.py:86: ProxyError 169s _________ test_add_token_to_streaming_request[assert_token_in_uri-uri] _________ 169s 169s @contextlib.contextmanager 169s def map_httpcore_exceptions() -> typing.Iterator[None]: 169s try: 169s > yield 169s 169s /usr/lib/python3/dist-packages/httpx/_transports/default.py:69: 169s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 169s /usr/lib/python3/dist-packages/httpx/_transports/default.py:373: in handle_async_request 169s resp = await self._pool.handle_async_request(req) 169s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:216: in handle_async_request 169s raise exc from None 169s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:196: in handle_async_request 169s response = await connection.handle_async_request( 169s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 169s 169s self = 169s request = 169s 169s async def handle_async_request(self, request: Request) -> Response: 169s timeouts = request.extensions.get("timeout", {}) 169s timeout = timeouts.get("connect", None) 169s 169s async with self._connect_lock: 169s if not self._connected: 169s target = b"%b:%d" % (self._remote_origin.host, self._remote_origin.port) 169s 169s connect_url = URL( 169s scheme=self._proxy_origin.scheme, 169s host=self._proxy_origin.host, 169s port=self._proxy_origin.port, 169s target=target, 169s ) 169s connect_headers = merge_headers( 169s [(b"Host", target), (b"Accept", b"*/*")], self._proxy_headers 169s ) 169s connect_request = Request( 169s method=b"CONNECT", 169s url=connect_url, 169s headers=connect_headers, 169s extensions=request.extensions, 169s ) 169s connect_response = await self._connection.handle_async_request( 169s connect_request 169s ) 169s 169s if connect_response.status < 200 or connect_response.status > 299: 169s reason_bytes = connect_response.extensions.get("reason_phrase", b"") 169s reason_str = reason_bytes.decode("ascii", errors="ignore") 169s msg = "%d %s" % (connect_response.status, reason_str) 169s await self._connection.aclose() 169s > raise ProxyError(msg) 169s E httpcore.ProxyError: 503 Service Unavailable 169s 169s /usr/lib/python3/dist-packages/httpcore/_async/http_proxy.py:298: ProxyError 169s 169s The above exception was the direct cause of the following exception: 169s 169s assert_func = 169s token_placement = 'uri' 169s 169s @pytest.mark.asyncio 169s @pytest.mark.parametrize( 169s "assert_func, token_placement", 169s [ 169s (assert_token_in_header, "header"), 169s (assert_token_in_body, "body"), 169s (assert_token_in_uri, "uri") 169s ] 169s ) 169s async def test_add_token_to_streaming_request(assert_func, token_placement): 169s mock_response = AsyncMockDispatch({'a': 'a'}, assert_func=assert_func) 169s async with AsyncOAuth2Client( 169s 'foo', 169s token=default_token, 169s token_placement=token_placement, 169s app=mock_response 169s ) as client: 169s > async with client.stream("GET", 'https://i.b') as stream: 169s 169s tests/clients/test_httpx/test_async_oauth2_client.py:85: 169s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 169s /usr/lib/python3.12/contextlib.py:210: in __aenter__ 169s return await anext(self.gen) 169s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:103: in stream 169s async with super().stream( 169s /usr/lib/python3.12/contextlib.py:210: in __aenter__ 169s return await anext(self.gen) 169s /usr/lib/python3/dist-packages/httpx/_client.py:1617: in stream 169s response = await self.send( 169s /usr/lib/python3/dist-packages/httpx/_client.py:1661: in send 169s response = await self._send_handling_auth( 169s /usr/lib/python3/dist-packages/httpx/_client.py:1689: in _send_handling_auth 169s response = await self._send_handling_redirects( 169s /usr/lib/python3/dist-packages/httpx/_client.py:1726: in _send_handling_redirects 169s response = await self._send_single_request(request) 169s /usr/lib/python3/dist-packages/httpx/_client.py:1763: in _send_single_request 169s response = await transport.handle_async_request(request) 169s /usr/lib/python3/dist-packages/httpx/_transports/default.py:372: in handle_async_request 169s with map_httpcore_exceptions(): 169s /usr/lib/python3.12/contextlib.py:158: in __exit__ 169s self.gen.throw(value) 169s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 169s 169s @contextlib.contextmanager 169s def map_httpcore_exceptions() -> typing.Iterator[None]: 169s try: 169s yield 169s except Exception as exc: 169s mapped_exc = None 169s 169s for from_exc, to_exc in HTTPCORE_EXC_MAP.items(): 169s if not isinstance(exc, from_exc): 169s continue 169s # We want to map to the most specific exception we can find. 169s # Eg if `exc` is an `httpcore.ReadTimeout`, we want to map to 169s # `httpx.ReadTimeout`, not just `httpx.TimeoutException`. 169s if mapped_exc is None or issubclass(to_exc, mapped_exc): 169s mapped_exc = to_exc 169s 169s if mapped_exc is None: # pragma: no cover 169s raise 169s 169s message = str(exc) 169s > raise mapped_exc(message) from exc 169s E httpx.ProxyError: 503 Service Unavailable 169s 169s /usr/lib/python3/dist-packages/httpx/_transports/default.py:86: ProxyError 169s ____________________________ test_fetch_token_post _____________________________ 169s 169s @pytest.mark.asyncio 169s async def test_fetch_token_post(): 169s url = 'https://example.com/token' 169s 169s async def assert_func(request): 169s content = await request.body() 169s content = content.decode() 169s assert 'code=v' in content 169s assert 'client_id=' in content 169s assert 'grant_type=authorization_code' in content 169s 169s mock_response = AsyncMockDispatch(default_token, assert_func=assert_func) 169s async with AsyncOAuth2Client('foo', app=mock_response) as client: 169s > token = await client.fetch_token(url, authorization_response='https://i.b/?code=v') 169s 169s tests/clients/test_httpx/test_async_oauth2_client.py:156: 169s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 169s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:138: in _fetch_token 169s return self.parse_response_token(resp) 169s /usr/lib/python3/dist-packages/authlib/oauth2/client.py:353: in parse_response_token 169s token = resp.json() 169s /usr/lib/python3/dist-packages/httpx/_models.py:764: in json 169s return jsonlib.loads(self.content, **kwargs) 169s /usr/lib/python3.12/json/__init__.py:346: in loads 169s return _default_decoder.decode(s) 169s /usr/lib/python3.12/json/decoder.py:338: in decode 169s obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 169s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 169s 169s self = , s = '', idx = 0 169s 169s def raw_decode(self, s, idx=0): 169s """Decode a JSON document from ``s`` (a ``str`` beginning with 169s a JSON document) and return a 2-tuple of the Python 169s representation and the index in ``s`` where the document ended. 169s 169s This can be used to decode a JSON document from a string that may 169s have extraneous data at the end. 169s 169s """ 169s try: 169s obj, end = self.scan_once(s, idx) 169s except StopIteration as err: 169s > raise JSONDecodeError("Expecting value", s, err.value) from None 169s E json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) 169s 169s /usr/lib/python3.12/json/decoder.py:356: JSONDecodeError 169s _____________________________ test_fetch_token_get _____________________________ 169s 169s @pytest.mark.asyncio 169s async def test_fetch_token_get(): 169s url = 'https://example.com/token' 169s 169s async def assert_func(request): 169s url = str(request.url) 169s assert 'code=v' in url 169s assert 'client_id=' in url 169s assert 'grant_type=authorization_code' in url 169s 169s mock_response = AsyncMockDispatch(default_token, assert_func=assert_func) 169s async with AsyncOAuth2Client('foo', app=mock_response) as client: 169s authorization_response = 'https://i.b/?code=v' 169s > token = await client.fetch_token( 169s url, authorization_response=authorization_response, method='GET') 169s 169s tests/clients/test_httpx/test_async_oauth2_client.py:186: 169s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 169s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth2_client.py:138: in _fetch_token 169s return self.parse_response_token(resp) 169s /usr/lib/python3/dist-packages/authlib/oauth2/client.py:353: in parse_response_token 169s token = resp.json() 169s /usr/lib/python3/dist-packages/httpx/_models.py:764: in json 169s return jsonlib.loads(self.content, **kwargs) 169s /usr/lib/python3.12/json/__init__.py:346: in loads 169s return _default_decoder.decode(s) 169s /usr/lib/python3.12/json/decoder.py:338: in decode 169s obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 169s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 169s 169s self = 169s s = '\n\n\n Example Domain\n\n \n \n

More information...

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