create number of own identities sync minimail
authorVolker Birk <vb@pep-project.org>
Thu, 21 Nov 2019 12:14:31 +0100
branchsync
changeset 322e97d32a08580
parent 316 e266ca67f8d0
child 324 063d1a1fc5c9
create number of own identities
test/sync_handshake.py
     1.1 --- a/test/sync_handshake.py	Thu Nov 14 15:39:16 2019 +0100
     1.2 +++ b/test/sync_handshake.py	Thu Nov 21 12:14:31 2019 +0100
     1.3 @@ -132,7 +132,7 @@
     1.4      pEp.shutdown_sync()
     1.5  
     1.6  
     1.7 -def run(name, color=None):
     1.8 +def run(name, color=None, own_ident=1):
     1.9      global device_name
    1.10      device_name = name
    1.11  
    1.12 @@ -148,6 +148,15 @@
    1.13  
    1.14      me = pEp.Identity("alice@peptest.ch", name + " of Alice Neuman", name)
    1.15      pEp.myself(me)
    1.16 +
    1.17 +    if own_ident >= 2:
    1.18 +        me2 = pEp.Identity("alice@pep.security", name + " of Alice Neuman", name)
    1.19 +        pEp.myself(me2)
    1.20 +
    1.21 +    if own_ident == 3:
    1.22 +        me3 = pEp.Identity("alice@pep.foundation", name + " of Alice Neuman", name)
    1.23 +        pEp.myself(me3)
    1.24 +
    1.25      pEp.messageToSend = messageToSend
    1.26  
    1.27      if multithreaded:
    1.28 @@ -200,11 +209,16 @@
    1.29              help="use multithreaded instead of single threaded implementation")
    1.30      optParser.add_option("-n", "--noend", action="store_true",
    1.31              dest="noend", help="do not end")
    1.32 +    optParser.add_option("-o", "--own-identities", type="int", dest="own_ident",
    1.33 +            help="simulate having OWN_IDENT own identities (1 to 3)", default=1)
    1.34      options, args = optParser.parse_args()
    1.35  
    1.36      if not options.exec_for:
    1.37          options.exec_for = os.path.basename(os.getcwd())
    1.38  
    1.39 +    if options.own_ident < 1 or options.own_ident > 3:
    1.40 +        raise ValueError("illegal number of own identities (allowed are 1 to 3)")
    1.41 +
    1.42      if options.notifications:
    1.43          end_on = eval(options.notifications)
    1.44          try: None in end_on
    1.45 @@ -215,5 +229,5 @@
    1.46          end_on = (None,)
    1.47  
    1.48      multithreaded = options.multithreaded
    1.49 -    run(options.exec_for, options.color)
    1.50 +    run(options.exec_for, options.color, options.own_ident)
    1.51