Browse Source

ENGINE-140 #comment Added test for PEP_idf_not_for_sync on own identity - still not passing

PYADPT-55
Edouard Tisserant 9 years ago
parent
commit
42c6ebc2e8
  1. 23
      test/mp_sync_test.py
  2. 4
      test/multipEp.py

23
test/mp_sync_test.py

@ -70,10 +70,10 @@ def group_of_3_members():
return enc_msg
def new_address_peer_and_mail():
def new_address_peer_and_mail(identity_flag = None):
for action in [
("SoloB", [create_account, ["first@solo.b", "First SoloB"]]),
("GroupA3", [create_account, ["second@group.a", "GroupA Second"]]),
("GroupA3", [create_account, ["second@group.a", "GroupA Second", identity_flag]]),
# key exchange
("SoloB", [send_message, ["first@solo.b",
"second@group.a",
@ -129,6 +129,24 @@ def nokey_in_a_group_of_3_members():
("GroupA2", [decrypt_message, [enc_msg]], expect(pEp.PEP_rating.PEP_rating_reliable)),
] : yield action
def not_for_sync_in_a_group_of_3_members(pre_actions=[]):
yield from group_of_3_members()
enc_msg = yield from new_address_peer_and_mail(pEp.identity_flags.PEP_idf_not_for_sync)
for action in pre_actions + [
(cycle_until_no_change, ["GroupA1", "GroupA2", "GroupA3"], expect(1)),
(flush_all_mails,),
("GroupA1", [create_account, ["second@group.a", "GroupA Second", pEp.identity_flags.PEP_idf_not_for_sync]]),
(flush_all_mails, expect(0)),
("GroupA2", [create_account, ["second@group.a", "GroupA Second", pEp.identity_flags.PEP_idf_not_for_sync]]),
(flush_all_mails, expect(0)),
("GroupA2", [decrypt_message, [enc_msg]], expect(pEp.PEP_rating.PEP_rating_have_no_key)),
("GroupA1", [decrypt_message, [enc_msg]], expect(pEp.PEP_rating.PEP_rating_have_no_key)),
] : yield action
if __name__ == "__main__":
run_scenario(group_on_keygen)
run_scenario(group_on_cannotdecrypt)
@ -136,4 +154,5 @@ if __name__ == "__main__":
run_scenario(keygen_in_a_group_of_3_members)
run_scenario(group_survives_restart)
run_scenario(nokey_in_a_group_of_3_members)
run_scenario(not_for_sync_in_a_group_of_3_members)

4
test/multipEp.py

@ -34,9 +34,11 @@ handshakes_seen = []
handshakes_validated = []
msgs_folders = None
def create_account(address, name):
def create_account(address, name, flags=None):
global own_addresses
i = pEp.Identity(address, name)
if flags is not None:
i.flags = flags
pEp.myself(i)
own_addresses.append(address)

Loading…
Cancel
Save