跳转到主要内容

用于测试目的的模拟SFTP服务器

项目描述

mocksftp - 简单测试您的SFTP客户端代码

进程内SFTP服务器,用于测试与SFTP相关的客户端代码。

使用示例

对于pytest,使用sftp_serversftp_client固定值

from contextlib import closing
import py.path


def test_open_file(sftp_server, sftp_client):
    # Write directly in the server root.
    root_path = py.path.local(sftp_server.root)
    root_path.join('file.txt').write('content')

    # Access the folder via the client
    sftp = sftp_client.open_sftp()
    assert sftp.listdir('.') == ['file.txt']

    with closing(sftp.open('file.txt', 'r')) as data:
        assert data.read() == b'content'

历史

此项目是从Carlos Valiente创建的https://github.com/carletes/mock-ssh-server的分支开始的。

删除了与SSH相关的代码,以专注于SFTP协议。

替代方案

项目详情


下载文件

下载适用于您的平台文件。如果您不确定选择哪个,请了解有关安装软件包的更多信息。

源分布

mocksftp-1.0.1.tar.gz (11.8 kB 查看哈希值)

上传时间 源码

构建分发版

mocksftp-1.0.1-py2.py3-none-any.whl (12.0 kB 查看哈希值)

上传时间 Python 2 Python 3

支持

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF 赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误日志 StatusPage StatusPage 状态页面