ncouture / MockSSH

Mock an SSH server and define all commands it supports (Python, Twisted)
Other
125 stars 23 forks source link

Threaded server #8

Closed claudyus closed 9 years ago

claudyus commented 9 years ago

This pull request implement a threaded versuion of MockSSH library.

This features is really valuable in project where unittest that are using ssh server to retrieve information and parse it. I also modify the tests that show this in practice.

Here an example:

class MyTestCase(unittest.TestCase):

    @classmethod
    def setUpClass(cls):
        users = {'testadmin': 'x'}
        MockSSH.threadedServer(commands,
                prompt="$",
                interface="localhost",
                port=9999,
                **users)

    @classmethod
    def tearDownClass(cls):
        print "tearDownClass"
        MockSSH.threadedServerStop()
ncouture commented 9 years ago

I will be reviewing your pull request shortly.

This is a much needed effort for unit testing using MockSSH.

Thanks claudyus!