From 78c2aabb3ba598197dc037614b6324a003016826 Mon Sep 17 00:00:00 2001 From: Edouard Tisserant Date: Tue, 11 Oct 2016 12:43:47 +0200 Subject: [PATCH] Multi process test now behaves as a real functional test, and fires exception if mail that should be decrypted by group isn't decrypted --- test/mp_sync_test.py | 6 ++++-- test/multipEp.py | 11 ++++++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/test/mp_sync_test.py b/test/mp_sync_test.py index 123ab39..77a55b0 100644 --- a/test/mp_sync_test.py +++ b/test/mp_sync_test.py @@ -32,14 +32,16 @@ scenario0 = [ ("SoloA", [encrypted_message, ["some.other@else.where", "some.one@some.where", "read this", "this is a secret message"]], store_message), + ("GroupA1", [decrypt_message, [stored_message]], expect([6])), (flush_all_mails,), ("GroupA2", [create_account, ["some.one@some.where", "Some One"]]), (cycle_until_no_change, ["GroupA1", "GroupA2"], expect(4)), - ("GroupA2", [decrypt_message, [stored_message]], print_res), + ("GroupA2", [decrypt_message, [stored_message]], expect([6])), ("GroupA3", [create_account, ["some.one@some.where", "Some One"]]), (cycle_until_no_change, ["GroupA1", "GroupA2", "GroupA3"], expect(3)), # force consume messages - ("GroupA3", [None, None, None, -60*15]) + # ("GroupA3", [None, None, None, -60*15]), + ("GroupA3", [decrypt_message, [stored_message]], expect([6])) ] scenario1 = [ diff --git a/test/multipEp.py b/test/multipEp.py index 02ed88a..83cf2e2 100644 --- a/test/multipEp.py +++ b/test/multipEp.py @@ -48,8 +48,7 @@ def _encrypted_message(from_address, to_address, shortmsg, longmsg): m.to = [pEp.Identity(to_address, to_address)] m.shortmsg = shortmsg m.longmsg = longmsg - m.encrypt() - return m + return m.encrypt() def encrypted_message(from_address, to_address, shortmsg, longmsg): return str(_encrypted_message(from_address, to_address, shortmsg, longmsg)) @@ -102,7 +101,7 @@ def printmsg(msg): pfx = " " printi("attachments : ", msg.attachments) -def execute_order(order, handler, conn): +def execute_order(order, handler): global handshakes_pending, handshakes_to_accept, handshakes_seen global handshakes_validated, msgs_folders func, args, kwargs, timeoff = order[0:] + [None, [], {}, 0][len(order):] @@ -163,7 +162,7 @@ def execute_order(order, handler, conn): handler.deliverHandshakeResult(partner, 0) printheader() - conn.send(res) + return res def pEp_instance_run(iname, conn, _msgs_folders, _handshakes_seen, _handshakes_validated): global pEp, handler, own_addresses, i_name, msgs_folders @@ -207,7 +206,9 @@ def pEp_instance_run(iname, conn, _msgs_folders, _handshakes_seen, _handshakes_v if order is None: break - execute_order(order, handler, conn) + res = execute_order(order, handler) + + conn.send(res) msgs_folders = None