aboutsummaryrefslogtreecommitdiff
path: root/tests/test_ctl.py
blob: ddac775b00c840a8fcd14904af7eaf996bb8e8bf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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)