Browse Source

Multi process test now behaves as a real functional test, and fires exception if mail that should be decrypted by group isn't decrypted

PYADPT-55
Edouard Tisserant 9 years ago
parent
commit
78c2aabb3b
  1. 6
      test/mp_sync_test.py
  2. 11
      test/multipEp.py

6
test/mp_sync_test.py

@ -32,14 +32,16 @@ scenario0 = [
("SoloA", [encrypted_message, ["some.other@else.where", ("SoloA", [encrypted_message, ["some.other@else.where",
"some.one@some.where", "some.one@some.where",
"read this", "this is a secret message"]], store_message), "read this", "this is a secret message"]], store_message),
("GroupA1", [decrypt_message, [stored_message]], expect([6])),
(flush_all_mails,), (flush_all_mails,),
("GroupA2", [create_account, ["some.one@some.where", "Some One"]]), ("GroupA2", [create_account, ["some.one@some.where", "Some One"]]),
(cycle_until_no_change, ["GroupA1", "GroupA2"], expect(4)), (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"]]), ("GroupA3", [create_account, ["some.one@some.where", "Some One"]]),
(cycle_until_no_change, ["GroupA1", "GroupA2", "GroupA3"], expect(3)), (cycle_until_no_change, ["GroupA1", "GroupA2", "GroupA3"], expect(3)),
# force consume messages # force consume messages
("GroupA3", [None, None, None, -60*15]) # ("GroupA3", [None, None, None, -60*15]),
("GroupA3", [decrypt_message, [stored_message]], expect([6]))
] ]
scenario1 = [ scenario1 = [

11
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.to = [pEp.Identity(to_address, to_address)]
m.shortmsg = shortmsg m.shortmsg = shortmsg
m.longmsg = longmsg m.longmsg = longmsg
m.encrypt() return m.encrypt()
return m
def encrypted_message(from_address, to_address, shortmsg, longmsg): def encrypted_message(from_address, to_address, shortmsg, longmsg):
return str(_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 = " " pfx = " "
printi("attachments : ", msg.attachments) 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_pending, handshakes_to_accept, handshakes_seen
global handshakes_validated, msgs_folders global handshakes_validated, msgs_folders
func, args, kwargs, timeoff = order[0:] + [None, [], {}, 0][len(order):] func, args, kwargs, timeoff = order[0:] + [None, [], {}, 0][len(order):]
@ -163,7 +162,7 @@ def execute_order(order, handler, conn):
handler.deliverHandshakeResult(partner, 0) handler.deliverHandshakeResult(partner, 0)
printheader() printheader()
conn.send(res) return res
def pEp_instance_run(iname, conn, _msgs_folders, _handshakes_seen, _handshakes_validated): def pEp_instance_run(iname, conn, _msgs_folders, _handshakes_seen, _handshakes_validated):
global pEp, handler, own_addresses, i_name, msgs_folders 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: if order is None:
break break
execute_order(order, handler, conn) res = execute_order(order, handler)
conn.send(res)
msgs_folders = None msgs_folders = None

Loading…
Cancel
Save