def test_connection(self, mock_context): cs = ControlServer(None, connection_string='127.0.0.1:10001') cs.start_server() mock_context.assert_has_calls([ call(), call().socket(zmq.REP), call().socket().bind('tcp://127.0.0.1:10001') ])
def test_connection(self, mock_context): cs = ControlServer(None, connection_string="127.0.0.1:10001") cs.start_server() mock_context.assert_has_calls([ call(), call().socket(zmq.REP), call().socket().setsockopt(zmq.RCVTIMEO, 100), call().socket().bind("tcp://127.0.0.1:10001"), ])
def test_server_can_only_be_started_once(self, mock_context): server = ControlServer(None, connection_string='127.0.0.1:10000') server.start_server() server.start_server() mock_context.assert_has_calls([ call(), call().socket(zmq.REP), call().socket().bind('tcp://127.0.0.1:10000') ])
def test_server_can_only_be_started_once(self, mock_context): server = ControlServer(None, connection_string="127.0.0.1:10000") server.start_server() server.start_server() mock_context.assert_has_calls([ call(), call().socket(zmq.REP), call().socket().setsockopt(zmq.RCVTIMEO, 100), call().socket().bind("tcp://127.0.0.1:10000"), ])
def test_is_running(self, mock_context): server = ControlServer(None, connection_string="127.0.0.1:10000") self.assertFalse(server.is_running) server.start_server() self.assertTrue(server.is_running)