def assert_equal_msgs(self, expected_msgs, actual_msgs): envelope = Envelope() assert len(actual_msgs) == len(expected_msgs) for actual, expected in zip(actual_msgs, expected_msgs): actual_payload = envelope.unpack(actual.message.value)['payload'] expected_payload = expected.payload assert actual_payload == expected_payload
def _assert_all_messages_published(self, consumer, expected_payloads=None): messages = consumer.get_messages(count=self.number_of_messages * 2) expected_payloads = (expected_payloads if expected_payloads is not None else range(self.number_of_messages)) envelope = Envelope() payloads = [ int(envelope.unpack(message.message.value)['payload']) for message in messages ] assert payloads == expected_payloads