Merge pull request #784 from FozzieHi/fix-testing-warnings

Fix deprecation warnings.
This commit is contained in:
Son Nguyen Kim 2022-02-21 17:12:36 +01:00 committed by GitHub
commit e9d134fe8f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 9 deletions

View File

@ -23,7 +23,7 @@ def get_ns(hostname) -> [str]:
def get_cname_record(hostname) -> Optional[str]:
"""Return the CNAME record if exists for a domain, WITHOUT the trailing period at the end"""
try:
answers = _get_dns_resolver().query(hostname, "CNAME")
answers = _get_dns_resolver().resolve(hostname, "CNAME")
except Exception:
return None
@ -39,7 +39,7 @@ def get_mx_domains(hostname) -> [(int, str)]:
domain name ends with a "." at the end.
"""
try:
answers = _get_dns_resolver().query(hostname, "MX")
answers = _get_dns_resolver().resolve(hostname, "MX")
except Exception:
return []
@ -60,7 +60,7 @@ _include_spf = "include:"
def get_spf_domain(hostname) -> [str]:
"""return all domains listed in *include:*"""
try:
answers = _get_dns_resolver().query(hostname, "TXT")
answers = _get_dns_resolver().resolve(hostname, "TXT")
except Exception:
return []
@ -82,7 +82,7 @@ def get_spf_domain(hostname) -> [str]:
def get_txt_record(hostname) -> [str]:
"""return all domains listed in *include:*"""
try:
answers = _get_dns_resolver().query(hostname, "TXT")
answers = _get_dns_resolver().resolve(hostname, "TXT")
except Exception:
return []

View File

@ -1,5 +1,3 @@
from deprecated import deprecated
from flask import url_for
from app.config import PAGE_LIMIT
@ -9,7 +7,6 @@ from app.models import User, ApiKey, Alias, Contact, EmailLog, Mailbox
from tests.utils import login
@deprecated
def test_get_aliases_error_without_pagination(flask_client):
user = User.create(
email="a@b.c",
@ -31,7 +28,6 @@ def test_get_aliases_error_without_pagination(flask_client):
assert r.json["error"]
@deprecated
def test_get_aliases_with_pagination(flask_client):
user = User.create(
email="a@b.c",
@ -79,7 +75,6 @@ def test_get_aliases_with_pagination(flask_client):
assert len(r.json["aliases"]) == 2
@deprecated
def test_get_aliases_query(flask_client):
user = User.create(
email="a@b.c", password="password", name="Test User", activated=True