From 7db2ee711c29500bf25c6e1c3530266646741aa4 Mon Sep 17 00:00:00 2001 From: dave Date: Fri, 29 Jun 2018 12:09:58 -0400 Subject: [PATCH] adding the ability to set the host on the flask app for using a remote selenium server --- flask_testing/utils.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/flask_testing/utils.py b/flask_testing/utils.py index 7362c40..619090b 100644 --- a/flask_testing/utils.py +++ b/flask_testing/utils.py @@ -435,6 +435,7 @@ def __call__(self, result=None): # Get the app self.app = self.create_app() + self._configured_host = self.app.config.get('LIVESERVER_HOST', 'localhost') self._configured_port = self.app.config.get('LIVESERVER_PORT', 5000) self._port_value = multiprocessing.Value('i', self._configured_port) @@ -453,7 +454,7 @@ def get_server_url(self): """ Return the url of the test server """ - return 'http://localhost:%s' % self._port_value.value + return 'http://{}:{}'.format(self._configured_host, self._port_value.value) def _spawn_live_server(self): self._process = None @@ -477,7 +478,7 @@ def socket_bind_wrapper(self): return ret socketserver.TCPServer.server_bind = socket_bind_wrapper - app.run(port=port, use_reloader=False) + app.run(port=port, use_reloader=False, host=self._configured_host) self._process = multiprocessing.Process( target=worker, args=(self.app, self._configured_port)