コード例 #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
コード例 #2
0
ファイル: mock_validator.py プロジェクト: cianx/sawtooth-core
    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
コード例 #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
コード例 #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
コード例 #5
0
ファイル: mock_validator.py プロジェクト: cianx/sawtooth-core
 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
コード例 #6
0
ファイル: tester.py プロジェクト: jsmitchell/sawtooth-core
    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
コード例 #7
0
ファイル: tester.py プロジェクト: venkatAnne/sawtooth-core
    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
コード例 #8
0
ファイル: tester.py プロジェクト: lysol/sawtooth-core
    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))
コード例 #9
0
ファイル: mock_validator.py プロジェクト: cianx/sawtooth-core
    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))