Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

patch httpretty to work with urllib3 2.3.0 #1009

Merged
merged 4 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

By confirming, you will grant {{ action_serializer.instance.token.owner.email }} (the "authorized party") permission to manage your DNS.

This permission is limited to domains that the authorized will create in your account. They will have permission to both modify and delete the domains created by them. If you create additional domains in your account by hand, they will not be visible to the authorized party.
This permission is limited to domains that the authorized party will create in your account. They will have permission to both modify and delete the domains created by them. If you create additional domains in your account by hand, they will not be visible to the authorized party.

If you ever would like to revoke this authorization, you can remove it in the "Token Management" section of our web interface. Authorization can also be withdrawn by the authorized party itself.

Expand Down
15 changes: 15 additions & 0 deletions api/desecapi/tests/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
import random
import re
import string
import urllib3
from contextlib import nullcontext
from functools import partial, reduce
from json import JSONDecodeError
from packaging.version import Version
from unittest import mock

from django.conf import settings
Expand All @@ -27,6 +29,19 @@
)


# patch httpretty against urllib3>=2.3.0 (https://github.com/gabrielfalcao/HTTPretty/issues/484)
# inspired by https://github.com/PyGithub/PyGithub/pull/3102/commits/10a7135a04f71e6101f8b013aded8a662d08fd1f
if Version(urllib3.__version__) >= Version("2.3.0"):
hr_core.fakesock.socket.__getattr__ = lambda self, name: (
None
if (
name == "shutdown"
and not (hr_core.httpretty.allow_net_connect or self.truesock)
)
else hr_core.fakesock.socket.__getattr__(self, name)
)


class DesecAPIClient(APIClient):
@staticmethod
def _http_header_base64_conversion(content):
Expand Down
3 changes: 2 additions & 1 deletion api/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
captcha~=0.6.0
celery~=5.4.0
coverage~=7.6.9
coverage~=7.6.10
cryptography~=44.0.0
Django~=5.1.4
django-cors-headers~=4.6.0
Expand All @@ -11,6 +11,7 @@ django-pgtrigger~=4.13.3
django-prometheus~=2.3.1
dnspython~=2.7.0
httpretty~=1.0.5 # 1.1 breaks tests. Does not run in production, so stick to it.
packaging~=24.2 # for patching httpretty depending on urllib3 version
pyotp~=2.9.0
psycopg~=3.2.3
psl-dns~=1.1.1
Expand Down
2 changes: 1 addition & 1 deletion www/webapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"eslint-plugin-vue-scoped-css": "^2.6.1",
"eslint-plugin-vuetify": "^1.1.0",
"sass": "~1.32.13",
"unplugin-vue-components": "^0.27.0",
"unplugin-vue-components": "^0.28.0",
"vite": "^5.0.10",
"vuetify-loader": "~1.9.1"
}
Expand Down
Loading