Skip to content
Snippets Groups Projects
Commit 1b8d5fc7 authored by jkerdreu's avatar jkerdreu
Browse files

Lint


git-svn-id: https://redmine.imt-atlantique.fr/svn/xaal/code/Python/branches/0.7@3135 b32b6428-25c9-4566-ad07-03861ab6144f
parent aaf9fc9a
Branches
No related tags found
No related merge requests found
......@@ -6,6 +6,7 @@ from xaal.lib.messages import Message
TEST_PORT = 6666
def new_engine():
engine = Engine(port=TEST_PORT)
return engine
......@@ -59,8 +60,10 @@ class TestEngine(unittest.TestCase):
def action_1():
return "action_1"
def action_2(_value=None):
return "action_%s" % _value
def action_3():
raise Exception
......@@ -72,22 +75,23 @@ class TestEngine(unittest.TestCase):
msg.msg_type = MessageType.REQUEST
msg.targets = [target.address]
# simple test method
msg.action = 'action_1'
msg.action = "action_1"
result = engine.run_action(msg, target)
self.assertEqual(result, "action_1")
# test with value
msg.action = 'action_2'
msg.body = {'value':'2'}
msg.action = "action_2"
msg.body = {"value": "2"}
result = engine.run_action(msg, target)
self.assertEqual(result, "action_2")
# Exception in method
msg.action = 'action_3'
msg.action = "action_3"
with self.assertRaises(engine.XAALError):
result = engine.run_action(msg, target)
# unknown method
msg.action = 'missing'
msg.action = "missing"
with self.assertRaises(engine.XAALError):
result = engine.run_action(msg, target)
if __name__ == '__main__':
if __name__ == "__main__":
unittest.main()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment