test_urls: Remove dead URLResolutionTest.

This test was written back when Django accepted view function names as
strings that might be wrong; that’s not possible in Django ≥ 1.10.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2024-09-24 16:10:20 -07:00 committed by Tim Abbott
parent 76a602842d
commit 6c442273ee
2 changed files with 1 additions and 19 deletions

View File

@ -540,7 +540,7 @@ def write_instrumentation_reports(full_suite: bool, include_webhooks: bool) -> N
"docs/", "docs/",
"docs/(?P<path>.+)", "docs/(?P<path>.+)",
"casper/(?P<path>.+)", "casper/(?P<path>.+)",
"static/(?P<path>.+)", "static/(?P<path>.*)",
"flush_caches", "flush_caches",
"external_content/(?P<digest>[^/]+)/(?P<received_url>[^/]+)", "external_content/(?P<digest>[^/]+)/(?P<received_url>[^/]+)",
# Such endpoints are only used in certain test cases that can be skipped # Such endpoints are only used in certain test cases that can be skipped

View File

@ -1,8 +1,6 @@
import importlib
import os import os
from unittest import mock from unittest import mock
import django.urls.resolvers
from django.test import Client from django.test import Client
from zerver.lib.test_classes import ZulipTestCase from zerver.lib.test_classes import ZulipTestCase
@ -13,7 +11,6 @@ from zerver.lib.url_redirects import (
POLICY_DOCUMENTATION_REDIRECTS, POLICY_DOCUMENTATION_REDIRECTS,
) )
from zerver.models import Stream from zerver.models import Stream
from zproject import urls
class PublicURLTest(ZulipTestCase): class PublicURLTest(ZulipTestCase):
@ -158,21 +155,6 @@ class PublicURLTest(ZulipTestCase):
) )
class URLResolutionTest(ZulipTestCase):
def check_function_exists(self, module_name: str, view: str) -> None:
module = importlib.import_module(module_name)
self.assertTrue(hasattr(module, view), f"View {module_name}.{view} does not exist")
# Tests function-based views declared in urls.urlpatterns for
# whether the function exists. We at present do not test the
# class-based views.
def test_non_api_url_resolution(self) -> None:
for pattern in urls.urlpatterns:
if isinstance(pattern, django.urls.resolvers.URLPattern):
(module_name, base_view) = pattern.lookup_str.rsplit(".", 1)
self.check_function_exists(module_name, base_view)
class ErrorPageTest(ZulipTestCase): class ErrorPageTest(ZulipTestCase):
def test_bogus_http_host(self) -> None: def test_bogus_http_host(self) -> None:
# This tests that we've successfully worked around a certain bug in # This tests that we've successfully worked around a certain bug in