From 306d7fbfd145b3f147611bdcf651530bfb4d808f Mon Sep 17 00:00:00 2001 From: Olivier Gayot Date: Sat, 12 Sep 2020 23:53:44 +0200 Subject: Add more tests for invalid commands Signed-off-by: Olivier Gayot --- tests/test_swiftstory.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'tests') 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='{}') + ) -- cgit v1.2.3