Ejemplo n.º 1
0
 def test_chmod_glob_modes(self):
     chmod('~/**', mode_file=0o660, mode_dir=0o770)
     self.normalize_path.assert_called_with('~/**')
     self.path.glob.assert_called_with('/home/test_user/**')
     for path in self.path.glob_data:
         if path.kwargs.get('is_file', False) is True:
             path.chmod.assert_called_with(0o660)
         elif path.kwargs.get('is_dir', False) is True:
             path.chmod.assert_called_with(0o770)
         elif path.kwargs.get('is_fifo', False) is True:
             path.chmod.assert_not_called()
Ejemplo n.º 2
0
 def test_chmod_directory_mode(self):
     chmod('~/tmp/test', mode_dir=0o770)
     self.normalize_path.assert_called_with('~/tmp/test')
     self.path.chmod.assert_called_with(0o770)
Ejemplo n.º 3
0
 def test_chmod_directory_default(self):
     chmod('~/tmp/test')
     self.normalize_path.assert_called_with('~/tmp/test')
     self.path.chmod.assert_called_with(0o700)
Ejemplo n.º 4
0
 def test_chmod_file_mode(self):
     chmod('~/tmp/test.txt', mode_file=0o777)
     self.normalize_path.assert_called_with('~/tmp/test.txt')
     self.path.chmod.assert_called_with(0o777)
Ejemplo n.º 5
0
 def test_chmod_file_default(self):
     chmod('~/tmp/test.txt')
     self.normalize_path.assert_called_with('~/tmp/test.txt')
     self.path.chmod.assert_called_with(0o600)
Ejemplo n.º 6
0
 def test_chmod_empty_glob(self):
     chmod('~/**', mode_file=0o660, mode_dir=0o770, include_parent=True)
     self.normalize_path.assert_called_with('~/**')
     self.path.glob.assert_called_with('/home/test_user/**')
     self.path.parent.chmod.assert_not_called()