* Fix for StaticFiles(follow_symlinks=True, directory="some relative path") that stopped working with commit
eee4cdc
* Change test name
* Delete test parameter
---------
Co-authored-by: Bruno D. Rodrigues <bruno.rodrigues@bitsighttech.com>
Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>
joined_path = os.path.join(directory, path)
if self.follow_symlink:
full_path = os.path.abspath(joined_path)
+ directory = os.path.abspath(directory)
else:
full_path = os.path.realpath(joined_path)
directory = os.path.realpath(directory)
assert response.url == "http://testserver/index.html"
assert response.status_code == 200
assert response.text == "<h1>Hello</h1>"
+
+
+def test_staticfiles_relative_directory_symlinks(test_client_factory: TestClientFactory) -> None:
+ app = StaticFiles(directory="tests/statics", follow_symlink=True)
+ client = test_client_factory(app)
+ response = client.get("/example.txt")
+ assert response.status_code == 200
+ assert response.text == "123\n"