def test_enviarMensajes(self): stub = str_grpc.ChatStub(self.channel) msg = structure.Mensaje(sender='testsender', content="this is a test", receiver='testreceiver') self.assertEqual("success", stub.enviarMensaje(msg))
def recibirMensajes(self, request, context): cont = 0 #while True: while cont < len(self.messages): message = structure.Mensaje(id=self.messages[cont][0], sender=self.messages[cont][1], receiver=self.messages[cont][2], content=self.messages[cont][3]) if request.username == message.receiver or request.username == message.sender: yield message print(cont) cont = cont + 1