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

More information...

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