Exemple #1
0
 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
Exemple #2
0
 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
Exemple #3
0
 def test_safe_good_path(self):
     path = "/var/lib/test/path/filename.txt"
     resp = reusables.safe_path(path)
     assert resp == path, resp
Exemple #4
0
 def test_path_single(self):
     resp = reusables.safe_path('path')
     assert resp == 'path', resp
Exemple #5
0
 def test_safe_good_path(self):
     path = "/var/lib/test/path/filename.txt"
     resp = reusables.safe_path(path)
     assert resp == path, resp
Exemple #6
0
 def test_path_single(self):
     resp = reusables.safe_path('path')
     assert resp == 'path', resp