Add fix for relative paths in user files lookup and add test

This commit is contained in:
Joseph Schorr 2017-04-21 15:54:15 -04:00
parent e9672326a8
commit 4bb725dce0
2 changed files with 18 additions and 1 deletions

View 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