Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/niedbalski/ssh-exec-test
Library for testing SSH clients
https://github.com/niedbalski/ssh-exec-test
Last synced: about 1 month ago
JSON representation
Library for testing SSH clients
- Host: GitHub
- URL: https://github.com/niedbalski/ssh-exec-test
- Owner: niedbalski
- Created: 2015-04-06T23:57:20.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-04-07T00:35:37.000Z (over 9 years ago)
- Last Synced: 2024-10-15T08:32:46.387Z (3 months ago)
- Language: Python
- Size: 148 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
### Status
[![Build Status](https://travis-ci.org/niedbalski/ssh-exec-test.svg?branch=master)](https://github.com/niedbalski/ssh-exec-test)SSH Exec test
=============This is a library for testing software that makes use of paramiko, fabric
or any other component, that relies on SSH shell_exec method for executing
remote commands.Usage
======For more examples, please checkout the tests directory.
```bash
$ pip install ssh-exec-test
``````python
from ssh_exec_test import (assert_ssh_exec, input)with assert_ssh_exec(rules=[
input("sudo ls -lhR", output="foobar"),
input("sudo ls -lhRT", output="foobar1"),
]) as server:ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect("127.0.0.1", 2022, "ubuntu", "ubuntu")
stdin, stdout, _ = ssh.exec_command("sudo ls -lhR")
ssh.close()assert stdout.read() == "foobar"
```