0s autopkgtest [10:21:46]: starting date and time: 2024-06-16 10:21:46+0000 0s autopkgtest [10:21:46]: git checkout: 433ed4cb Merge branch 'skia/nova_flock' into 'ubuntu/5.34+prod' 0s autopkgtest [10:21:46]: host juju-7f2275-prod-proposed-migration-environment-2; command line: /home/ubuntu/autopkgtest/runner/autopkgtest --output-dir /tmp/autopkgtest-work.hzwsv05w/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 --security-groups autopkgtest-juju-7f2275-prod-proposed-migration-environment-2@lcy02-25.secgroup --name adt-oracular-amd64-python-authlib-20240616-102146-juju-7f2275-prod-proposed-migration-environment-2-217a78bb-53f6-4a10-9713-08aeb7f6a673 --image adt/ubuntu-oracular-amd64-server --keyname testbed-juju-7f2275-prod-proposed-migration-environment-2 --net-id=net_prod-proposed-migration -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/ 109s autopkgtest [10:23:35]: testbed dpkg architecture: amd64 110s autopkgtest [10:23:36]: testbed apt version: 2.9.3 110s autopkgtest [10:23:36]: @@@@@@@@@@@@@@@@@@@@ test bed setup 110s Get:1 http://ftpmaster.internal/ubuntu oracular-proposed InRelease [110 kB] 110s Get:2 http://ftpmaster.internal/ubuntu oracular-proposed/restricted Sources [7052 B] 110s Get:3 http://ftpmaster.internal/ubuntu oracular-proposed/universe Sources [389 kB] 110s Get:4 http://ftpmaster.internal/ubuntu oracular-proposed/multiverse Sources [2576 B] 110s Get:5 http://ftpmaster.internal/ubuntu oracular-proposed/main Sources [36.1 kB] 110s Get:6 http://ftpmaster.internal/ubuntu oracular-proposed/main i386 Packages [38.2 kB] 110s Get:7 http://ftpmaster.internal/ubuntu oracular-proposed/main amd64 Packages [53.8 kB] 110s Get:8 http://ftpmaster.internal/ubuntu oracular-proposed/restricted i386 Packages [6732 B] 110s Get:9 http://ftpmaster.internal/ubuntu oracular-proposed/restricted amd64 Packages [28.9 kB] 110s Get:10 http://ftpmaster.internal/ubuntu oracular-proposed/universe i386 Packages [138 kB] 110s Get:11 http://ftpmaster.internal/ubuntu oracular-proposed/universe amd64 Packages [317 kB] 110s Get:12 http://ftpmaster.internal/ubuntu oracular-proposed/multiverse amd64 Packages [8364 B] 110s Get:13 http://ftpmaster.internal/ubuntu oracular-proposed/multiverse i386 Packages [3884 B] 110s Fetched 1140 kB in 0s (4897 kB/s) 110s Reading package lists... 111s Reading package lists... 112s Building dependency tree... 112s Reading state information... 112s Calculating upgrade... 112s The following packages will be upgraded: 112s apt apt-utils libapt-pkg6.0t64 libldap-common libldap2 112s 5 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 112s Need to get 2875 kB of archives. 112s After this operation, 11.3 kB of additional disk space will be used. 112s Get:1 http://ftpmaster.internal/ubuntu oracular/main amd64 libapt-pkg6.0t64 amd64 2.9.5 [1023 kB] 112s Get:2 http://ftpmaster.internal/ubuntu oracular/main amd64 apt amd64 2.9.5 [1403 kB] 112s Get:3 http://ftpmaster.internal/ubuntu oracular/main amd64 apt-utils amd64 2.9.5 [223 kB] 112s Get:4 http://ftpmaster.internal/ubuntu oracular/main amd64 libldap-common all 2.6.7+dfsg-1~exp1ubuntu9 [31.5 kB] 112s Get:5 http://ftpmaster.internal/ubuntu oracular/main amd64 libldap2 amd64 2.6.7+dfsg-1~exp1ubuntu9 [195 kB] 112s Fetched 2875 kB in 0s (42.4 MB/s) 113s (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 ... 74430 files and directories currently installed.) 113s Preparing to unpack .../libapt-pkg6.0t64_2.9.5_amd64.deb ... 113s Unpacking libapt-pkg6.0t64:amd64 (2.9.5) over (2.9.3) ... 113s Setting up libapt-pkg6.0t64:amd64 (2.9.5) ... 113s (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 ... 74430 files and directories currently installed.) 113s Preparing to unpack .../archives/apt_2.9.5_amd64.deb ... 113s Unpacking apt (2.9.5) over (2.9.3) ... 113s Setting up apt (2.9.5) ... 114s (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 ... 74430 files and directories currently installed.) 114s Preparing to unpack .../apt-utils_2.9.5_amd64.deb ... 114s Unpacking apt-utils (2.9.5) over (2.9.3) ... 114s Preparing to unpack .../libldap-common_2.6.7+dfsg-1~exp1ubuntu9_all.deb ... 114s Unpacking libldap-common (2.6.7+dfsg-1~exp1ubuntu9) over (2.6.7+dfsg-1~exp1ubuntu8) ... 114s Preparing to unpack .../libldap2_2.6.7+dfsg-1~exp1ubuntu9_amd64.deb ... 114s Unpacking libldap2:amd64 (2.6.7+dfsg-1~exp1ubuntu9) over (2.6.7+dfsg-1~exp1ubuntu8) ... 114s Setting up apt-utils (2.9.5) ... 114s Setting up libldap-common (2.6.7+dfsg-1~exp1ubuntu9) ... 114s Setting up libldap2:amd64 (2.6.7+dfsg-1~exp1ubuntu9) ... 114s Processing triggers for man-db (2.12.1-2) ... 115s Processing triggers for libc-bin (2.39-0ubuntu9) ... 117s Reading package lists... 117s Building dependency tree... 117s Reading state information... 117s 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 117s Hit:1 http://ftpmaster.internal/ubuntu oracular-proposed InRelease 117s Hit:2 http://ftpmaster.internal/ubuntu oracular InRelease 117s Hit:3 http://ftpmaster.internal/ubuntu oracular-updates InRelease 117s Hit:4 http://ftpmaster.internal/ubuntu oracular-security InRelease 118s Reading package lists... 118s Reading package lists... 119s Building dependency tree... 119s Reading state information... 119s Calculating upgrade... 119s 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 119s Reading package lists... 119s Building dependency tree... 119s Reading state information... 120s 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 120s autopkgtest [10:23:46]: rebooting testbed after setup commands that affected boot 123s autopkgtest-virt-ssh: WARNING: ssh connection failed. Retrying in 3 seconds... 133s autopkgtest-virt-ssh: WARNING: ssh connection failed. Retrying in 3 seconds... 137s autopkgtest [10:24:03]: testbed running kernel: Linux 6.8.0-31-generic #31-Ubuntu SMP PREEMPT_DYNAMIC Sat Apr 20 00:40:06 UTC 2024 138s autopkgtest [10:24:04]: @@@@@@@@@@@@@@@@@@@@ apt-source python-authlib 139s Get:1 http://ftpmaster.internal/ubuntu oracular/universe python-authlib 1.3.1-1 (dsc) [2494 B] 139s Get:2 http://ftpmaster.internal/ubuntu oracular/universe python-authlib 1.3.1-1 (tar) [320 kB] 139s Get:3 http://ftpmaster.internal/ubuntu oracular/universe python-authlib 1.3.1-1 (diff) [5564 B] 139s gpgv: Signature made Thu Jun 6 10:39:37 2024 UTC 139s gpgv: using EDDSA key EE9AD6F90520FA11F69F4824477B0DB0263A54D8 139s gpgv: issuer "stefanor@debian.org" 139s gpgv: Can't check signature: No public key 139s dpkg-source: warning: cannot verify inline signature for ./python-authlib_1.3.1-1.dsc: no acceptable signature found 139s autopkgtest [10:24:05]: testing package python-authlib version 1.3.1-1 140s autopkgtest [10:24:06]: build not needed 140s autopkgtest [10:24:06]: test unittests3: preparing testbed 140s Reading package lists... 140s Building dependency tree... 140s Reading state information... 141s Starting pkgProblemResolver with broken count: 0 141s Starting 2 pkgProblemResolver with broken count: 0 141s Done 141s The following additional packages will be installed: 141s libjs-jquery python3-all python3-anyio python3-asgiref 141s python3-async-generator python3-authlib python3-cachelib python3-click 141s python3-colorama python3-django python3-flask python3-flask-sqlalchemy 141s python3-greenlet python3-h11 python3-httpcore python3-httpx 141s python3-iniconfig python3-itsdangerous python3-packaging python3-pluggy 141s python3-pycryptodome python3-pytest python3-pytest-asyncio 141s python3-pytest-django python3-sniffio python3-sqlalchemy python3-sqlparse 141s python3-starlette python3-werkzeug 141s Suggested packages: 141s python-cachelib-doc bpython3 geoip-database-contrib gettext ipython3 141s libgdal20 libsqlite3-mod-spatialite python-django-doc python3-bcrypt 141s python3-flup python3-memcache python3-mysqldb python3-pil python3-psycopg2 141s python3-selenium python3-sqlite python3-dotenv python-flask-doc 141s python-greenlet-dev python-greenlet-doc python-sqlalchemy-doc python3-fdb 141s python3-pymssql python3-asyncpg python3-aiosqlite python-sqlparse-doc 141s python3-databases python-werkzeug-doc python3-lxml python3-watchdog 141s Recommended packages: 141s javascript-common python3-simplejson python3-sqlalchemy-ext python3-uvicorn 141s | python3-daphne python3-aiofiles python3-multipart python3-pyinotify 141s The following NEW packages will be installed: 141s autopkgtest-satdep libjs-jquery python3-all python3-anyio python3-asgiref 141s python3-async-generator python3-authlib python3-cachelib python3-click 141s python3-colorama python3-django python3-flask python3-flask-sqlalchemy 141s python3-greenlet python3-h11 python3-httpcore python3-httpx 141s python3-iniconfig python3-itsdangerous python3-packaging python3-pluggy 141s python3-pycryptodome python3-pytest python3-pytest-asyncio 141s python3-pytest-django python3-sniffio python3-sqlalchemy python3-sqlparse 141s python3-starlette python3-werkzeug 141s 0 upgraded, 30 newly installed, 0 to remove and 0 not upgraded. 141s Need to get 6795 kB/6796 kB of archives. 141s After this operation, 44.2 MB of additional disk space will be used. 141s Get:1 /tmp/autopkgtest.Cn7AhT/1-autopkgtest-satdep.deb autopkgtest-satdep amd64 0 [808 B] 141s Get:2 http://ftpmaster.internal/ubuntu oracular/main amd64 libjs-jquery all 3.6.1+dfsg+~3.5.14-1 [328 kB] 141s Get:3 http://ftpmaster.internal/ubuntu oracular/main amd64 python3-all amd64 3.12.3-0ubuntu1 [888 B] 141s Get:4 http://ftpmaster.internal/ubuntu oracular/universe amd64 python3-sniffio all 1.3.1-1 [7262 B] 141s Get:5 http://ftpmaster.internal/ubuntu oracular/universe amd64 python3-anyio all 4.3.0-1 [56.6 kB] 141s Get:6 http://ftpmaster.internal/ubuntu oracular/main amd64 python3-asgiref all 3.8.1-1 [24.8 kB] 141s Get:7 http://ftpmaster.internal/ubuntu oracular/universe amd64 python3-async-generator all 1.10-4 [17.5 kB] 141s Get:8 http://ftpmaster.internal/ubuntu oracular/universe amd64 python3-pycryptodome amd64 3.20.0+dfsg-1 [1089 kB] 141s Get:9 http://ftpmaster.internal/ubuntu oracular/universe amd64 python3-authlib all 1.3.1-1 [112 kB] 141s Get:10 http://ftpmaster.internal/ubuntu oracular/universe amd64 python3-cachelib all 0.13.0-2 [20.7 kB] 141s Get:11 http://ftpmaster.internal/ubuntu oracular/main amd64 python3-colorama all 0.4.6-4 [32.1 kB] 141s Get:12 http://ftpmaster.internal/ubuntu oracular/main amd64 python3-click all 8.1.7-1 [79.1 kB] 141s Get:13 http://ftpmaster.internal/ubuntu oracular/main amd64 python3-sqlparse all 0.5.0-1 [32.4 kB] 141s Get:14 http://ftpmaster.internal/ubuntu oracular/main amd64 python3-django all 3:4.2.13-1 [2919 kB] 141s Get:15 http://ftpmaster.internal/ubuntu oracular/main amd64 python3-itsdangerous all 2.2.0-1 [15.2 kB] 141s Get:16 http://ftpmaster.internal/ubuntu oracular/main amd64 python3-werkzeug all 3.0.3-1 [170 kB] 141s Get:17 http://ftpmaster.internal/ubuntu oracular/main amd64 python3-flask all 3.0.3-1ubuntu1 [83.2 kB] 141s Get:18 http://ftpmaster.internal/ubuntu oracular/main amd64 python3-greenlet amd64 3.0.3-0ubuntu5 [154 kB] 141s Get:19 http://ftpmaster.internal/ubuntu oracular/main amd64 python3-sqlalchemy all 1.4.50+ds1-1build1 [1020 kB] 141s Get:20 http://ftpmaster.internal/ubuntu oracular/universe amd64 python3-flask-sqlalchemy all 3.0.3-1 [30.9 kB] 141s Get:21 http://ftpmaster.internal/ubuntu oracular/universe amd64 python3-h11 all 0.14.0-1 [51.1 kB] 141s Get:22 http://ftpmaster.internal/ubuntu oracular/universe amd64 python3-httpcore all 1.0.4-1 [38.8 kB] 141s Get:23 http://ftpmaster.internal/ubuntu oracular-proposed/universe amd64 python3-httpx all 0.27.0-1 [60.9 kB] 141s Get:24 http://ftpmaster.internal/ubuntu oracular/universe amd64 python3-iniconfig all 1.1.1-2 [6024 B] 141s Get:25 http://ftpmaster.internal/ubuntu oracular/main amd64 python3-packaging all 24.0-1 [41.1 kB] 141s Get:26 http://ftpmaster.internal/ubuntu oracular/universe amd64 python3-pluggy all 1.5.0-1 [21.0 kB] 141s Get:27 http://ftpmaster.internal/ubuntu oracular/universe amd64 python3-pytest all 7.4.4-1 [305 kB] 141s Get:28 http://ftpmaster.internal/ubuntu oracular/universe amd64 python3-pytest-asyncio all 0.20.3-1.3 [10.7 kB] 141s Get:29 http://ftpmaster.internal/ubuntu oracular/universe amd64 python3-pytest-django all 4.5.2-3 [18.5 kB] 141s Get:30 http://ftpmaster.internal/ubuntu oracular/universe amd64 python3-starlette all 0.31.1-1 [49.4 kB] 142s Fetched 6795 kB in 0s (20.8 MB/s) 142s Selecting previously unselected package libjs-jquery. 142s (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 ... 74430 files and directories currently installed.) 142s Preparing to unpack .../00-libjs-jquery_3.6.1+dfsg+~3.5.14-1_all.deb ... 142s Unpacking libjs-jquery (3.6.1+dfsg+~3.5.14-1) ... 142s Selecting previously unselected package python3-all. 142s Preparing to unpack .../01-python3-all_3.12.3-0ubuntu1_amd64.deb ... 142s Unpacking python3-all (3.12.3-0ubuntu1) ... 142s Selecting previously unselected package python3-sniffio. 142s Preparing to unpack .../02-python3-sniffio_1.3.1-1_all.deb ... 142s Unpacking python3-sniffio (1.3.1-1) ... 142s Selecting previously unselected package python3-anyio. 142s Preparing to unpack .../03-python3-anyio_4.3.0-1_all.deb ... 142s Unpacking python3-anyio (4.3.0-1) ... 142s Selecting previously unselected package python3-asgiref. 142s Preparing to unpack .../04-python3-asgiref_3.8.1-1_all.deb ... 142s Unpacking python3-asgiref (3.8.1-1) ... 142s Selecting previously unselected package python3-async-generator. 142s Preparing to unpack .../05-python3-async-generator_1.10-4_all.deb ... 142s Unpacking python3-async-generator (1.10-4) ... 142s Selecting previously unselected package python3-pycryptodome. 142s Preparing to unpack .../06-python3-pycryptodome_3.20.0+dfsg-1_amd64.deb ... 142s Unpacking python3-pycryptodome (3.20.0+dfsg-1) ... 142s Selecting previously unselected package python3-authlib. 142s Preparing to unpack .../07-python3-authlib_1.3.1-1_all.deb ... 142s Unpacking python3-authlib (1.3.1-1) ... 142s Selecting previously unselected package python3-cachelib. 142s Preparing to unpack .../08-python3-cachelib_0.13.0-2_all.deb ... 142s Unpacking python3-cachelib (0.13.0-2) ... 142s Selecting previously unselected package python3-colorama. 142s Preparing to unpack .../09-python3-colorama_0.4.6-4_all.deb ... 142s Unpacking python3-colorama (0.4.6-4) ... 142s Selecting previously unselected package python3-click. 142s Preparing to unpack .../10-python3-click_8.1.7-1_all.deb ... 142s Unpacking python3-click (8.1.7-1) ... 142s Selecting previously unselected package python3-sqlparse. 142s Preparing to unpack .../11-python3-sqlparse_0.5.0-1_all.deb ... 142s Unpacking python3-sqlparse (0.5.0-1) ... 142s Selecting previously unselected package python3-django. 142s Preparing to unpack .../12-python3-django_3%3a4.2.13-1_all.deb ... 142s Unpacking python3-django (3:4.2.13-1) ... 143s Selecting previously unselected package python3-itsdangerous. 143s Preparing to unpack .../13-python3-itsdangerous_2.2.0-1_all.deb ... 143s Unpacking python3-itsdangerous (2.2.0-1) ... 143s Selecting previously unselected package python3-werkzeug. 143s Preparing to unpack .../14-python3-werkzeug_3.0.3-1_all.deb ... 143s Unpacking python3-werkzeug (3.0.3-1) ... 143s Selecting previously unselected package python3-flask. 143s Preparing to unpack .../15-python3-flask_3.0.3-1ubuntu1_all.deb ... 143s Unpacking python3-flask (3.0.3-1ubuntu1) ... 143s Selecting previously unselected package python3-greenlet. 143s Preparing to unpack .../16-python3-greenlet_3.0.3-0ubuntu5_amd64.deb ... 143s Unpacking python3-greenlet (3.0.3-0ubuntu5) ... 143s Selecting previously unselected package python3-sqlalchemy. 143s Preparing to unpack .../17-python3-sqlalchemy_1.4.50+ds1-1build1_all.deb ... 143s Unpacking python3-sqlalchemy (1.4.50+ds1-1build1) ... 143s Selecting previously unselected package python3-flask-sqlalchemy. 143s Preparing to unpack .../18-python3-flask-sqlalchemy_3.0.3-1_all.deb ... 143s Unpacking python3-flask-sqlalchemy (3.0.3-1) ... 143s Selecting previously unselected package python3-h11. 143s Preparing to unpack .../19-python3-h11_0.14.0-1_all.deb ... 143s Unpacking python3-h11 (0.14.0-1) ... 143s Selecting previously unselected package python3-httpcore. 143s Preparing to unpack .../20-python3-httpcore_1.0.4-1_all.deb ... 143s Unpacking python3-httpcore (1.0.4-1) ... 143s Selecting previously unselected package python3-httpx. 143s Preparing to unpack .../21-python3-httpx_0.27.0-1_all.deb ... 143s Unpacking python3-httpx (0.27.0-1) ... 143s Selecting previously unselected package python3-iniconfig. 144s Preparing to unpack .../22-python3-iniconfig_1.1.1-2_all.deb ... 144s Unpacking python3-iniconfig (1.1.1-2) ... 144s Selecting previously unselected package python3-packaging. 144s Preparing to unpack .../23-python3-packaging_24.0-1_all.deb ... 144s Unpacking python3-packaging (24.0-1) ... 144s Selecting previously unselected package python3-pluggy. 144s Preparing to unpack .../24-python3-pluggy_1.5.0-1_all.deb ... 144s Unpacking python3-pluggy (1.5.0-1) ... 144s Selecting previously unselected package python3-pytest. 144s Preparing to unpack .../25-python3-pytest_7.4.4-1_all.deb ... 144s Unpacking python3-pytest (7.4.4-1) ... 144s Selecting previously unselected package python3-pytest-asyncio. 144s Preparing to unpack .../26-python3-pytest-asyncio_0.20.3-1.3_all.deb ... 144s Unpacking python3-pytest-asyncio (0.20.3-1.3) ... 144s Selecting previously unselected package python3-pytest-django. 144s Preparing to unpack .../27-python3-pytest-django_4.5.2-3_all.deb ... 144s Unpacking python3-pytest-django (4.5.2-3) ... 144s Selecting previously unselected package python3-starlette. 144s Preparing to unpack .../28-python3-starlette_0.31.1-1_all.deb ... 144s Unpacking python3-starlette (0.31.1-1) ... 144s Selecting previously unselected package autopkgtest-satdep. 144s Preparing to unpack .../29-1-autopkgtest-satdep.deb ... 144s Unpacking autopkgtest-satdep (0) ... 144s Setting up python3-iniconfig (1.1.1-2) ... 144s Setting up python3-sniffio (1.3.1-1) ... 144s Setting up python3-async-generator (1.10-4) ... 144s Setting up python3-anyio (4.3.0-1) ... 144s Setting up python3-colorama (0.4.6-4) ... 144s Setting up python3-pycryptodome (3.20.0+dfsg-1) ... 145s Setting up python3-itsdangerous (2.2.0-1) ... 145s Setting up python3-all (3.12.3-0ubuntu1) ... 145s Setting up python3-starlette (0.31.1-1) ... 145s Setting up python3-click (8.1.7-1) ... 145s Setting up python3-packaging (24.0-1) ... 145s Setting up python3-sqlparse (0.5.0-1) ... 146s Setting up python3-greenlet (3.0.3-0ubuntu5) ... 146s Setting up python3-h11 (0.14.0-1) ... 146s Setting up python3-pluggy (1.5.0-1) ... 146s Setting up python3-cachelib (0.13.0-2) ... 146s Setting up libjs-jquery (3.6.1+dfsg+~3.5.14-1) ... 146s Setting up python3-asgiref (3.8.1-1) ... 146s Setting up python3-authlib (1.3.1-1) ... 146s Setting up python3-httpcore (1.0.4-1) ... 147s Setting up python3-django (3:4.2.13-1) ... 148s Setting up python3-pytest (7.4.4-1) ... 148s Setting up python3-pytest-django (4.5.2-3) ... 148s Setting up python3-sqlalchemy (1.4.50+ds1-1build1) ... 149s Setting up python3-httpx (0.27.0-1) ... 149s Setting up python3-werkzeug (3.0.3-1) ... 150s Setting up python3-pytest-asyncio (0.20.3-1.3) ... 150s Setting up python3-flask (3.0.3-1ubuntu1) ... 150s Setting up python3-flask-sqlalchemy (3.0.3-1) ... 150s Setting up autopkgtest-satdep (0) ... 150s Processing triggers for man-db (2.12.1-2) ... 153s (Reading database ... 82266 files and directories currently installed.) 153s Removing autopkgtest-satdep (0) ... 153s autopkgtest [10:24:19]: test unittests3: [----------------------- 153s === python3.12 === 153s ============================= test session starts ============================== 153s platform linux -- Python 3.12.4, pytest-7.4.4, pluggy-1.5.0 153s rootdir: /tmp/autopkgtest.Cn7AhT/autopkgtest_tmp 153s configfile: setup.cfg 153s plugins: anyio-4.3.0, django-4.5.2, asyncio-0.20.3 153s asyncio: mode=Mode.STRICT 153s collected 101 items 153s 153s tests/core/test_oauth2/test_rfc6749_misc.py ...... [ 5%] 154s tests/core/test_oauth2/test_rfc7523.py ........................ [ 29%] 154s tests/core/test_oauth2/test_rfc7591.py ...... [ 35%] 154s tests/core/test_oauth2/test_rfc7662.py ...... [ 41%] 154s tests/core/test_oauth2/test_rfc8414.py .......................... [ 67%] 154s tests/core/test_oidc/test_core.py .......... [ 77%] 154s tests/core/test_oidc/test_discovery.py ....................... [100%] 154s 154s ============================= 101 passed in 0.54s ============================== 155s ============================= test session starts ============================== 155s platform linux -- Python 3.12.4, pytest-7.4.4, pluggy-1.5.0 155s django: settings: tests.clients.test_django.settings (from env) 155s rootdir: /tmp/autopkgtest.Cn7AhT/autopkgtest_tmp 155s configfile: setup.cfg 155s plugins: anyio-4.3.0, django-4.5.2, asyncio-0.20.3 155s asyncio: mode=Mode.STRICT 155s collected 167 items 155s 155s tests/clients/test_django/test_oauth_client.py ............. [ 7%] 155s tests/clients/test_flask/test_oauth_client.py .................... [ 19%] 155s tests/clients/test_flask/test_user_mixin.py ..... [ 22%] 155s tests/clients/test_httpx/test_assertion_client.py .. [ 23%] 156s tests/clients/test_httpx/test_async_assertion_client.py F. [ 25%] 159s tests/clients/test_httpx/test_async_oauth1_client.py FFFFFFF [ 29%] 166s tests/clients/test_httpx/test_async_oauth2_client.py FFFFFFss...FFFFFFF. [ 40%] 167s FFFFF. [ 44%] 167s tests/clients/test_httpx/test_oauth1_client.py ....... [ 48%] 168s tests/clients/test_httpx/test_oauth2_client.py ...................... [ 61%] 168s tests/clients/test_requests/test_assertion_session.py .. [ 62%] 168s tests/clients/test_requests/test_oauth1_session.py ................ [ 72%] 168s tests/clients/test_requests/test_oauth2_session.py ..................... [ 85%] 168s ......... [ 90%] 169s tests/clients/test_starlette/test_oauth_client.py ...FF.FFFF.F [ 97%] 170s tests/clients/test_starlette/test_user_mixin.py F..F [100%] 170s 170s =================================== FAILURES =================================== 170s ______________________________ test_refresh_token ______________________________ 170s 170s @contextlib.contextmanager 170s def map_httpcore_exceptions() -> typing.Iterator[None]: 170s try: 170s > yield 170s 170s /usr/lib/python3/dist-packages/httpx/_transports/default.py:69: 170s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 170s /usr/lib/python3/dist-packages/httpx/_transports/default.py:373: in handle_async_request 170s resp = await self._pool.handle_async_request(req) 170s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:216: in handle_async_request 170s raise exc from None 170s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:196: in handle_async_request 170s response = await connection.handle_async_request( 170s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 170s 170s self = 170s request = 170s 170s async def handle_async_request(self, request: Request) -> Response: 170s timeouts = request.extensions.get("timeout", {}) 170s timeout = timeouts.get("connect", None) 170s 170s async with self._connect_lock: 170s if not self._connected: 170s target = b"%b:%d" % (self._remote_origin.host, self._remote_origin.port) 170s 170s connect_url = URL( 170s scheme=self._proxy_origin.scheme, 170s host=self._proxy_origin.host, 170s port=self._proxy_origin.port, 170s target=target, 170s ) 170s connect_headers = merge_headers( 170s [(b"Host", target), (b"Accept", b"*/*")], self._proxy_headers 170s ) 170s connect_request = Request( 170s method=b"CONNECT", 170s url=connect_url, 170s headers=connect_headers, 170s extensions=request.extensions, 170s ) 170s connect_response = await self._connection.handle_async_request( 170s connect_request 170s ) 170s 170s if connect_response.status < 200 or connect_response.status > 299: 170s reason_bytes = connect_response.extensions.get("reason_phrase", b"") 170s reason_str = reason_bytes.decode("ascii", errors="ignore") 170s msg = "%d %s" % (connect_response.status, reason_str) 170s await self._connection.aclose() 170s > raise ProxyError(msg) 170s E httpcore.ProxyError: 503 Service Unavailable 170s 170s /usr/lib/python3/dist-packages/httpcore/_async/http_proxy.py:298: ProxyError 170s 170s The above exception was the direct cause of the following exception: 170s 170s @pytest.mark.asyncio 170s async def test_refresh_token(): 170s async def verifier(request): 170s content = await request.body() 170s if str(request.url) == 'https://i.b/token': 170s assert b'assertion=' in content 170s 170s async with AsyncAssertionClient( 170s 'https://i.b/token', 170s grant_type=AsyncAssertionClient.JWT_BEARER_GRANT_TYPE, 170s issuer='foo', 170s subject='foo', 170s audience='foo', 170s alg='HS256', 170s key='secret', 170s app=AsyncMockDispatch(default_token, assert_func=verifier) 170s ) as client: 170s > await client.get('https://i.b') 170s 170s tests/clients/test_httpx/test_async_assertion_client.py:33: 170s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 170s /usr/lib/python3/dist-packages/httpx/_client.py:1801: in get 170s return await self.request( 170s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/assertion_client.py:38: in request 170s await self.refresh_token() 170s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/assertion_client.py:45: in _refresh_token 170s resp = await self.request( 170s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/assertion_client.py:41: in request 170s return await super().request( 170s /usr/lib/python3/dist-packages/httpx/_client.py:1574: in request 170s return await self.send(request, auth=auth, follow_redirects=follow_redirects) 170s /usr/lib/python3/dist-packages/httpx/_client.py:1661: in send 170s response = await self._send_handling_auth( 170s /usr/lib/python3/dist-packages/httpx/_client.py:1689: in _send_handling_auth 170s response = await self._send_handling_redirects( 170s /usr/lib/python3/dist-packages/httpx/_client.py:1726: in _send_handling_redirects 170s response = await self._send_single_request(request) 170s /usr/lib/python3/dist-packages/httpx/_client.py:1763: in _send_single_request 170s response = await transport.handle_async_request(request) 170s /usr/lib/python3/dist-packages/httpx/_transports/default.py:372: in handle_async_request 170s with map_httpcore_exceptions(): 170s /usr/lib/python3.12/contextlib.py:158: in __exit__ 170s self.gen.throw(value) 170s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 170s 170s @contextlib.contextmanager 170s def map_httpcore_exceptions() -> typing.Iterator[None]: 170s try: 170s yield 170s except Exception as exc: 170s mapped_exc = None 170s 170s for from_exc, to_exc in HTTPCORE_EXC_MAP.items(): 170s if not isinstance(exc, from_exc): 170s continue 170s # We want to map to the most specific exception we can find. 170s # Eg if `exc` is an `httpcore.ReadTimeout`, we want to map to 170s # `httpx.ReadTimeout`, not just `httpx.TimeoutException`. 170s if mapped_exc is None or issubclass(to_exc, mapped_exc): 170s mapped_exc = to_exc 170s 170s if mapped_exc is None: # pragma: no cover 170s raise 170s 170s message = str(exc) 170s > raise mapped_exc(message) from exc 170s E httpx.ProxyError: 503 Service Unavailable 170s 170s /usr/lib/python3/dist-packages/httpx/_transports/default.py:86: ProxyError 170s _____________________ test_fetch_request_token_via_header ______________________ 170s 170s @pytest.mark.asyncio 170s async def test_fetch_request_token_via_header(): 170s request_token = {'oauth_token': '1', 'oauth_token_secret': '2'} 170s 170s async def assert_func(request): 170s auth_header = request.headers.get('authorization') 170s assert 'oauth_consumer_key="id"' in auth_header 170s assert 'oauth_signature=' in auth_header 170s 170s app = AsyncMockDispatch(request_token, assert_func=assert_func) 170s async with AsyncOAuth1Client('id', 'secret', app=app) as client: 170s > response = await client.fetch_request_token(oauth_url) 170s 170s tests/clients/test_httpx/test_async_oauth1_client.py:24: 170s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 170s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth1_client.py:70: in _fetch_token 170s token = self.parse_response_token(resp.status_code, to_unicode(text)) 170s /usr/lib/python3/dist-packages/authlib/oauth1/client.py:152: in parse_response_token 170s self.handle_error('fetch_token_denied', message) 170s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 170s 170s error_type = 'fetch_token_denied' 170s error_description = 'Token request failed with code 404, response was \'\n\n\t\t\n\t\n\n\'.' 170s 170s @staticmethod 170s def handle_error(error_type, error_description): 170s > raise OAuthError(error_type, error_description) 170s E authlib.integrations.base_client.errors.OAuthError: fetch_token_denied: Token request failed with code 404, response was ' 170s E 170s E 170s E 170s E 404 - Not Found 170s E 170s E 170s E

404 - Not Found

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

404 - Not Found

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

404 - Not Found

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

404 - Not Found

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

More information...

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