def test_safe_bad_path(self): path = "/var/lib\\/test/p?!ath/fi\0lename.txt" expected = "/var/lib_/test/p__ath/fi_lename.txt" resp = reusables.safe_path(path) assert not [x for x in ("!", "?", "\0", "^", "&", "*") if x in resp], resp assert resp == expected, resp
def test_safe_bad_path(self): path = "/var/lib\\/test/p?!ath/fi\0lename.txt" expected = "/var/lib_/test/p__ath/fi_lename.txt" resp = reusables.safe_path(path) assert not [ x for x in ("!", "?", "\0", "^", "&", "*") if x in resp ], resp assert resp == expected, resp
def test_safe_good_path(self): path = "/var/lib/test/path/filename.txt" resp = reusables.safe_path(path) assert resp == path, resp
def test_path_single(self): resp = reusables.safe_path('path') assert resp == 'path', resp