Add fix for relative paths in user files lookup and add test
This commit is contained in:
parent
e9672326a8
commit
4bb725dce0
2 changed files with 18 additions and 1 deletions
15
data/test/test_userfiles.py
Normal file
15
data/test/test_userfiles.py
Normal file
|
@ -0,0 +1,15 @@
|
|||
import pytest
|
||||
|
||||
from data.userfiles import DelegateUserfiles
|
||||
|
||||
@pytest.mark.parametrize('path,expected', [
|
||||
('foo', 'test/foo'),
|
||||
('bar', 'test/bar'),
|
||||
('/bar', 'test/bar'),
|
||||
('../foo', 'test/foo'),
|
||||
('foo/bar/baz', 'test/baz'),
|
||||
('foo/../baz', 'test/baz'),
|
||||
])
|
||||
def test_filepath(path, expected):
|
||||
userfiles = DelegateUserfiles(None, None, 'local_us', 'test')
|
||||
assert userfiles.get_file_id_path(path) == expected
|
Reference in a new issue