Example #1
0
    def test_valid_read(self):
        """
        Tests the reading of properly formed single result messages.
        """

        valid1 = 'R000100000019{"message":"Hello World"}'
        message = read_message(valid1, _PROTO_VERSION)
        self.assertIsInstance(message, SingleResultMessage)
        self.assertEqual(message.request_id, "0001")
        self.assertEqual(message.payload, '{"message":"Hello World"}')
Example #2
0
    def test_valid_read(self):
        """
        Tests the reading of properly formed retry result messages.
        """

        valid1 = 'e00010000000000000014"service restarting"'
        message = read_message(valid1, _PROTO_VERSION)
        self.assertIsInstance(message, RetryResultMessage)
        self.assertEqual(message.request_id, "0001")
        self.assertEqual(message.payload, '"service restarting"')
Example #3
0
    def test_valid_read(self):
        """
        Tests the reading of properly formed stream result messages.
        """

        valid1 = 'S00010000000b{"message":'
        message = read_message(valid1, _PROTO_VERSION)
        self.assertIsInstance(message, StreamResultMessage)
        self.assertEqual(message.request_id, "0001")
        self.assertEqual(message.payload, '{"message":')
Example #4
0
    def test_valid_read(self):
        """
        Tests the reading of properly formed stream request part messages.
        """

        valid1 = 'p00010000000e"Hello World"}'
        message = read_message(valid1, _PROTO_VERSION)
        self.assertIsInstance(message, StreamRequestPartMessage)
        self.assertEqual(message.request_id, "0001")
        self.assertEqual(message.payload, '"Hello World"}')
Example #5
0
    def test_valid_read(self):
        """
        Tests the reading of properly formed notification messages.
        """

        valid1 = 'n00cchat message00000032{"message":"Hi","from":"nthn","chat_room":"gonuts"}'
        message = read_message(valid1, _PROTO_VERSION)
        self.assertIsInstance(message, NotificationMessage)
        self.assertEqual(message.name, "chat message")
        self.assertEqual(message.payload, '{"message":"Hi","from":"nthn","chat_room":"gonuts"}')
Example #6
0
    def test_valid_read(self):
        """
        Tests the reading of properly formed error result messages.
        """

        valid1 = 'E00100000026{"error":"Unknown operation \"echo\""}'
        message = read_message(valid1, _PROTO_VERSION)
        self.assertIsInstance(message, ErrorResultMessage)
        self.assertEqual(message.request_id, "001")
        self.assertEqual(message.payload, '{"error":"Unknown operation \"echo\""}')