示例#1
0
 def test_with_negated_entry(self):
     entry = v2.format_entry('../vdir', '~/dd:path/to/!f', self.fs)
     self.assertEqual(
         entry, {
             "location": f"{self.fs.home}/dd",
             "base": 'path/to',
             "selection": ['!f']
         })
示例#2
0
 def test_with_complex_entry_and_absolute_path(self):
     config = {
         "location": '/var',
         "base": 'log',
         "selection": ['nginx', 'apache']
     }
     entry = v2.format_entry('vdir', config, self.fs)
     self.assertEqual(entry, config)
示例#3
0
 def test_with_complex_entry_and_leading_base(self):
     config = {
         "location": '../path',
         "base": 'log',
         "selection": ['nginx', 'apache']
     }
     entry = v2.format_entry('to/vdir', config, self.fs)
     self.assertEqual(
         entry, {
             "location": '/a/b/c/to/path',
             "base": 'log',
             "selection": ['nginx', 'apache']
         })
示例#4
0
 def test_with_complex_entry_and_rewinding_path(self):
     config = {
         "location": '../../and/up/again',
         "base": 'log',
         "selection": ['nginx', 'apache']
     }
     entry = v2.format_entry('vdir', config, self.fs)
     self.assertEqual(
         entry, {
             "location": '/a/b/and/up/again',
             "base": 'log',
             "selection": ['nginx', 'apache']
         })
示例#5
0
 def test_with_complex_entry_and_relative_path(self):
     config = {
         "location": 'd',
         "base": 'log',
         "selection": ['nginx', 'apache']
     }
     entry = v2.format_entry('vdir', config, self.fs)
     self.assertEqual(
         entry, {
             "location": '/a/b/c/vdir/d',
             "base": 'log',
             "selection": ['nginx', 'apache']
         })
示例#6
0
 def test_with_complex_entry_and_user_path(self):
     config = {
         "location": '~/my/root',
         "base": 'log',
         "selection": ['nginx', 'apache']
     }
     entry = v2.format_entry('vdir', config, self.fs)
     self.assertEqual(
         entry, {
             "location": f"{self.fs.home}/my/root",
             "base": 'log',
             "selection": ['nginx', 'apache']
         })
示例#7
0
 def test_with_rewinding_base(self):
     entry = v2.format_entry('../vdir', '../path:target', self.fs)
     self.assertEqual(entry, simple_entry('/a/b/path', 'target'))
示例#8
0
 def test_with_rewinding_path(self):
     entry = v2.format_entry('vdir', '../../and/up/again:other', self.fs)
     self.assertEqual(entry, simple_entry('/a/b/and/up/again', 'other'))
示例#9
0
 def test_with_relative_path(self):
     entry = v2.format_entry('vdir', 'd:other', self.fs)
     self.assertEqual(entry, simple_entry('/a/b/c/vdir/d', 'other'))
示例#10
0
 def test_with_user_home(self):
     entry = v2.format_entry('vdir', '~/my/root:one/dir', self.fs)
     self.assertEqual(entry,
                      simple_entry(f"{self.fs.home}/my/root", 'one/dir'))
示例#11
0
 def test_with_absolute_path(self):
     entry = v2.format_entry('vdir', '/root/some/path:one/dir', self.fs)
     self.assertEqual(entry, simple_entry('/root/some/path', 'one/dir'))