summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorOlivier Gayot <olivier.gayot@sigexec.com>2020-09-13 00:16:32 +0200
committerOlivier Gayot <olivier.gayot@sigexec.com>2020-09-13 00:17:41 +0200
commitc54514b283c47f774b0b6e9e22449ee6876ffc51 (patch)
tree72448ccecadc10c85ca2be3c022998258f08fc4c /tests
parent6157c88b1e7e47dfa9233776aa25b716e62f8af2 (diff)
Handle exception when JSON received is not an object
Signed-off-by: Olivier Gayot <olivier.gayot@sigexec.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/test_swiftstory.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/test_swiftstory.py b/tests/test_swiftstory.py
index 6a1f639..51dc837 100644
--- a/tests/test_swiftstory.py
+++ b/tests/test_swiftstory.py
@@ -11,6 +11,24 @@ class TestSwiftStory(unittest.TestCase):
SwiftStory.message_received_handler(client=None, message="{invalid_json}")
)
+ def test_receive_json_array(self):
+ self.assertEqual(
+ error("invalid command"),
+ SwiftStory.message_received_handler(client=None, message='[]')
+ )
+
+ def test_receive_json_number(self):
+ self.assertEqual(
+ error("invalid command"),
+ SwiftStory.message_received_handler(client=None, message='2.3')
+ )
+
+ def test_receive_json_null(self):
+ self.assertEqual(
+ error("invalid command"),
+ SwiftStory.message_received_handler(client=None, message='null')
+ )
+
def test_receive_unknown_command(self):
self.assertEqual(
error("invalid command"),