|
@ -2,30 +2,52 @@ |
|
|
test for simplest keysync scenario : two device setting up same account |
|
|
test for simplest keysync scenario : two device setting up same account |
|
|
|
|
|
|
|
|
Launch it with something like : |
|
|
Launch it with something like : |
|
|
DYLD_LIBRARY_PATH=/Users/ed/lib/ PYTHONPATH=`pwd`/../build/lib.macosx-10.11-x86_64-3.4 python3.4 sync_test.py |
|
|
LC_ALL=en_US.UTF-8 \ |
|
|
|
|
|
DYLD_LIBRARY_PATH=/Users/ed/lib/ \ |
|
|
|
|
|
PYTHONPATH=`pwd`/../build/lib.macosx-10.11-x86_64-3.4 \ |
|
|
|
|
|
python3.4 mp_sync_test.py |
|
|
|
|
|
|
|
|
""" |
|
|
""" |
|
|
|
|
|
|
|
|
import multipEp as mp |
|
|
stored_message = [] |
|
|
|
|
|
|
|
|
|
|
|
def store_message(res, action): |
|
|
|
|
|
stored_message.append(res) |
|
|
|
|
|
|
|
|
|
|
|
def print_res(res, action): |
|
|
|
|
|
print(res) |
|
|
|
|
|
|
|
|
|
|
|
from multipEp import * |
|
|
|
|
|
|
|
|
|
|
|
#("instance name", [instance_action_func, [args], {kwargs}], result_func), |
|
|
|
|
|
#(manager_action_func, [args], {kwargs}, result_func), |
|
|
scenario0 = [ |
|
|
scenario0 = [ |
|
|
#("instance name", [func, [args], {kwargs}]), |
|
|
("GroupA1", [create_account, ["some.one@some.where", "Some One"]]), |
|
|
("A", [mp.create_account, ["some.one@some.where", "Some One"]]), |
|
|
("SoloA", [create_account, ["some.other@else.where", "Some Other"]]), |
|
|
("B", [mp.create_account, ["some.one@some.where", "Some One"]]), |
|
|
# key exchange |
|
|
(mp.cycle_until_no_change, ["A", "B"]), |
|
|
("SoloA", [send_message, ["some.other@else.where", "some.one@some.where", |
|
|
("C", [mp.create_account, ["some.one@some.where", "Some One"]]), |
|
|
"Hey Bro", "Heeeey Brooooo"]]), |
|
|
(mp.cycle_until_no_change, ["A", "B", "C"]), |
|
|
("GroupA1", [send_message, ["some.one@some.where", "some.other@else.where", |
|
|
|
|
|
"Yo Dude", "Yooooo Duuuude"]]), |
|
|
|
|
|
("SoloA", [encrypted_message, ["some.other@else.where", |
|
|
|
|
|
"some.one@some.where", |
|
|
|
|
|
"read this", "this is a secret message"]], store_message), |
|
|
|
|
|
(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), |
|
|
|
|
|
("GroupA3", [create_account, ["some.one@some.where", "Some One"]]), |
|
|
|
|
|
(cycle_until_no_change, ["GroupA1", "GroupA2", "GroupA3"], expect(3)), |
|
|
# force consume messages |
|
|
# force consume messages |
|
|
("C", [None, None, None, -60*15]) |
|
|
("GroupA3", [None, None, None, -60*15]) |
|
|
] |
|
|
] |
|
|
|
|
|
|
|
|
scenario1 = [ |
|
|
scenario1 = [ |
|
|
#("instance name", [func, [args], {kwargs}]), |
|
|
#("instance name", [func, [args], {kwargs}]), |
|
|
("A", [mp.send_message, ["some.one@some.where", "some.other@else.where", "Hey Bro", "Heeeey Brooooo"]]), |
|
|
("B", [send_message, ["some.other@else.where", "some.one@some.where", "Hey Bro", "Heeeey Brooooo"]]), |
|
|
("B", [mp.send_message, ["some.other@else.where", "some.one@some.where", "Hey Bro", "Heeeey Brooooo"]]), |
|
|
("A", [send_message, ["some.one@some.where", "some.other@else.where", "Hey Bro", "Heeeey Brooooo"]]), |
|
|
] |
|
|
] |
|
|
|
|
|
|
|
|
if __name__ == "__main__": |
|
|
if __name__ == "__main__": |
|
|
mp.run_scenario(scenario0) |
|
|
run_scenario(scenario0) |
|
|
|
|
|
|
|
|