From 3d5cb0a706b0fce89a7bb9b1f0d2ce0439e0c1c0 Mon Sep 17 00:00:00 2001 From: sambloomquist Date: Thu, 9 Nov 2023 20:08:02 -0600 Subject: [PATCH] test case for file not found --- tests/services/contents/test_manager.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/services/contents/test_manager.py b/tests/services/contents/test_manager.py index 7fa5cbd742..6f51952cfb 100644 --- a/tests/services/contents/test_manager.py +++ b/tests/services/contents/test_manager.py @@ -436,6 +436,15 @@ async def test_404(jp_file_contents_manager_class, tmp_path): except HTTPError as e: assert e.status_code == 404 + # Test file not found + td = str(tmp_path) + cm = jp_file_contents_manager_class(root_dir=td) + os_path = cm._get_os_path(td) + not_a_file = os.path.join(os_path, "foo.bar") + with pytest.raises(HTTPError) as excinfo: + result = await ensure_async(cm.get(not_a_file, "w")) + assert excinfo.value.status_code == 404 + async def test_escape_root(jp_file_contents_manager_class, tmp_path): td = str(tmp_path)