import os import tempfile from tornado.testing import AsyncTestCase, gen_test from pyapd import ctl, config class TestCtlServer(AsyncTestCase): def setUp(self): super().setUp() self.tempdir = tempfile.TemporaryDirectory() conf = config.Config('tests/data/test_config.yaml') conf.ctl_socket = os.path.join(self.tempdir.name, 'pyapd.sock') self.ctl_server = ctl.CtlServer(conf) @gen_test def test_ping_command(self): res = yield self.ctl_server.get_command('{"command": "ping"}') self.assertIn('pong', res)