Exemplo n.º 1
0
    def test_set_packet(self):
        message = Message()

        message.set_packet(Message.LIST)
        self.assertEqual(message.get_packet(), Message.LIST)

        message.set_packet(Message.MEMBER)
        self.assertEqual(message.get_packet(), Message.MEMBER)

        message.set_packet(Message.TRANSACTION)
        self.assertEqual(message.get_packet(), Message.TRANSACTION)

        message.set_packet(Message.CHEESE)
        self.assertEqual(message.get_packet(), Message.CHEESE)

        message.set_packet(Message.RESPONSE)
        self.assertEqual(message.get_packet(), Message.NOTHING)

        message.set_packet(Message.REQUEST)
        self.assertEqual(message.get_packet(), Message.NOTHING)

        message.set_packet(Message.REPORT)
        self.assertEqual(message.get_packet(), Message.NOTHING)

        message.set_packet(Message.ERROR)
        self.assertEqual(message.get_packet(), Message.NOTHING)
Exemplo n.º 2
0
 def test_get_packet(self):
     message = Message()
     self.assertEqual(message.packet, message.get_packet())