summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Gayot <olivier.gayot@sigexec.com>2020-09-12 22:42:48 +0200
committerOlivier Gayot <olivier.gayot@sigexec.com>2020-09-12 22:42:48 +0200
commit98f6021522c1f89ae7ccd5a3a7f3df5136edc3cf (patch)
treeba2ee23ce71ec81091507986d4fac5c471e27b0b
parent8dd8f46bcdddec793c18d76bfda1465824484aa9 (diff)
Add test for invalid JSON received
Signed-off-by: Olivier Gayot <olivier.gayot@sigexec.com>
-rw-r--r--tests/test_swiftstory.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/test_swiftstory.py b/tests/test_swiftstory.py
new file mode 100644
index 0000000..c2780d5
--- /dev/null
+++ b/tests/test_swiftstory.py
@@ -0,0 +1,12 @@
+import unittest
+
+import swiftstory.SwiftStory as SwiftStory
+from swiftstory.Status import error
+
+
+class TestSwiftStory(unittest.TestCase):
+ def test_invalid_message_received(self):
+ self.assertEqual(
+ error("badly formatted json"),
+ SwiftStory.message_received_handler(client=None, message="{invalid_json}")
+ )