summaryrefslogtreecommitdiff
path: root/service/test/support/integration/app_test_client.py
diff options
context:
space:
mode:
Diffstat (limited to 'service/test/support/integration/app_test_client.py')
-rw-r--r--service/test/support/integration/app_test_client.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/service/test/support/integration/app_test_client.py b/service/test/support/integration/app_test_client.py
index f6a95422..dea59399 100644
--- a/service/test/support/integration/app_test_client.py
+++ b/service/test/support/integration/app_test_client.py
@@ -14,7 +14,9 @@
# You should have received a copy of the GNU Affero General Public License
# along with Pixelated. If not, see <http://www.gnu.org/licenses/>.
import json
+import multiprocessing
import shutil
+import time
from klein.test_resource import requestMock, _render
from leap.mail.imap.account import SoledadBackedAccount
@@ -87,6 +89,13 @@ class AppTestClient:
d.addCallback(get_request_written_data)
return d, request
+ def run_on_a_thread(self, logfile='/tmp/app_test_client.log', port=4567, host='localhost'):
+ worker = lambda: self.app.run(host=host, port=port, logFile=open(logfile, 'w'))
+ process = multiprocessing.Process(target=worker)
+ process.start()
+ time.sleep(1) # just let it start
+ return lambda: process.terminate()
+
def get(self, path, get_args, as_json=True):
request = requestMock(path)
request.args = get_args