Exemplo n.º 1
0
    def test_remove_data(self, mock_remove, mock_path):
        cache = Cache('test')
        mock_path.return_value = 'existing_key_path'
        cache._remove_data('existing_key')
        mock_remove.assert_called_with('existing_key_path')

        mock_remove.reset_mock()
        mock_remove.side_effect = IOError('IO Error remove')
        self.assertRaises(IOError, cache._remove_data, 'existing_key')

        mock_remove.reset_mock()
        mock_remove.side_effect = OSError('OS Error remove')
        self.assertRaises(OSError, cache._remove_data, 'existing_key')