0s autopkgtest [16:08:05]: starting date and time: 2024-07-26 16:08:05+0000 0s autopkgtest [16:08:05]: git checkout: fd3bed09 nova: allow more retries for quota issues 0s autopkgtest [16:08:05]: host juju-7f2275-prod-proposed-migration-environment-2; command line: /home/ubuntu/autopkgtest/runner/autopkgtest --output-dir /tmp/autopkgtest-work.vd9s852d/out --timeout-copy=6000 -a i386 --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-59.secgroup --name adt-oracular-i386-python-authlib-20240726-160804-juju-7f2275-prod-proposed-migration-environment-2-1a26a3c4-6f1a-4838-802d-90f6e4981b99 --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/ 78s autopkgtest [16:09:23]: testbed dpkg architecture: amd64 78s autopkgtest [16:09:23]: testbed apt version: 2.9.6 78s autopkgtest [16:09:23]: test architecture: i386 78s autopkgtest [16:09:23]: @@@@@@@@@@@@@@@@@@@@ test bed setup 78s Get:1 http://ftpmaster.internal/ubuntu oracular-proposed InRelease [126 kB] 79s Get:2 http://ftpmaster.internal/ubuntu oracular-proposed/main Sources [50.6 kB] 79s Get:3 http://ftpmaster.internal/ubuntu oracular-proposed/universe Sources [436 kB] 79s Get:4 http://ftpmaster.internal/ubuntu oracular-proposed/multiverse Sources [4288 B] 79s Get:5 http://ftpmaster.internal/ubuntu oracular-proposed/restricted Sources [8548 B] 79s Get:6 http://ftpmaster.internal/ubuntu oracular-proposed/main amd64 Packages [94.8 kB] 79s Get:7 http://ftpmaster.internal/ubuntu oracular-proposed/main i386 Packages [53.4 kB] 79s Get:8 http://ftpmaster.internal/ubuntu oracular-proposed/main amd64 c-n-f Metadata [2116 B] 79s Get:9 http://ftpmaster.internal/ubuntu oracular-proposed/restricted amd64 Packages [34.9 kB] 79s Get:10 http://ftpmaster.internal/ubuntu oracular-proposed/restricted i386 Packages [6244 B] 79s Get:11 http://ftpmaster.internal/ubuntu oracular-proposed/restricted amd64 c-n-f Metadata [368 B] 79s Get:12 http://ftpmaster.internal/ubuntu oracular-proposed/universe i386 Packages [296 kB] 79s Get:13 http://ftpmaster.internal/ubuntu oracular-proposed/universe amd64 Packages [498 kB] 79s Get:14 http://ftpmaster.internal/ubuntu oracular-proposed/universe amd64 c-n-f Metadata [9900 B] 79s Get:15 http://ftpmaster.internal/ubuntu oracular-proposed/multiverse amd64 Packages [8792 B] 79s Get:16 http://ftpmaster.internal/ubuntu oracular-proposed/multiverse i386 Packages [3052 B] 79s Get:17 http://ftpmaster.internal/ubuntu oracular-proposed/multiverse amd64 c-n-f Metadata [276 B] 80s Fetched 1634 kB in 0s (3886 kB/s) 80s Reading package lists... 82s Reading package lists... 82s Building dependency tree... 82s Reading state information... 83s Calculating upgrade... 83s The following packages will be upgraded: 83s bpfcc-tools bpftrace libbpfcc liblz4-1 mawk python3-bpfcc 83s 6 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 83s Need to get 13.9 MB of archives. 83s After this operation, 37.8 MB of additional disk space will be used. 83s Get:1 http://ftpmaster.internal/ubuntu oracular/main amd64 liblz4-1 amd64 1.9.4-3 [63.1 kB] 83s Get:2 http://ftpmaster.internal/ubuntu oracular/main amd64 mawk amd64 1.3.4.20240622-2 [127 kB] 83s Get:3 http://ftpmaster.internal/ubuntu oracular/main amd64 libbpfcc amd64 0.30.0+ds-1ubuntu2 [644 kB] 83s Get:4 http://ftpmaster.internal/ubuntu oracular/main amd64 python3-bpfcc all 0.30.0+ds-1ubuntu2 [40.3 kB] 83s Get:5 http://ftpmaster.internal/ubuntu oracular/main amd64 bpfcc-tools all 0.30.0+ds-1ubuntu2 [697 kB] 83s Get:6 http://ftpmaster.internal/ubuntu oracular/main amd64 bpftrace amd64 0.21.0-1ubuntu6 [12.3 MB] 83s Fetched 13.9 MB in 0s (93.1 MB/s) 84s (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 ... 74523 files and directories currently installed.) 84s Preparing to unpack .../liblz4-1_1.9.4-3_amd64.deb ... 84s Unpacking liblz4-1:amd64 (1.9.4-3) over (1.9.4-2) ... 84s Setting up liblz4-1:amd64 (1.9.4-3) ... 84s (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 ... 74523 files and directories currently installed.) 84s Preparing to unpack .../mawk_1.3.4.20240622-2_amd64.deb ... 84s Unpacking mawk (1.3.4.20240622-2) over (1.3.4.20240622-1) ... 84s Preparing to unpack .../libbpfcc_0.30.0+ds-1ubuntu2_amd64.deb ... 84s Unpacking libbpfcc:amd64 (0.30.0+ds-1ubuntu2) over (0.29.1+ds-1ubuntu7) ... 84s Preparing to unpack .../python3-bpfcc_0.30.0+ds-1ubuntu2_all.deb ... 84s Unpacking python3-bpfcc (0.30.0+ds-1ubuntu2) over (0.29.1+ds-1ubuntu7) ... 84s Preparing to unpack .../bpfcc-tools_0.30.0+ds-1ubuntu2_all.deb ... 84s Unpacking bpfcc-tools (0.30.0+ds-1ubuntu2) over (0.29.1+ds-1ubuntu7) ... 84s Preparing to unpack .../bpftrace_0.21.0-1ubuntu6_amd64.deb ... 84s Unpacking bpftrace (0.21.0-1ubuntu6) over (0.20.2-1ubuntu4) ... 85s Setting up mawk (1.3.4.20240622-2) ... 85s Setting up libbpfcc:amd64 (0.30.0+ds-1ubuntu2) ... 85s Setting up python3-bpfcc (0.30.0+ds-1ubuntu2) ... 85s Setting up bpftrace (0.21.0-1ubuntu6) ... 85s Setting up bpfcc-tools (0.30.0+ds-1ubuntu2) ... 85s Processing triggers for man-db (2.12.1-2) ... 86s Processing triggers for libc-bin (2.39-0ubuntu9) ... 87s Reading package lists... 87s Building dependency tree... 87s Reading state information... 87s 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 88s Hit:1 http://ftpmaster.internal/ubuntu oracular-proposed InRelease 88s Hit:2 http://ftpmaster.internal/ubuntu oracular InRelease 88s Hit:3 http://ftpmaster.internal/ubuntu oracular-updates InRelease 88s Hit:4 http://ftpmaster.internal/ubuntu oracular-security InRelease 89s Reading package lists... 89s Reading package lists... 89s Building dependency tree... 89s Reading state information... 90s Calculating upgrade... 90s 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 90s Reading package lists... 90s Building dependency tree... 90s Reading state information... 91s 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 92s autopkgtest [16:09:37]: testbed running kernel: Linux 6.8.0-31-generic #31-Ubuntu SMP PREEMPT_DYNAMIC Sat Apr 20 00:40:06 UTC 2024 92s autopkgtest [16:09:37]: @@@@@@@@@@@@@@@@@@@@ apt-source python-authlib 94s Get:1 http://ftpmaster.internal/ubuntu oracular/universe python-authlib 1.3.1-1 (dsc) [2494 B] 94s Get:2 http://ftpmaster.internal/ubuntu oracular/universe python-authlib 1.3.1-1 (tar) [320 kB] 94s Get:3 http://ftpmaster.internal/ubuntu oracular/universe python-authlib 1.3.1-1 (diff) [5564 B] 94s gpgv: Signature made Thu Jun 6 10:39:37 2024 UTC 94s gpgv: using EDDSA key EE9AD6F90520FA11F69F4824477B0DB0263A54D8 94s gpgv: issuer "stefanor@debian.org" 94s gpgv: Can't check signature: No public key 94s dpkg-source: warning: cannot verify inline signature for ./python-authlib_1.3.1-1.dsc: no acceptable signature found 94s autopkgtest [16:09:39]: testing package python-authlib version 1.3.1-1 94s autopkgtest [16:09:39]: build not needed 95s autopkgtest [16:09:40]: test unittests3: preparing testbed 98s Note, using file '/tmp/autopkgtest.xLNTUB/1-autopkgtest-satdep.dsc' to get the build dependencies 98s Reading package lists... 99s Building dependency tree... 99s Reading state information... 99s Starting pkgProblemResolver with broken count: 0 99s Starting 2 pkgProblemResolver with broken count: 0 99s Done 100s The following NEW packages will be installed: 100s build-essential cpp cpp-14 cpp-14-x86-64-linux-gnu cpp-x86-64-linux-gnu g++ 100s g++-14 g++-14-x86-64-linux-gnu g++-x86-64-linux-gnu gcc gcc-14 100s gcc-14-x86-64-linux-gnu gcc-x86-64-linux-gnu libasan8 libatomic1 libcc1-0 100s libgcc-14-dev libhwasan0 libisl23 libitm1 libjs-jquery liblsan0 libmpc3 100s libquadmath0 libstdc++-14-dev libtsan2 libubsan1 python3-all python3-anyio 100s python3-asgiref python3-async-generator python3-authlib python3-cachelib 100s python3-click python3-colorama python3-django python3-flask 100s python3-flask-sqlalchemy python3-greenlet python3-h11 python3-httpcore 100s python3-httpx python3-iniconfig python3-itsdangerous python3-packaging 100s python3-pluggy python3-pycryptodome python3-pytest python3-pytest-asyncio 100s python3-pytest-django python3-sniffio python3-sqlalchemy python3-sqlparse 100s python3-starlette python3-werkzeug 100s 0 upgraded, 55 newly installed, 0 to remove and 0 not upgraded. 100s Need to get 72.1 MB of archives. 100s After this operation, 266 MB of additional disk space will be used. 100s Get:1 http://ftpmaster.internal/ubuntu oracular/main amd64 libisl23 amd64 0.26-3build1 [680 kB] 100s Get:2 http://ftpmaster.internal/ubuntu oracular/main amd64 libmpc3 amd64 1.3.1-1build1 [54.5 kB] 100s Get:3 http://ftpmaster.internal/ubuntu oracular/main amd64 cpp-14-x86-64-linux-gnu amd64 14.1.0-5ubuntu1 [11.9 MB] 100s Get:4 http://ftpmaster.internal/ubuntu oracular/main amd64 cpp-14 amd64 14.1.0-5ubuntu1 [1030 B] 100s Get:5 http://ftpmaster.internal/ubuntu oracular/main amd64 cpp-x86-64-linux-gnu amd64 4:14.1.0-2ubuntu1 [5452 B] 100s Get:6 http://ftpmaster.internal/ubuntu oracular/main amd64 cpp amd64 4:14.1.0-2ubuntu1 [22.4 kB] 100s Get:7 http://ftpmaster.internal/ubuntu oracular/main amd64 libcc1-0 amd64 14.1.0-5ubuntu1 [47.6 kB] 100s Get:8 http://ftpmaster.internal/ubuntu oracular/main amd64 libitm1 amd64 14.1.0-5ubuntu1 [29.1 kB] 100s Get:9 http://ftpmaster.internal/ubuntu oracular/main amd64 libatomic1 amd64 14.1.0-5ubuntu1 [10.3 kB] 100s Get:10 http://ftpmaster.internal/ubuntu oracular/main amd64 libasan8 amd64 14.1.0-5ubuntu1 [2997 kB] 100s Get:11 http://ftpmaster.internal/ubuntu oracular/main amd64 liblsan0 amd64 14.1.0-5ubuntu1 [1317 kB] 100s Get:12 http://ftpmaster.internal/ubuntu oracular/main amd64 libtsan2 amd64 14.1.0-5ubuntu1 [2733 kB] 100s Get:13 http://ftpmaster.internal/ubuntu oracular/main amd64 libubsan1 amd64 14.1.0-5ubuntu1 [1178 kB] 100s Get:14 http://ftpmaster.internal/ubuntu oracular/main amd64 libhwasan0 amd64 14.1.0-5ubuntu1 [1634 kB] 100s Get:15 http://ftpmaster.internal/ubuntu oracular/main amd64 libquadmath0 amd64 14.1.0-5ubuntu1 [153 kB] 100s Get:16 http://ftpmaster.internal/ubuntu oracular/main amd64 libgcc-14-dev amd64 14.1.0-5ubuntu1 [2813 kB] 100s Get:17 http://ftpmaster.internal/ubuntu oracular/main amd64 gcc-14-x86-64-linux-gnu amd64 14.1.0-5ubuntu1 [23.4 MB] 100s Get:18 http://ftpmaster.internal/ubuntu oracular/main amd64 gcc-14 amd64 14.1.0-5ubuntu1 [516 kB] 100s Get:19 http://ftpmaster.internal/ubuntu oracular/main amd64 gcc-x86-64-linux-gnu amd64 4:14.1.0-2ubuntu1 [1214 B] 100s Get:20 http://ftpmaster.internal/ubuntu oracular/main amd64 gcc amd64 4:14.1.0-2ubuntu1 [5000 B] 100s Get:21 http://ftpmaster.internal/ubuntu oracular/main amd64 libstdc++-14-dev amd64 14.1.0-5ubuntu1 [2476 kB] 100s Get:22 http://ftpmaster.internal/ubuntu oracular/main amd64 g++-14-x86-64-linux-gnu amd64 14.1.0-5ubuntu1 [13.4 MB] 100s Get:23 http://ftpmaster.internal/ubuntu oracular/main amd64 g++-14 amd64 14.1.0-5ubuntu1 [18.0 kB] 100s Get:24 http://ftpmaster.internal/ubuntu oracular/main amd64 g++-x86-64-linux-gnu amd64 4:14.1.0-2ubuntu1 [966 B] 100s Get:25 http://ftpmaster.internal/ubuntu oracular/main amd64 g++ amd64 4:14.1.0-2ubuntu1 [1100 B] 100s Get:26 http://ftpmaster.internal/ubuntu oracular/main amd64 build-essential amd64 12.10ubuntu1 [4928 B] 100s Get:27 http://ftpmaster.internal/ubuntu oracular/main amd64 libjs-jquery all 3.6.1+dfsg+~3.5.14-1 [328 kB] 100s Get:28 http://ftpmaster.internal/ubuntu oracular/main amd64 python3-all amd64 3.12.3-0ubuntu1 [888 B] 100s Get:29 http://ftpmaster.internal/ubuntu oracular/universe amd64 python3-sniffio all 1.3.1-1 [7262 B] 100s Get:30 http://ftpmaster.internal/ubuntu oracular/universe amd64 python3-anyio all 4.3.0-1 [56.6 kB] 100s Get:31 http://ftpmaster.internal/ubuntu oracular/main amd64 python3-asgiref all 3.8.1-1 [24.8 kB] 100s Get:32 http://ftpmaster.internal/ubuntu oracular/universe amd64 python3-async-generator all 1.10-4 [17.5 kB] 100s Get:33 http://ftpmaster.internal/ubuntu oracular/universe amd64 python3-pycryptodome amd64 3.20.0+dfsg-1 [1089 kB] 100s Get:34 http://ftpmaster.internal/ubuntu oracular/universe amd64 python3-authlib all 1.3.1-1 [112 kB] 100s Get:35 http://ftpmaster.internal/ubuntu oracular/universe amd64 python3-cachelib all 0.13.0-2 [20.7 kB] 100s Get:36 http://ftpmaster.internal/ubuntu oracular/main amd64 python3-colorama all 0.4.6-4 [32.1 kB] 100s Get:37 http://ftpmaster.internal/ubuntu oracular/main amd64 python3-click all 8.1.7-1 [79.1 kB] 100s Get:38 http://ftpmaster.internal/ubuntu oracular/main amd64 python3-sqlparse all 0.5.1-1 [32.6 kB] 100s Get:39 http://ftpmaster.internal/ubuntu oracular/main amd64 python3-django all 3:4.2.14-1 [2917 kB] 100s Get:40 http://ftpmaster.internal/ubuntu oracular/main amd64 python3-itsdangerous all 2.2.0-1 [15.2 kB] 100s Get:41 http://ftpmaster.internal/ubuntu oracular/main amd64 python3-werkzeug all 3.0.3-1 [170 kB] 100s Get:42 http://ftpmaster.internal/ubuntu oracular/main amd64 python3-flask all 3.0.3-1ubuntu1 [83.2 kB] 100s Get:43 http://ftpmaster.internal/ubuntu oracular/main amd64 python3-greenlet amd64 3.0.3-0ubuntu5 [154 kB] 100s Get:44 http://ftpmaster.internal/ubuntu oracular/main amd64 python3-sqlalchemy all 1.4.50+ds1-1build1 [1020 kB] 100s Get:45 http://ftpmaster.internal/ubuntu oracular/universe amd64 python3-flask-sqlalchemy all 3.0.3-1 [30.9 kB] 100s Get:46 http://ftpmaster.internal/ubuntu oracular/universe amd64 python3-h11 all 0.14.0-1 [51.1 kB] 100s Get:47 http://ftpmaster.internal/ubuntu oracular/universe amd64 python3-httpcore all 1.0.4-1 [38.8 kB] 100s Get:48 http://ftpmaster.internal/ubuntu oracular-proposed/universe amd64 python3-httpx all 0.27.0-1 [60.9 kB] 100s Get:49 http://ftpmaster.internal/ubuntu oracular/universe amd64 python3-iniconfig all 1.1.1-2 [6024 B] 100s Get:50 http://ftpmaster.internal/ubuntu oracular/main amd64 python3-packaging all 24.1-1 [41.4 kB] 100s Get:51 http://ftpmaster.internal/ubuntu oracular/universe amd64 python3-pluggy all 1.5.0-1 [21.0 kB] 100s Get:52 http://ftpmaster.internal/ubuntu oracular/universe amd64 python3-pytest all 7.4.4-1 [305 kB] 100s Get:53 http://ftpmaster.internal/ubuntu oracular/universe amd64 python3-pytest-asyncio all 0.20.3-1.3 [10.7 kB] 100s Get:54 http://ftpmaster.internal/ubuntu oracular/universe amd64 python3-pytest-django all 4.5.2-3 [18.5 kB] 100s Get:55 http://ftpmaster.internal/ubuntu oracular/universe amd64 python3-starlette all 0.31.1-1 [49.4 kB] 101s Fetched 72.1 MB in 1s (102 MB/s) 101s Selecting previously unselected package libisl23:amd64. 101s (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 ... 74530 files and directories currently installed.) 101s Preparing to unpack .../00-libisl23_0.26-3build1_amd64.deb ... 101s Unpacking libisl23:amd64 (0.26-3build1) ... 101s Selecting previously unselected package libmpc3:amd64. 101s Preparing to unpack .../01-libmpc3_1.3.1-1build1_amd64.deb ... 101s Unpacking libmpc3:amd64 (1.3.1-1build1) ... 101s Selecting previously unselected package cpp-14-x86-64-linux-gnu. 101s Preparing to unpack .../02-cpp-14-x86-64-linux-gnu_14.1.0-5ubuntu1_amd64.deb ... 101s Unpacking cpp-14-x86-64-linux-gnu (14.1.0-5ubuntu1) ... 101s Selecting previously unselected package cpp-14. 101s Preparing to unpack .../03-cpp-14_14.1.0-5ubuntu1_amd64.deb ... 101s Unpacking cpp-14 (14.1.0-5ubuntu1) ... 101s Selecting previously unselected package cpp-x86-64-linux-gnu. 101s Preparing to unpack .../04-cpp-x86-64-linux-gnu_4%3a14.1.0-2ubuntu1_amd64.deb ... 101s Unpacking cpp-x86-64-linux-gnu (4:14.1.0-2ubuntu1) ... 101s Selecting previously unselected package cpp. 101s Preparing to unpack .../05-cpp_4%3a14.1.0-2ubuntu1_amd64.deb ... 101s Unpacking cpp (4:14.1.0-2ubuntu1) ... 101s Selecting previously unselected package libcc1-0:amd64. 101s Preparing to unpack .../06-libcc1-0_14.1.0-5ubuntu1_amd64.deb ... 101s Unpacking libcc1-0:amd64 (14.1.0-5ubuntu1) ... 101s Selecting previously unselected package libitm1:amd64. 101s Preparing to unpack .../07-libitm1_14.1.0-5ubuntu1_amd64.deb ... 101s Unpacking libitm1:amd64 (14.1.0-5ubuntu1) ... 101s Selecting previously unselected package libatomic1:amd64. 101s Preparing to unpack .../08-libatomic1_14.1.0-5ubuntu1_amd64.deb ... 101s Unpacking libatomic1:amd64 (14.1.0-5ubuntu1) ... 101s Selecting previously unselected package libasan8:amd64. 101s Preparing to unpack .../09-libasan8_14.1.0-5ubuntu1_amd64.deb ... 101s Unpacking libasan8:amd64 (14.1.0-5ubuntu1) ... 101s Selecting previously unselected package liblsan0:amd64. 101s Preparing to unpack .../10-liblsan0_14.1.0-5ubuntu1_amd64.deb ... 101s Unpacking liblsan0:amd64 (14.1.0-5ubuntu1) ... 101s Selecting previously unselected package libtsan2:amd64. 101s Preparing to unpack .../11-libtsan2_14.1.0-5ubuntu1_amd64.deb ... 101s Unpacking libtsan2:amd64 (14.1.0-5ubuntu1) ... 101s Selecting previously unselected package libubsan1:amd64. 101s Preparing to unpack .../12-libubsan1_14.1.0-5ubuntu1_amd64.deb ... 101s Unpacking libubsan1:amd64 (14.1.0-5ubuntu1) ... 101s Selecting previously unselected package libhwasan0:amd64. 102s Preparing to unpack .../13-libhwasan0_14.1.0-5ubuntu1_amd64.deb ... 102s Unpacking libhwasan0:amd64 (14.1.0-5ubuntu1) ... 102s Selecting previously unselected package libquadmath0:amd64. 102s Preparing to unpack .../14-libquadmath0_14.1.0-5ubuntu1_amd64.deb ... 102s Unpacking libquadmath0:amd64 (14.1.0-5ubuntu1) ... 102s Selecting previously unselected package libgcc-14-dev:amd64. 102s Preparing to unpack .../15-libgcc-14-dev_14.1.0-5ubuntu1_amd64.deb ... 102s Unpacking libgcc-14-dev:amd64 (14.1.0-5ubuntu1) ... 102s Selecting previously unselected package gcc-14-x86-64-linux-gnu. 102s Preparing to unpack .../16-gcc-14-x86-64-linux-gnu_14.1.0-5ubuntu1_amd64.deb ... 102s Unpacking gcc-14-x86-64-linux-gnu (14.1.0-5ubuntu1) ... 102s Selecting previously unselected package gcc-14. 102s Preparing to unpack .../17-gcc-14_14.1.0-5ubuntu1_amd64.deb ... 102s Unpacking gcc-14 (14.1.0-5ubuntu1) ... 102s Selecting previously unselected package gcc-x86-64-linux-gnu. 102s Preparing to unpack .../18-gcc-x86-64-linux-gnu_4%3a14.1.0-2ubuntu1_amd64.deb ... 102s Unpacking gcc-x86-64-linux-gnu (4:14.1.0-2ubuntu1) ... 102s Selecting previously unselected package gcc. 102s Preparing to unpack .../19-gcc_4%3a14.1.0-2ubuntu1_amd64.deb ... 102s Unpacking gcc (4:14.1.0-2ubuntu1) ... 102s Selecting previously unselected package libstdc++-14-dev:amd64. 102s Preparing to unpack .../20-libstdc++-14-dev_14.1.0-5ubuntu1_amd64.deb ... 102s Unpacking libstdc++-14-dev:amd64 (14.1.0-5ubuntu1) ... 102s Selecting previously unselected package g++-14-x86-64-linux-gnu. 102s Preparing to unpack .../21-g++-14-x86-64-linux-gnu_14.1.0-5ubuntu1_amd64.deb ... 102s Unpacking g++-14-x86-64-linux-gnu (14.1.0-5ubuntu1) ... 103s Selecting previously unselected package g++-14. 103s Preparing to unpack .../22-g++-14_14.1.0-5ubuntu1_amd64.deb ... 103s Unpacking g++-14 (14.1.0-5ubuntu1) ... 103s Selecting previously unselected package g++-x86-64-linux-gnu. 103s Preparing to unpack .../23-g++-x86-64-linux-gnu_4%3a14.1.0-2ubuntu1_amd64.deb ... 103s Unpacking g++-x86-64-linux-gnu (4:14.1.0-2ubuntu1) ... 103s Selecting previously unselected package g++. 103s Preparing to unpack .../24-g++_4%3a14.1.0-2ubuntu1_amd64.deb ... 103s Unpacking g++ (4:14.1.0-2ubuntu1) ... 103s Selecting previously unselected package build-essential. 103s Preparing to unpack .../25-build-essential_12.10ubuntu1_amd64.deb ... 103s Unpacking build-essential (12.10ubuntu1) ... 103s Selecting previously unselected package libjs-jquery. 103s Preparing to unpack .../26-libjs-jquery_3.6.1+dfsg+~3.5.14-1_all.deb ... 103s Unpacking libjs-jquery (3.6.1+dfsg+~3.5.14-1) ... 103s Selecting previously unselected package python3-all. 103s Preparing to unpack .../27-python3-all_3.12.3-0ubuntu1_amd64.deb ... 103s Unpacking python3-all (3.12.3-0ubuntu1) ... 103s Selecting previously unselected package python3-sniffio. 103s Preparing to unpack .../28-python3-sniffio_1.3.1-1_all.deb ... 103s Unpacking python3-sniffio (1.3.1-1) ... 103s Selecting previously unselected package python3-anyio. 103s Preparing to unpack .../29-python3-anyio_4.3.0-1_all.deb ... 103s Unpacking python3-anyio (4.3.0-1) ... 103s Selecting previously unselected package python3-asgiref. 103s Preparing to unpack .../30-python3-asgiref_3.8.1-1_all.deb ... 103s Unpacking python3-asgiref (3.8.1-1) ... 103s Selecting previously unselected package python3-async-generator. 103s Preparing to unpack .../31-python3-async-generator_1.10-4_all.deb ... 103s Unpacking python3-async-generator (1.10-4) ... 103s Selecting previously unselected package python3-pycryptodome. 103s Preparing to unpack .../32-python3-pycryptodome_3.20.0+dfsg-1_amd64.deb ... 103s Unpacking python3-pycryptodome (3.20.0+dfsg-1) ... 103s Selecting previously unselected package python3-authlib. 103s Preparing to unpack .../33-python3-authlib_1.3.1-1_all.deb ... 103s Unpacking python3-authlib (1.3.1-1) ... 103s Selecting previously unselected package python3-cachelib. 103s Preparing to unpack .../34-python3-cachelib_0.13.0-2_all.deb ... 103s Unpacking python3-cachelib (0.13.0-2) ... 103s Selecting previously unselected package python3-colorama. 103s Preparing to unpack .../35-python3-colorama_0.4.6-4_all.deb ... 103s Unpacking python3-colorama (0.4.6-4) ... 103s Selecting previously unselected package python3-click. 103s Preparing to unpack .../36-python3-click_8.1.7-1_all.deb ... 103s Unpacking python3-click (8.1.7-1) ... 103s Selecting previously unselected package python3-sqlparse. 103s Preparing to unpack .../37-python3-sqlparse_0.5.1-1_all.deb ... 103s Unpacking python3-sqlparse (0.5.1-1) ... 103s Selecting previously unselected package python3-django. 103s Preparing to unpack .../38-python3-django_3%3a4.2.14-1_all.deb ... 103s Unpacking python3-django (3:4.2.14-1) ... 104s Selecting previously unselected package python3-itsdangerous. 104s Preparing to unpack .../39-python3-itsdangerous_2.2.0-1_all.deb ... 104s Unpacking python3-itsdangerous (2.2.0-1) ... 104s Selecting previously unselected package python3-werkzeug. 104s Preparing to unpack .../40-python3-werkzeug_3.0.3-1_all.deb ... 104s Unpacking python3-werkzeug (3.0.3-1) ... 104s Selecting previously unselected package python3-flask. 104s Preparing to unpack .../41-python3-flask_3.0.3-1ubuntu1_all.deb ... 104s Unpacking python3-flask (3.0.3-1ubuntu1) ... 104s Selecting previously unselected package python3-greenlet. 104s Preparing to unpack .../42-python3-greenlet_3.0.3-0ubuntu5_amd64.deb ... 104s Unpacking python3-greenlet (3.0.3-0ubuntu5) ... 104s Selecting previously unselected package python3-sqlalchemy. 104s Preparing to unpack .../43-python3-sqlalchemy_1.4.50+ds1-1build1_all.deb ... 104s Unpacking python3-sqlalchemy (1.4.50+ds1-1build1) ... 104s Selecting previously unselected package python3-flask-sqlalchemy. 104s Preparing to unpack .../44-python3-flask-sqlalchemy_3.0.3-1_all.deb ... 104s Unpacking python3-flask-sqlalchemy (3.0.3-1) ... 104s Selecting previously unselected package python3-h11. 104s Preparing to unpack .../45-python3-h11_0.14.0-1_all.deb ... 104s Unpacking python3-h11 (0.14.0-1) ... 104s Selecting previously unselected package python3-httpcore. 104s Preparing to unpack .../46-python3-httpcore_1.0.4-1_all.deb ... 104s Unpacking python3-httpcore (1.0.4-1) ... 105s Selecting previously unselected package python3-httpx. 105s Preparing to unpack .../47-python3-httpx_0.27.0-1_all.deb ... 105s Unpacking python3-httpx (0.27.0-1) ... 105s Selecting previously unselected package python3-iniconfig. 105s Preparing to unpack .../48-python3-iniconfig_1.1.1-2_all.deb ... 105s Unpacking python3-iniconfig (1.1.1-2) ... 105s Selecting previously unselected package python3-packaging. 105s Preparing to unpack .../49-python3-packaging_24.1-1_all.deb ... 105s Unpacking python3-packaging (24.1-1) ... 105s Selecting previously unselected package python3-pluggy. 105s Preparing to unpack .../50-python3-pluggy_1.5.0-1_all.deb ... 105s Unpacking python3-pluggy (1.5.0-1) ... 105s Selecting previously unselected package python3-pytest. 105s Preparing to unpack .../51-python3-pytest_7.4.4-1_all.deb ... 105s Unpacking python3-pytest (7.4.4-1) ... 105s Selecting previously unselected package python3-pytest-asyncio. 105s Preparing to unpack .../52-python3-pytest-asyncio_0.20.3-1.3_all.deb ... 105s Unpacking python3-pytest-asyncio (0.20.3-1.3) ... 105s Selecting previously unselected package python3-pytest-django. 105s Preparing to unpack .../53-python3-pytest-django_4.5.2-3_all.deb ... 105s Unpacking python3-pytest-django (4.5.2-3) ... 105s Selecting previously unselected package python3-starlette. 105s Preparing to unpack .../54-python3-starlette_0.31.1-1_all.deb ... 105s Unpacking python3-starlette (0.31.1-1) ... 105s Setting up python3-iniconfig (1.1.1-2) ... 105s Setting up python3-sniffio (1.3.1-1) ... 105s Setting up python3-async-generator (1.10-4) ... 105s Setting up python3-anyio (4.3.0-1) ... 105s Setting up python3-colorama (0.4.6-4) ... 106s Setting up python3-pycryptodome (3.20.0+dfsg-1) ... 106s Setting up python3-itsdangerous (2.2.0-1) ... 106s Setting up python3-all (3.12.3-0ubuntu1) ... 106s Setting up python3-starlette (0.31.1-1) ... 106s Setting up python3-click (8.1.7-1) ... 107s Setting up python3-packaging (24.1-1) ... 107s Setting up python3-sqlparse (0.5.1-1) ... 107s Setting up python3-greenlet (3.0.3-0ubuntu5) ... 107s Setting up libquadmath0:amd64 (14.1.0-5ubuntu1) ... 107s Setting up libmpc3:amd64 (1.3.1-1build1) ... 107s Setting up libatomic1:amd64 (14.1.0-5ubuntu1) ... 107s Setting up python3-h11 (0.14.0-1) ... 107s Setting up python3-pluggy (1.5.0-1) ... 107s Setting up libubsan1:amd64 (14.1.0-5ubuntu1) ... 107s Setting up libhwasan0:amd64 (14.1.0-5ubuntu1) ... 107s Setting up libasan8:amd64 (14.1.0-5ubuntu1) ... 107s Setting up python3-cachelib (0.13.0-2) ... 108s Setting up libtsan2:amd64 (14.1.0-5ubuntu1) ... 108s Setting up libjs-jquery (3.6.1+dfsg+~3.5.14-1) ... 108s Setting up libisl23:amd64 (0.26-3build1) ... 108s Setting up libcc1-0:amd64 (14.1.0-5ubuntu1) ... 108s Setting up liblsan0:amd64 (14.1.0-5ubuntu1) ... 108s Setting up libitm1:amd64 (14.1.0-5ubuntu1) ... 108s Setting up python3-asgiref (3.8.1-1) ... 108s Setting up python3-authlib (1.3.1-1) ... 108s Setting up python3-httpcore (1.0.4-1) ... 108s Setting up python3-django (3:4.2.14-1) ... 110s Setting up python3-pytest (7.4.4-1) ... 110s Setting up python3-pytest-django (4.5.2-3) ... 110s Setting up python3-sqlalchemy (1.4.50+ds1-1build1) ... 111s Setting up python3-httpx (0.27.0-1) ... 111s Setting up python3-werkzeug (3.0.3-1) ... 112s Setting up cpp-14-x86-64-linux-gnu (14.1.0-5ubuntu1) ... 112s Setting up cpp-14 (14.1.0-5ubuntu1) ... 112s Setting up python3-pytest-asyncio (0.20.3-1.3) ... 112s Setting up libgcc-14-dev:amd64 (14.1.0-5ubuntu1) ... 112s Setting up libstdc++-14-dev:amd64 (14.1.0-5ubuntu1) ... 112s Setting up cpp-x86-64-linux-gnu (4:14.1.0-2ubuntu1) ... 112s Setting up python3-flask (3.0.3-1ubuntu1) ... 112s Setting up cpp (4:14.1.0-2ubuntu1) ... 112s Setting up gcc-14-x86-64-linux-gnu (14.1.0-5ubuntu1) ... 112s Setting up python3-flask-sqlalchemy (3.0.3-1) ... 112s Setting up gcc-x86-64-linux-gnu (4:14.1.0-2ubuntu1) ... 112s Setting up gcc-14 (14.1.0-5ubuntu1) ... 112s Setting up g++-14-x86-64-linux-gnu (14.1.0-5ubuntu1) ... 112s Setting up g++-x86-64-linux-gnu (4:14.1.0-2ubuntu1) ... 112s Setting up g++-14 (14.1.0-5ubuntu1) ... 112s Setting up gcc (4:14.1.0-2ubuntu1) ... 112s Setting up g++ (4:14.1.0-2ubuntu1) ... 112s update-alternatives: using /usr/bin/g++ to provide /usr/bin/c++ (c++) in auto mode 112s Setting up build-essential (12.10ubuntu1) ... 112s Processing triggers for man-db (2.12.1-2) ... 113s Processing triggers for libc-bin (2.39-0ubuntu9) ... 113s Reading package lists... 114s Building dependency tree... 114s Reading state information... 114s Starting pkgProblemResolver with broken count: 0 114s Starting 2 pkgProblemResolver with broken count: 0 114s Done 115s The following NEW packages will be installed: 115s autopkgtest-satdep 115s 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. 115s Need to get 0 B/700 B of archives. 115s After this operation, 0 B of additional disk space will be used. 115s Get:1 /tmp/autopkgtest.xLNTUB/2-autopkgtest-satdep.deb autopkgtest-satdep amd64 0 [700 B] 115s Selecting previously unselected package autopkgtest-satdep. 115s (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 ... 83624 files and directories currently installed.) 115s Preparing to unpack .../2-autopkgtest-satdep.deb ... 115s Unpacking autopkgtest-satdep (0) ... 115s Setting up autopkgtest-satdep (0) ... 116s autopkgtest: WARNING: package python3-authlib:i386 is not installed though it should be 118s (Reading database ... 83624 files and directories currently installed.) 118s Removing autopkgtest-satdep (0) ... 118s autopkgtest [16:10:03]: test unittests3: [----------------------- 119s === python3.12 === 119s ============================= test session starts ============================== 119s platform linux -- Python 3.12.4, pytest-7.4.4, pluggy-1.5.0 119s rootdir: /tmp/autopkgtest.xLNTUB/autopkgtest_tmp 119s configfile: setup.cfg 119s plugins: asyncio-0.20.3, django-4.5.2, anyio-4.3.0 119s asyncio: mode=Mode.STRICT 119s collected 101 items 119s 119s tests/core/test_oauth2/test_rfc6749_misc.py ...... [ 5%] 119s tests/core/test_oauth2/test_rfc7523.py ........................ [ 29%] 119s tests/core/test_oauth2/test_rfc7591.py ...... [ 35%] 119s tests/core/test_oauth2/test_rfc7662.py ...... [ 41%] 119s tests/core/test_oauth2/test_rfc8414.py .......................... [ 67%] 119s tests/core/test_oidc/test_core.py .......... [ 77%] 120s tests/core/test_oidc/test_discovery.py ....................... [100%] 120s 120s ============================= 101 passed in 0.63s ============================== 121s ============================= test session starts ============================== 121s platform linux -- Python 3.12.4, pytest-7.4.4, pluggy-1.5.0 121s django: settings: tests.clients.test_django.settings (from env) 121s rootdir: /tmp/autopkgtest.xLNTUB/autopkgtest_tmp 121s configfile: setup.cfg 121s plugins: asyncio-0.20.3, django-4.5.2, anyio-4.3.0 121s asyncio: mode=Mode.STRICT 121s collected 167 items 121s 121s tests/clients/test_django/test_oauth_client.py ............. [ 7%] 121s tests/clients/test_flask/test_oauth_client.py .................... [ 19%] 121s tests/clients/test_flask/test_user_mixin.py ..... [ 22%] 121s tests/clients/test_httpx/test_assertion_client.py .. [ 23%] 121s tests/clients/test_httpx/test_async_assertion_client.py F. [ 25%] 124s tests/clients/test_httpx/test_async_oauth1_client.py FFFFFFF [ 29%] 128s tests/clients/test_httpx/test_async_oauth2_client.py FFFFFFss...FFFFFFF. [ 40%] 129s FFFFF. [ 44%] 129s tests/clients/test_httpx/test_oauth1_client.py ....... [ 48%] 129s tests/clients/test_httpx/test_oauth2_client.py ...................... [ 61%] 129s tests/clients/test_requests/test_assertion_session.py .. [ 62%] 129s tests/clients/test_requests/test_oauth1_session.py ................ [ 72%] 129s tests/clients/test_requests/test_oauth2_session.py ..................... [ 85%] 130s ......... [ 90%] 131s tests/clients/test_starlette/test_oauth_client.py ...FF.FFFF.F [ 97%] 131s tests/clients/test_starlette/test_user_mixin.py F..F [100%] 131s 131s =================================== FAILURES =================================== 131s ______________________________ test_refresh_token ______________________________ 131s 131s @contextlib.contextmanager 131s def map_httpcore_exceptions() -> typing.Iterator[None]: 131s try: 131s > yield 131s 131s /usr/lib/python3/dist-packages/httpx/_transports/default.py:69: 131s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 131s /usr/lib/python3/dist-packages/httpx/_transports/default.py:373: in handle_async_request 131s resp = await self._pool.handle_async_request(req) 131s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:216: in handle_async_request 131s raise exc from None 131s /usr/lib/python3/dist-packages/httpcore/_async/connection_pool.py:196: in handle_async_request 131s response = await connection.handle_async_request( 131s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 131s 131s self = 131s request = 131s 131s async def handle_async_request(self, request: Request) -> Response: 131s timeouts = request.extensions.get("timeout", {}) 131s timeout = timeouts.get("connect", None) 131s 131s async with self._connect_lock: 131s if not self._connected: 131s target = b"%b:%d" % (self._remote_origin.host, self._remote_origin.port) 131s 131s connect_url = URL( 131s scheme=self._proxy_origin.scheme, 131s host=self._proxy_origin.host, 131s port=self._proxy_origin.port, 131s target=target, 131s ) 131s connect_headers = merge_headers( 131s [(b"Host", target), (b"Accept", b"*/*")], self._proxy_headers 131s ) 131s connect_request = Request( 131s method=b"CONNECT", 131s url=connect_url, 131s headers=connect_headers, 131s extensions=request.extensions, 131s ) 131s connect_response = await self._connection.handle_async_request( 131s connect_request 131s ) 131s 131s if connect_response.status < 200 or connect_response.status > 299: 131s reason_bytes = connect_response.extensions.get("reason_phrase", b"") 131s reason_str = reason_bytes.decode("ascii", errors="ignore") 131s msg = "%d %s" % (connect_response.status, reason_str) 131s await self._connection.aclose() 131s > raise ProxyError(msg) 131s E httpcore.ProxyError: 503 Service Unavailable 131s 131s /usr/lib/python3/dist-packages/httpcore/_async/http_proxy.py:298: ProxyError 131s 131s The above exception was the direct cause of the following exception: 131s 131s @pytest.mark.asyncio 131s async def test_refresh_token(): 131s async def verifier(request): 131s content = await request.body() 131s if str(request.url) == 'https://i.b/token': 131s assert b'assertion=' in content 131s 131s async with AsyncAssertionClient( 131s 'https://i.b/token', 131s grant_type=AsyncAssertionClient.JWT_BEARER_GRANT_TYPE, 131s issuer='foo', 131s subject='foo', 131s audience='foo', 131s alg='HS256', 131s key='secret', 131s app=AsyncMockDispatch(default_token, assert_func=verifier) 131s ) as client: 131s > await client.get('https://i.b') 131s 131s tests/clients/test_httpx/test_async_assertion_client.py:33: 131s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 131s /usr/lib/python3/dist-packages/httpx/_client.py:1801: in get 131s return await self.request( 131s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/assertion_client.py:38: in request 131s await self.refresh_token() 131s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/assertion_client.py:45: in _refresh_token 131s resp = await self.request( 131s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/assertion_client.py:41: in request 131s return await super().request( 131s /usr/lib/python3/dist-packages/httpx/_client.py:1574: in request 131s return await self.send(request, auth=auth, follow_redirects=follow_redirects) 131s /usr/lib/python3/dist-packages/httpx/_client.py:1661: in send 131s response = await self._send_handling_auth( 131s /usr/lib/python3/dist-packages/httpx/_client.py:1689: in _send_handling_auth 131s response = await self._send_handling_redirects( 131s /usr/lib/python3/dist-packages/httpx/_client.py:1726: in _send_handling_redirects 131s response = await self._send_single_request(request) 131s /usr/lib/python3/dist-packages/httpx/_client.py:1763: in _send_single_request 131s response = await transport.handle_async_request(request) 131s /usr/lib/python3/dist-packages/httpx/_transports/default.py:372: in handle_async_request 131s with map_httpcore_exceptions(): 131s /usr/lib/python3.12/contextlib.py:158: in __exit__ 131s self.gen.throw(value) 131s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 131s 131s @contextlib.contextmanager 131s def map_httpcore_exceptions() -> typing.Iterator[None]: 131s try: 131s yield 131s except Exception as exc: 131s mapped_exc = None 131s 131s for from_exc, to_exc in HTTPCORE_EXC_MAP.items(): 131s if not isinstance(exc, from_exc): 131s continue 131s # We want to map to the most specific exception we can find. 131s # Eg if `exc` is an `httpcore.ReadTimeout`, we want to map to 131s # `httpx.ReadTimeout`, not just `httpx.TimeoutException`. 131s if mapped_exc is None or issubclass(to_exc, mapped_exc): 131s mapped_exc = to_exc 131s 131s if mapped_exc is None: # pragma: no cover 131s raise 131s 131s message = str(exc) 131s > raise mapped_exc(message) from exc 131s E httpx.ProxyError: 503 Service Unavailable 131s 131s /usr/lib/python3/dist-packages/httpx/_transports/default.py:86: ProxyError 131s _____________________ test_fetch_request_token_via_header ______________________ 131s 131s @pytest.mark.asyncio 131s async def test_fetch_request_token_via_header(): 131s request_token = {'oauth_token': '1', 'oauth_token_secret': '2'} 131s 131s async def assert_func(request): 131s auth_header = request.headers.get('authorization') 131s assert 'oauth_consumer_key="id"' in auth_header 131s assert 'oauth_signature=' in auth_header 131s 131s app = AsyncMockDispatch(request_token, assert_func=assert_func) 131s async with AsyncOAuth1Client('id', 'secret', app=app) as client: 131s > response = await client.fetch_request_token(oauth_url) 131s 131s tests/clients/test_httpx/test_async_oauth1_client.py:24: 131s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 131s /usr/lib/python3/dist-packages/authlib/integrations/httpx_client/oauth1_client.py:70: in _fetch_token 131s token = self.parse_response_token(resp.status_code, to_unicode(text)) 131s /usr/lib/python3/dist-packages/authlib/oauth1/client.py:152: in parse_response_token 131s self.handle_error('fetch_token_denied', message) 131s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 131s 131s error_type = 'fetch_token_denied' 131s error_description = 'Token request failed with code 404, response was \'\n\n\t\t\n\t\n\n\'.' 131s 131s @staticmethod 131s def handle_error(error_type, error_description): 131s > raise OAuthError(error_type, error_description) 131s E authlib.integrations.base_client.errors.OAuthError: fetch_token_denied: Token request failed with code 404, response was ' 131s E 131s E 131s E 131s E 404 - Not Found 131s E 131s E 131s E

404 - Not Found

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

404 - Not Found

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

404 - Not Found

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

404 - Not Found

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

More information...

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