예제 #1
0
 def test_with_negate_entries(self):
     self.fs._set_dir('/path/to/a/dir')
     self.fs._set_dir('/path/to/a/dir/d1/d2')
     config = {
         'location': '/path/to/a/dir',
         'base': 'd1/d2',
         'selection': ['!f1', '!f2']
     }
     v2.check_entries([config], self.fs)
예제 #2
0
 def test_not_has_no_path(self):
     self.fs._set_dir('/path/to/a/dir')
     self.fs._set_dir('/path/to/a/dir/d1/d2')
     config = {
         'location': '/path/to/a/dir',
         'base': 'd1/d2',
         'selection': ['!f1/f2']
     }
     with self.assertRaises(ValueError):
         v2.check_entries([config], self.fs)
예제 #3
0
 def test_entry_with_base(self):
     self.fs._set_dir('/path/to/a/dir')
     self.fs._set_dir('/path/to/a/dir/d1/d2')
     self.fs._set_dir('/path/to/a/dir/d1/d2/file')
     config = {
         'location': '/path/to/a/dir',
         'base': 'd1/d2',
         'selection': ['file']
     }
     v2.check_entries([config], self.fs)
예제 #4
0
 def test_with_base_and_invalid_entry(self):
     self.fs._set_dir('/the/real')
     self.fs._set_dir('/the/real/dir')
     self.fs._set_dir('/the/real/dir/valid')
     config = {
         'location': '/the/real',
         'base': 'dir',
         'selection': ['valid', 'invalid']
     }
     with self.assertRaises(ValueError):
         v2.check_entries([config], self.fs)
예제 #5
0
 def test_multiple_entries(self):
     self.fs._set_dir('/path/to/a/dir')
     self.fs._set_dir('/path/to/a/dir/d1/d2')
     self.fs._set_dir('/path/to/a/dir/d1/d2/f1')
     self.fs._set_dir('/path/to/a/dir/d1/d2/f2')
     config = {
         'location': '/path/to/a/dir',
         'base': 'd1/d2',
         'selection': ['f1', 'f2']
     }
     v2.check_entries([config], self.fs)
예제 #6
0
 def test_multiple_with_errors(self):
     self.fs._set_dir('/path/to/a/dir')
     self.fs._set_dir('/path/to/a/dir/d1/d2')
     self.fs._set_dir('/path/to/a/dir/d1/d2/f1')
     self.fs._set_dir('/path/to/a/dir/d1/d2/f2')
     configs = [{
         'location': '/path/to/a/dir',
         'base': 'd1/d2',
         'selection': ['f1', 'f2']
     }, {
         'location': '/path/to/a/dir',
         'base': 'd3',
         'selection': ['!f1', '!f2']
     }]
     with self.assertRaises(ValueError):
         v2.check_entries(configs, self.fs)
예제 #7
0
 def test_multiple_checks(self):
     self.fs._set_dir('/path/to/a/dir')
     self.fs._set_dir('/path/to/a/dir/d1/d2')
     self.fs._set_dir('/path/to/a/dir/d1/d2/f1')
     self.fs._set_dir('/path/to/a/dir/d1/d2/f2')
     self.fs._set_dir('/path/to/a/dir/d3')
     configs = [{
         'location': '/path/to/a/dir',
         'base': 'd1/d2',
         'selection': ['f1', 'f2']
     }, {
         'location': '/path/to/a/dir',
         'base': 'd3',
         'selection': ['!f1', '!f2']
     }]
     v2.check_entries(configs, self.fs)
예제 #8
0
 def test_with_invalid_base(self):
     self.fs._set_dir('/the/real/dir')
     config = {'location': '/the/real/dir', 'base': 'is/wrong'}
     with self.assertRaises(ValueError):
         v2.check_entries([config], self.fs)
예제 #9
0
 def test_with_invalid_location(self):
     config = {'location': '/not/a/dir'}
     with self.assertRaises(ValueError):
         v2.check_entries([config], self.fs)
예제 #10
0
 def test_simple_entry(self):
     self.fs._set_dir('/path/to/a/dir')
     self.fs._set_dir('/path/to/a/dir/file')
     config = {'location': '/path/to/a/dir', 'selection': ['file']}
     v2.check_entries([config], self.fs)