def test_outbox_put(): """Tests that an envelope is putted into the queue.""" msg = DefaultMessage( dialogue_reference=("", ""), message_id=1, target=0, performative=DefaultMessage.Performative.BYTES, content=b"hello", ) message_bytes = DefaultSerializer().encode(msg) multiplexer = Multiplexer( [DummyConnection(connection_id=DUMMY_CONNECTION_PUBLIC_ID)]) outbox = OutBox(multiplexer) inbox = InBox(multiplexer) multiplexer.connect() envelope = Envelope( to="Agent1", sender="Agent0", protocol_id=DefaultMessage.protocol_id, message=message_bytes, ) outbox.put(envelope) time.sleep(0.5) assert not inbox.empty( ), "Inbox must not be empty after putting an envelope" multiplexer.disconnect()
def test_outbox_put(): """Tests that an envelope is putted into the queue.""" msg = Message(content="hello") message_bytes = ProtobufSerializer().encode(msg) my_queue = Queue() envelope = Envelope(to="Agent1", sender="Agent0", protocol_id="my_own_protocol", message=message_bytes) my_queue.put(envelope) _outbox = OutBox(my_queue) _outbox.put(envelope) assert _outbox.empty() is False,\ "Oubox must not be empty after putting an envelope"
def test_outbox_put(): """Tests that an envelope is putted into the queue.""" msg = DefaultMessage(type=DefaultMessage.Type.BYTES, content=b"hello") message_bytes = DefaultSerializer().encode(msg) multiplexer = Multiplexer([DummyConnection()]) outbox = OutBox(multiplexer) inbox = InBox(multiplexer) multiplexer.connect() envelope = Envelope(to="Agent1", sender="Agent0", protocol_id=DefaultMessage.protocol_id, message=message_bytes) outbox.put(envelope) time.sleep(0.5) assert not inbox.empty( ), "Inbox must not be empty after putting an envelope" multiplexer.disconnect()