mitogen/tests/ssh_test.py

26 lines
600 B
Python
Raw Normal View History

2016-08-26 18:35:09 +00:00
import unittest
2017-09-16 07:15:25 +00:00
import mitogen
import mitogen.master
import mitogen.ssh
import mitogen.utils
2016-08-26 18:35:09 +00:00
import testlib
def add(x, y):
return x + y
class SshTest(unittest.TestCase):
def test_okay(self):
2017-09-16 07:15:25 +00:00
@mitogen.utils.run_with_broker
2016-08-26 18:35:09 +00:00
def test(broker):
2017-09-16 07:15:25 +00:00
context = mitogen.ssh.connect(broker,
2016-08-26 18:35:09 +00:00
hostname='hostname',
ssh_path=testlib.data_path('fakessh.py'))
2017-09-16 07:15:25 +00:00
context.call(mitogen.utils.log_to_file, '/tmp/log')
context.call(mitogen.utils.disable_site_packages)
2016-08-26 18:35:09 +00:00
self.assertEquals(3, context.call(add, 1, 2))