Commits

Anonymous committed 0c524a3 Draft

new tests

  • Participants
  • Parent commits f86962a

Comments (0)

Files changed (1)

File test/endpoint_websocket_test.py

 from araldo.endpoints import websocket as sut
 from araldo.config import Config
 from araldo.marshalling import default_marshalling
+from araldo.message import Message
 
 
 @pytest.fixture
 
 
 @pytest.fixture
+def message():
+    message = Mock()
+    message.__len__ = Mock(return_value=10)
+    return message
+
+
+@pytest.fixture
 def invalid_socket():
     sock = Mock()
 
         return result
 
 
+def test_plugin_id(endpoint):
+    assert endpoint.plugin_id() == "inoutbound-websocket"
+
+
 def test_websocket_instantiation(endpoint):
     pass
 
 
-def test_communicate_with_websocket_success(endpoint, valid_socket, queue):
-    message = Mock()
-    message.__len__ = Mock(return_value=10)
+def test_communicate_with_websocket_success(
+        endpoint, valid_socket, queue, message):
     endpoint._web_sockets["websocket_1"] = endpoint
     valid_socket.receive.return_value = message
     endpoint._communicate_with_websocket(valid_socket, "websocket_1")
     endpoint._communicate_with_websocket(valid_socket, "websocket_1")
     assert queue.qsize() == 0
     assert len(endpoint._web_sockets) == 0
+
+
+def test_run(endpoint, valid_socket):
+    valid_socket.receive.return_value = "sfdsf"
+    endpoint._run()
+
+
+def test_send_success(endpoint, message):
+    endpoint.send(Message("origin1", "destination1", "payload1", "msg_id1"))