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='{}') )