Commits

bb b...@gmx.de  committed 8f4898e

implemented "send"; added test

  • Participants
  • Parent commits 9d31a27
  • Tags before_unification_inbound_outbound

Comments (0)

Files changed (2)

File araldo_websocket/endpoints/websocket_endpoint.py

     def send(self, message):
         message_str = self._marshalling.to_external_format(message)
         self._logger.debug("message_str: %s", message_str)
-        # TODO: send to server
+        self._websocket.send(message_str)

File test/websocket_test.py

 import pytest
 from mock import Mock, patch
 from araldo_websocket.endpoints import websocket_endpoint as sut
+from araldo.message import Message
 
 
 @pytest.fixture
                 inbound._run()
             except TooLong:
                 pass
+
+
+def test_outbound_send(outbound):
+    message = Message(
+        origin="test_origin",
+        destination="test_destination",
+        payload="test_payload")
+    with patch.object(outbound, "_websocket") as ws:
+        outbound.send(message)
+        assert ws.send.called