aboutsummaryrefslogtreecommitdiff
path: root/tests/conftest.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/conftest.py')
-rw-r--r--tests/conftest.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/conftest.py b/tests/conftest.py
index 94ba650..f1ef4b5 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -18,6 +18,14 @@ HTTPHandler = Callable[
]
+class FakeHostAnswers:
+ def __init__(self, *addresses: str):
+ self._addresses = addresses
+
+ def addresses(self):
+ return iter(self._addresses)
+
+
@pytest.fixture
def app() -> Iterator[Flask]:
"""
@@ -101,6 +109,12 @@ def install_httpx_mock(
Replace the HTTPX transport without replacing HTTPX itself.
"""
+ monkeypatch.setattr(
+ receiver_module,
+ "ensure_public_url",
+ lambda url: None,
+ )
+
real_client = httpx.Client
def install(handler: HTTPHandler) -> None:
@@ -123,3 +137,13 @@ def install_httpx_mock(
)
return install
+
+
+@pytest.fixture
+def public_dns(
+ monkeypatch: pytest.MonkeyPatch,
+) -> None:
+ monkeypatch.setattr(
+ "webmentions_ssg.url_security.dns.resolver.resolve_name",
+ lambda hostname: FakeHostAnswers("93.184.216.34"),
+ )