diff --git a/readthedocs/rtd_tests/tests/test_domains.py b/readthedocs/rtd_tests/tests/test_domains.py index aa1077fdd56..9ad254b63b7 100644 --- a/readthedocs/rtd_tests/tests/test_domains.py +++ b/readthedocs/rtd_tests/tests/test_domains.py @@ -1,3 +1,6 @@ +from unittest import mock + +import dns.resolver from django.conf import settings from django.test import TestCase, override_settings from django_dynamic_fixture import get @@ -28,6 +31,12 @@ def test_save_parsing(self): self.assertEqual(domain.domain, "www.google.com") +# We are using random domain names to test the form validation, +# so we are mocking the DNS resolver to avoid making real DNS queries. +@mock.patch( + "readthedocs.projects.forms.dns.resolver.resolve", + new=mock.MagicMock(side_effect=dns.resolver.NoAnswer), +) class FormTests(TestCase): def setUp(self): self.project = get(Project, slug="kong")