Esempio n. 1
0
 def test_clear(self):
     '''
     Test clearing all attributes on a file
     '''
     mock_cmd = MagicMock(return_value={})
     with patch.object(xattr, 'list_', mock_cmd):
         self.assertTrue(xattr.clear('/path/to/file'))
Esempio n. 2
0
 def test_clear(self):
     '''
     Test clearing all attributes on a file
     '''
     mock_cmd = MagicMock(return_value={})
     with patch.object(xattr, 'list_', mock_cmd):
         self.assertTrue(xattr.clear('/path/to/file'))
 def test_clear(self):
     """
     Test clearing all attributes on a file
     """
     mock_cmd = MagicMock(return_value={})
     with patch.object(xattr, "list_", mock_cmd), patch(
             "salt.utils.mac_utils.execute_return_success",
             MagicMock(return_value=True)):
         self.assertTrue(xattr.clear("/path/to/file"))
Esempio n. 4
0
 def test_clear(self):
     '''
     Test clearing all attributes on a file
     '''
     mock_cmd = MagicMock(return_value={})
     with patch.object(xattr, 'list_', mock_cmd), \
             patch('salt.utils.mac_utils.execute_return_success',
                   MagicMock(return_value=True)):
         self.assertTrue(xattr.clear('/path/to/file'))
Esempio n. 5
0
    def test_clear_attrs(self):
        '''
            Test clearing all attributes on a file
        '''
        expected = "out"
        mock = MagicMock(return_value=expected)
        with patch.dict(xattr.__salt__, {'cmd.run': mock}):
            out = xattr.clear('/path/to/file')

            mock.assert_called_once_with('xattr -c "/path/to/file"')
            self.assertEqual(out, expected)
Esempio n. 6
0
    def test_clear_attrs(self):
        '''
            Test clearing all attributes on a file
        '''
        expected = "out"
        mock = MagicMock(return_value=expected)
        with patch.dict(xattr.__salt__, {'cmd.run': mock}):
            out = xattr.clear('/path/to/file')

            mock.assert_called_once_with('xattr -c "/path/to/file"')
            self.assertEqual(out, expected)