From 1396f2ef54b71d4344e28329a4d874a73e2e8e12 Mon Sep 17 00:00:00 2001 From: Elena ``of Valhalla'' Grandi Date: Sun, 7 Jul 2019 12:45:06 +0200 Subject: Split the ctl_client in its own file, using guacamole. --- tests/test_ctl.py | 21 --------------------- tests/test_ctl_client.py | 23 +++++++++++++++++++++++ 2 files changed, 23 insertions(+), 21 deletions(-) create mode 100644 tests/test_ctl_client.py (limited to 'tests') diff --git a/tests/test_ctl.py b/tests/test_ctl.py index ed6a5e4..f58ce5a 100644 --- a/tests/test_ctl.py +++ b/tests/test_ctl.py @@ -1,6 +1,5 @@ import os import tempfile -import unittest from tornado.testing import AsyncTestCase, gen_test @@ -41,23 +40,3 @@ class TestCtlServerCommands(AsyncTestCase): )) self.assertIn('ok', res) self.assertEqual(len(self.ctl_server.app.store.objects), 1) - - -class TestCtlClient(unittest.TestCase): - def setUp(self): - self.client = ctl.CtlClient( - config.Config('tests/data/test_config.yaml') - ) - - def test_cmd_ping(self): - cmd = self.client.ping() - self.assertEqual(cmd, {"command": "ping"}) - - def test_cmd_add_object(self): - obj = { - "id": "http://example.org/123456", - "type": "object", - } - cmd = self.client.add_object(obj) - self.assertEqual(cmd['command'], 'add_object') - self.assertEqual(cmd['obj'], obj) diff --git a/tests/test_ctl_client.py b/tests/test_ctl_client.py new file mode 100644 index 0000000..9b787c0 --- /dev/null +++ b/tests/test_ctl_client.py @@ -0,0 +1,23 @@ +import unittest + +from pyapd import ctl_client, config + + +class TestCtlClient(unittest.TestCase): + def setUp(self): + self.config = config.Config('tests/data/test_config.yaml') + + def test_cmd_ping(self): + ping = ctl_client.Ping() + cmd = ping.get_command() + self.assertEqual(cmd, {"command": "ping"}) + + def test_cmd_add_object(self): + obj = { + "id": "http://example.org/123456", + "type": "object", + } + add_object = ctl_client.AddObject() + cmd = add_object.get_command(obj) + self.assertEqual(cmd['command'], 'add_object') + self.assertEqual(cmd['obj'], obj) -- cgit v1.2.3