summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorOlivier Gayot <olivier.gayot@sigexec.com>2020-09-12 23:53:44 +0200
committerOlivier Gayot <olivier.gayot@sigexec.com>2020-09-12 23:53:56 +0200
commit306d7fbfd145b3f147611bdcf651530bfb4d808f (patch)
tree531be31d5c57a5ea0d3eb6cb7ada6de8bb6fd484 /tests
parentc6f5c844abfc2461e4b19ee966808c475eac1741 (diff)
Add more tests for invalid commands
Signed-off-by: Olivier Gayot <olivier.gayot@sigexec.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/test_swiftstory.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/tests/test_swiftstory.py b/tests/test_swiftstory.py
index c2780d5..6a1f639 100644
--- a/tests/test_swiftstory.py
+++ b/tests/test_swiftstory.py
@@ -5,8 +5,20 @@ from swiftstory.Status import error
class TestSwiftStory(unittest.TestCase):
- def test_invalid_message_received(self):
+ def test_receive_invalid_json(self):
self.assertEqual(
error("badly formatted json"),
SwiftStory.message_received_handler(client=None, message="{invalid_json}")
)
+
+ def test_receive_unknown_command(self):
+ self.assertEqual(
+ error("invalid command"),
+ SwiftStory.message_received_handler(client=None, message='{"op": "unknown"}')
+ )
+
+ def test_receive_without_command(self):
+ self.assertEqual(
+ error("invalid command"),
+ SwiftStory.message_received_handler(client=None, message='{}')
+ )