コード例 #1
0
ファイル: test_mac_xattr.py プロジェクト: cldeluna/salt
 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'))
コード例 #2
0
ファイル: mac_xattr_test.py プロジェクト: bryson/salt
 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'))
コード例 #3
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"))
コード例 #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'))
コード例 #5
0
ファイル: mac_xattr_test.py プロジェクト: HowardMei/saltstack
    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)
コード例 #6
0
ファイル: mac_xattr_test.py プロジェクト: zhugehui9527/salt
    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)