From bf307e3240f9a63914a4a09785b5dd4c9fb644d6 Mon Sep 17 00:00:00 2001 From: Alexander Koshevoy Date: Thu, 18 Aug 2016 19:19:09 +0300 Subject: [PATCH] Improve tests coverage Related: #921 --- tests/test_web_urldispatcher.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/test_web_urldispatcher.py b/tests/test_web_urldispatcher.py index a3d82d0addf..5859de19c89 100644 --- a/tests/test_web_urldispatcher.py +++ b/tests/test_web_urldispatcher.py @@ -123,6 +123,26 @@ def test_unauthorized_folder_access(tmp_dir_path, create_app_and_client): yield from r.release() +@pytest.mark.run_loop +def test_access_symlink_loop(tmp_dir_path, create_app_and_client): + """ + Tests the access to a looped symlink, which could not be resolved. + """ + my_dir_path = os.path.join(tmp_dir_path, 'my_symlink') + os.symlink(my_dir_path, my_dir_path) + + app, client = yield from create_app_and_client() + + # Register global static route: + app.router.add_static('/', tmp_dir_path, show_index=True) + + # Request the root of the static directory. + r = yield from client.get('/my_symlink') + assert r.status == 404 + + yield from r.release() + + @pytest.mark.run_loop def test_partialy_applied_handler(create_app_and_client): app, client = yield from create_app_and_client()