aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorElena ``of Valhalla'' Grandi <valhalla@trueelena.org>2019-06-23 11:11:20 +0200
committerElena ``of Valhalla'' Grandi <valhalla@trueelena.org>2019-06-23 11:11:20 +0200
commit5d2abce4a0e8e0f94e02c75cbea88132aaf19322 (patch)
tree2b1bff9f5c0aaf59b8b7e4a8930efade378b1315 /tests
parentf39b4f955e855897414610c729fc6da9ab2df2f1 (diff)
CtlClient infrastructure
Diffstat (limited to 'tests')
-rw-r--r--tests/test_ctl.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/test_ctl.py b/tests/test_ctl.py
index f58ce5a..ed6a5e4 100644
--- a/tests/test_ctl.py
+++ b/tests/test_ctl.py
@@ -1,5 +1,6 @@
import os
import tempfile
+import unittest
from tornado.testing import AsyncTestCase, gen_test
@@ -40,3 +41,23 @@ 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)