mock-ssh-server icon indicating copy to clipboard operation
mock-ssh-server copied to clipboard

[WIP] Implement new features

Open mvantellingen opened this issue 8 years ago • 1 comments
trafficstars

Hi,

So this will unfortunately be a PR from a branch I'm working on which will contain various separate changes. So first of all sorry for not creating separate pull requests.

This PR is still in progress but i've already openend it too give some information where I'm working on. It roughly contains the following changes:

  • Add a virtual root for sftp server. I am combing that with the tmpdir fixture from pytest which results in a pretty awesome test flow :-)
  • Add support for passphrases

This results in the following code snippet:

@fixture
def sftp_users():
    return {
        'labdigital': {
            'key': os.path.join(os.path.dirname(__file__), 'files', 'test_key'),
            'passphrase': 'testtest',
        }
    }


@fixture
def server(sftp_users, tmpdir):
    with mockssh.Server(root=tmpdir.join('sftp').mkdir().strpath) as s:
        for user, credentials in sftp_users.items():
            s.add_user(user, credentials['key'], credentials['passphrase'])

        yield s

mvantellingen avatar Jun 13 '17 19:06 mvantellingen

Looks good! Let me know when you're happy for merging, @mvantellingen.

carletes avatar Jun 14 '17 08:06 carletes

Closed as this is an abandoned PR.

Spitfire1900 avatar Jun 05 '23 02:06 Spitfire1900