From 1fd6a668ef8b9a9638473b4f6813484065b120bd Mon Sep 17 00:00:00 2001 From: Santos Gallegos Date: Mon, 29 Aug 2022 19:43:37 -0500 Subject: [PATCH] Proxito: unskip test (#9559) Ref https://github.com/readthedocs/readthedocs.org/pull/9557 --- readthedocs/proxito/tests/handler_404_urls.py | 10 +++++++--- readthedocs/proxito/tests/test_old_redirects.py | 3 --- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/readthedocs/proxito/tests/handler_404_urls.py b/readthedocs/proxito/tests/handler_404_urls.py index f39180c8efb..cd36632cb70 100644 --- a/readthedocs/proxito/tests/handler_404_urls.py +++ b/readthedocs/proxito/tests/handler_404_urls.py @@ -21,14 +21,18 @@ def map_proxito_path(view_func): @wraps(view_func) - def inner_view(request, exception, *args, **kwargs): + def inner_view(request, *args, **kwargs): return view_func( request, - *args, proxito_path=request.path, - **kwargs, ) return inner_view handler404 = map_proxito_path(ServeError404.as_view()) + +# Patch URLs that call the `fast_404` view directly. +for pattern in urlpatterns: + if getattr(pattern, "name", None) == "docs_detail_directory_indexing": + pattern.callback = handler404 + break diff --git a/readthedocs/proxito/tests/test_old_redirects.py b/readthedocs/proxito/tests/test_old_redirects.py index 27588c2a237..334e080e5d3 100644 --- a/readthedocs/proxito/tests/test_old_redirects.py +++ b/readthedocs/proxito/tests/test_old_redirects.py @@ -374,9 +374,6 @@ def test_redirect_exact(self): 'http://project.dev.readthedocs.io/en/latest/tutorial/install.html', ) - @pytest.mark.xfail( - reason="This is hitting fast_404 and not triggering the nginx handler in testing. It works in prod." - ) def test_redirect_exact_looks_like_version(self): fixture.get( Redirect,