Ejemplo n.º 1
0
    def test_parse_notify(self):
        input = 'NOTIFY\r\n'
        body = 'cccccc'
        input += pack_msg(body)

        msg = parser.parse(input)
        self.assertEqual(msg.message_type, message.NOTIFY)
        self.assertEqual(msg.method, 'NOTIFY')
        self.assertEqual(msg.body, body)
Ejemplo n.º 2
0
    def test_parse_request(self):
        input = 'POST 12345\r\n'
        body = 'aaaaaa'
        input += pack_msg(body)

        msg = parser.parse(input)
        self.assertEqual(msg.message_type, message.REQUEST)
        self.assertEqual(msg.method, 'POST')
        self.assertEqual(msg.seq, '12345')
        self.assertEqual(msg.body, body)
Ejemplo n.º 3
0
    def test_parse_response(self):
        input = '200 12345\r\n'
        body = 'bbbbbb'
        input += pack_msg(body)


        msg = parser.parse(input)
        self.assertEqual(msg.message_type, message.RESPONSE)
        self.assertEqual(msg.status, 200)
        self.assertEqual(msg.seq, '12345')
        self.assertEqual(msg.body, body)