blob: 6a1f6390f1bfae26a5bb5984c39283eb57c32116 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
import unittest
import swiftstory.SwiftStory as SwiftStory
from swiftstory.Status import error
class TestSwiftStory(unittest.TestCase):
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='{}')
)
|