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
pp.pprint( drafts_metadata ) print "Sent:" sent_metadata = list_messages( fake_vol, pubkey_str, privkey_str, SENT_FOLDER ) pp.pprint( sent_metadata ) print "Inbox:" inbox_metadata = list_messages( fake_vol, pubkey_str, privkey_str, INBOX_FOLDER ) pp.pprint( inbox_metadata ) print "---- send message setup ----" #SyndicateContact = collections.namedtuple( "SyndicateMailContact", ["addr", "pubkey_pem", "extras"] ) alice = contact.SyndicateContact( addr="alice.mail.localhost:8080@localhost:33334", pubkey_pem = pubkey_str, extras = {"foo":"bar"} ) bob = contact.SyndicateContact( addr="bob.mail2.localhost:8080@localhost:33334", pubkey_pem = pubkey_str2, extras={"baz": "goo"} ) contact.write_contact( pubkey_str, alice ) contact.write_contact( pubkey_str, bob ) print "---- send message setup ----" def test_download_user_pubkey( addr ): return pubkey_str2 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"