carletes / mock-ssh-server

Python mock SSH server for testing purposes
MIT License
56 stars 32 forks source link

[WIP] Implement new features #3

Closed mvantellingen closed 1 year ago

mvantellingen commented 7 years ago

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:

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
carletes commented 7 years ago

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

Spitfire1900 commented 1 year ago

Closed as this is an abandoned PR.