mirror of
https://github.com/OCA/knowledge.git
synced 2025-07-26 18:38:41 -06:00
Remove file
This commit is contained in:
parent
23003e8050
commit
693c723f7f
@ -1,61 +0,0 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
###############################################################################
|
|
||||||
#
|
|
||||||
# Copyright (C) 2015 Akretion (http://www.akretion.com).
|
|
||||||
# @author Valentin CHEMIERE <valentin.chemiere@akretion.com>
|
|
||||||
#
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU Affero General Public License as
|
|
||||||
# published by the Free Software Foundation, either version 3 of the
|
|
||||||
# License, or (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU Affero General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU Affero General Public License
|
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
#
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
import mock
|
|
||||||
from contextlib import contextmanager
|
|
||||||
|
|
||||||
class ConnMock(object):
|
|
||||||
|
|
||||||
def __init__(self, response):
|
|
||||||
import ipdb; ipdb.set_trace()
|
|
||||||
self.response = response
|
|
||||||
|
|
||||||
def isfile(self, path):
|
|
||||||
return self.response['isfile']
|
|
||||||
|
|
||||||
def makedir(self, path):
|
|
||||||
return self.response['makedir']
|
|
||||||
|
|
||||||
def exists(self, path):
|
|
||||||
return self.response['exists']
|
|
||||||
|
|
||||||
def open(self, path, mode):
|
|
||||||
return self.response['open']
|
|
||||||
|
|
||||||
def listdir(self, path):
|
|
||||||
return self.response['listdir']
|
|
||||||
|
|
||||||
def remove(self, path):
|
|
||||||
return self.response['remove']
|
|
||||||
|
|
||||||
def rename(self, source_path, target_path):
|
|
||||||
return self.response['rename']
|
|
||||||
|
|
||||||
def __call__(self, *args, **kwargs):
|
|
||||||
return self
|
|
||||||
|
|
||||||
def __exit__(self, *args, **kwargs):
|
|
||||||
pass
|
|
||||||
|
|
||||||
@contextmanager
|
|
||||||
def sftp_mock(response):
|
|
||||||
with mock.patch('fs.sftpfs.SFTPFS', ConnMock(response)) as SFTPFS:
|
|
||||||
yield
|
|
Loading…
Reference in New Issue
Block a user