Skip to content
Merged
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
16 changes: 8 additions & 8 deletions src/relay_minitest/conftest.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import ipaddress
import ssl

import pytest
Expand All @@ -15,14 +16,13 @@ def pytest_addoption(parser):


def get_ssl_context(maildomain):
if (
maildomain.startswith("_")
or maildomain.startswith("10.")
or maildomain.startswith("172.")
or maildomain.startswith("192.168.")
or maildomain == "localhost"
or maildomain == "127.0.0.1"
):
try:
ipaddress.ip_address(maildomain)
is_ip = True
except ValueError:
is_ip = False

if maildomain.startswith("_") or maildomain == "localhost" or is_ip:
ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE
Expand Down