Exemple #1
0
    def _compare(self, obj1, obj2):
        msg_type = to_message_type(obj1)
        msg_type2 = to_message_type(obj2)

        if msg_type != msg_type2:
            return False

        if msg_type in self._comparators:
            return self._comparators[msg_type](obj1, obj2)

        return obj1 == obj2
    def _compare(self, obj1, obj2):
        msg_type = to_message_type(obj1)
        msg_type2 = to_message_type(obj2)

        if msg_type != msg_type2:
            return False

        if msg_type in self._comparators:
            return self._comparators[msg_type](obj1, obj2)

        return obj1 == obj2
Exemple #3
0
    def _compare(self, obj1, obj2):
        msg_type = to_message_type(obj1)
        msg_type2 = to_message_type(obj1)

        if msg_type != msg_type2:
            raise UnexpectedMessageException(msg_type, obj1, obj2)

        if msg_type in self._comparators:
            return self._comparators[msg_type](obj1, obj2)

        return obj1 == obj2
Exemple #4
0
 def __init__(self, message_type, expected, received):
     super().__init__("{}: Expected {}({}):'{}', Got {}({}):'{}'".format(
         to_protobuf_class(message_type).__name__,
         to_protobuf_class(to_message_type(expected)),
         to_message_type(expected),
         str(expected).strip(),
         to_protobuf_class(to_message_type(received)),
         to_message_type(received),
         str(received).strip()))
     self.message_type_name = to_protobuf_class(message_type).__name__
     self.expected = expected
     self.received = received
 def __init__(self, message_type, expected, received):
     super().__init__("{}: Expected {}({}):'{}', Got {}({}):'{}'".format(
         to_protobuf_class(message_type).__name__,
         to_protobuf_class(to_message_type(expected)),
         to_message_type(expected),
         str(expected).strip(),
         to_protobuf_class(to_message_type(received)),
         to_message_type(received),
         str(received).strip()
     ))
     self.message_type_name = to_protobuf_class(message_type).__name__
     self.expected = expected
     self.received = received
Exemple #6
0
    def _compare(self, obj1, obj2):
        msg_type = to_message_type(obj1)

        if msg_type in self._comparators:
            return self._comparators[msg_type](obj1, obj2)

        else:
            return obj1 == obj2
Exemple #7
0
    def _compare(self, obj1, obj2):
        msg_type = to_message_type(obj1)

        if msg_type in self._comparators:
            return self._comparators[msg_type](obj1, obj2)

        else:
            return obj1 == obj2
Exemple #8
0
    def send(self, message_content, correlation_id=None):
        """
        Convert the message content to a protobuf message, including
        serialization of the content and insertion of the content type.
        Optionally include the correlation id in the message. Messages
        are sent with the name of this class as the sender.
        """

        message = Message(message_type=to_message_type(message_content),
                          content=message_content.SerializeToString(),
                          correlation_id=correlation_id,
                          sender=self.__class__.__name__)

        return self._loop.run_until_complete(
            self._send(self._tp_ident, message))
    def send(self, message_content, correlation_id=None):
        """
        Convert the message content to a protobuf message, including
        serialization of the content and insertion of the content type.
        Optionally include the correlation id in the message. Messages
        are sent with the name of this class as the sender.
        """

        message = Message(
            message_type=to_message_type(message_content),
            content=message_content.SerializeToString(),
            correlation_id=correlation_id,
        )

        return self._loop.run_until_complete(
            self._send(self._tp_ident, message))