def test_post_message( privkey_pem, encrypted_incoming_message, use_http=False ): """ rc = network.post_message( privkey_pem, encrypted_incoming_message ) if not rc: return rc """ singleton.set_volume( fake_vol2 ) assert storage.setup_storage( privkey_str2, "/apps/syndicatemail/data", "/tmp/storage-test/local2", [fake_mod] ), "setup_storage 2 failed" contact.write_contact( pubkey_str2, alice ) contact.write_contact( pubkey_str2, bob ) incoming_message = validate_and_parse_incoming_message( pubkey_str2, privkey_str2, bob.addr, encrypted_incoming_message ) assert incoming_message is not False, "validate and parse incoming message failed" rc = store_incoming_message( bob.pubkey_pem, incoming_message, volume=fake_vol2 ) assert rc, "store_incoming_message failed" singleton.set_volume( fake_vol ) return True
SDvy7Rj9SKUegdesB/FuSV37r8d5bZI1xaLFc8HNNHxOzEJq8vU+SUQwioxrErNu /yzB8pp795t1FnW1Ts3woD2VWRcdVx8K30/APjvPC1S9oI6zhnEE9Rf8nQ4D7QiZ 0i96vA8r1uxdByFCSB0s7gPVTX7vfQxzQQKCAQAnNWvIwXR1W40wS5kgKwNd9zyO +G9mWRvQgM3PptUXM6XV1kSPd+VofGvQ3ApYJ3I7f7VPPNTPVLI57vUkhOrKbBvh Td3OGzhV48behsSmOEsXkNcOiogtqQsACZzgzI+46akS87m+OHhP8H3KcdsvGUNM xwHi4nnnVSMQ+SWtSuCHgA+1gX5YlNKDjq3RLCRG//9XHIApfc9c52TJKZukLpfx chit4EZW1ws/JPkQ+Yer91mCQaSkPnIBn2crzce4yqm2dOeHlhsfo25Wr37uJtWY X8H/SaEdrJv+LaA61Fy4rJS/56Qg+LSy05lISwIHBu9SmhTuY1lBrr9jMa3Q -----END RSA PRIVATE KEY----- """.strip() import session fake_module = collections.namedtuple( "FakeModule", ["VOLUME_STORAGE_DIRS", "LOCAL_STORAGE_DIRS"] ) fake_vol = session.do_test_volume( "/tmp/storage-test/volume" ) singleton.set_volume( fake_vol ) fake_mod = fake_module( LOCAL_STORAGE_DIRS=LOCAL_STORAGE_DIRS, VOLUME_STORAGE_DIRS=VOLUME_STORAGE_DIRS ) assert storage.setup_storage( privkey_str, "/apps/syndicatemail/data", "/tmp/storage-test/local", [fake_mod] ), "setup_storage failed" test_email_addrs = [ "*****@*****.**", "*****@*****.**", "muneeb.volume.localhost@localhost" ] print "-------- parse_addr -----------" for addr in test_email_addrs: print addr print "%s" % str(parse_addr( addr ))
def do_logout( config ): for k in ['privkey', 'pubkey', 'session_expires', 'volume_name', 'volume', 'gateway_privkey_pem', 'email', 'volume_pubkey_pem']: if config.has_key(k): del config[k] singleton.set_volume( None )
volume_pubkey_pem = account_info.volume_pubkey_pem # load the Volume volume = Volume( gateway_name=gateway_name, gateway_port=gateway_port, ms_url=parsed_email.MS, my_key_str=gateway_privkey_pem, volume_key_pem=volume_pubkey_pem, # FIXME: volume_pubkey_pem consistent naming volume_name=parsed_email.volume, oid_username=syndicate_oid_username, oid_password=syndicate_oid_password ) config['gateway_privkey_pem'] = gateway_privkey_pem config['volume'] = volume singleton.set_volume( volume ) # set up volume storage if need_storage_setup: rc = storage.setup_storage( account.VOLUME_STORAGE_ROOT, account.LOCAL_STORAGE_ROOT, [], volume=volume ) if not rc: do_logout( config ) raise Exception( "Failed to set up storage" ) # get our account private key if privkey is None: # attempt to load the SyndicateMail private key privkey = keys.load_private_key( email, password ) if privkey is None: raise Exception("Invalid username/password")