Exemple #1
0
 def test_delete(self):
     '''
     Test deleting a specific attribute from a file
     '''
     mock_cmd = MagicMock(return_value={'spongebob': 'squarepants'})
     with patch.object(xattr, 'list_', mock_cmd):
         self.assertTrue(xattr.delete('/path/to/file', 'attribute'))
Exemple #2
0
 def test_delete(self):
     '''
     Test deleting a specific attribute from a file
     '''
     mock_cmd = MagicMock(return_value={'spongebob': 'squarepants'})
     with patch.object(xattr, 'list_', mock_cmd):
         self.assertTrue(xattr.delete('/path/to/file', 'attribute'))
 def test_delete(self):
     """
     Test deleting a specific attribute from a file
     """
     mock_cmd = MagicMock(return_value={"spongebob": "squarepants"})
     with patch.object(xattr, "list_", mock_cmd), patch(
             "salt.utils.mac_utils.execute_return_success",
             MagicMock(return_value=True)):
         self.assertTrue(xattr.delete("/path/to/file", "attribute"))
Exemple #4
0
 def test_delete(self):
     '''
     Test deleting a specific attribute from a file
     '''
     mock_cmd = MagicMock(return_value={'spongebob': 'squarepants'})
     with patch.object(xattr, 'list_', mock_cmd), \
             patch('salt.utils.mac_utils.execute_return_success',
                   MagicMock(return_value=True)):
         self.assertTrue(xattr.delete('/path/to/file', 'attribute'))
    def test_delete_attrs(self):
        '''
            Test deleting a specific attribute from a file
        '''
        expected = "out"
        mock = MagicMock(return_value=expected)
        with patch.dict(xattr.__salt__, {'cmd.run': mock}):
            out = xattr.delete('/path/to/file', 'com.attr')

            mock.assert_called_once_with('xattr -d "com.attr" "/path/to/file"')
            self.assertEqual(out, expected)
Exemple #6
0
    def test_delete_attrs(self):
        '''
            Test deleting a specific attribute from a file
        '''
        expected = "out"
        mock = MagicMock(return_value=expected)
        with patch.dict(xattr.__salt__, {'cmd.run': mock}):
            out = xattr.delete('/path/to/file', 'com.attr')

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