Beispiel #1
0
try:
    # First, we set up a pristine Mailpile
    os.system('rm -rf %s' % mailpile_home)
    mp = Mailpile(workdir=mailpile_home)

    def say(stuff):
        mp._session.ui.mark(stuff)
        mp._session.ui.reset_marks()

    # Set up initial tags and such
    mp.setup()

    # Add the mailboxes, scan them
    for mailbox in ('tests.mbx', 'Maildir'):
        mp.add(os.path.join(mailpile_test, mailbox))
    mp.rescan()

    # Save and load the index, just for kicks
    mp._config.index.save()
    mp._config.index.load()

    # Rescan AGAIN, so we can test for the presence of duplicates.
    mp.rescan()

    # Search for things, there should be exactly one match for each.
    mp.order('flat-date')
    for search in (['from:wow'],
                   ['agirorn'],
                   ['subject:emerging'],
                   ['from:twitter', 'brennan'],
                   ['dates:2013-09-17', 'feministinn'],
Beispiel #2
0
    mp.set('profiles/0/name = Test Account')
    mp.set('profiles/0/route = |%s -i %%(rcpt)s' % mailpile_send)
    mp.set('sys/debug = sendmail log compose')
    mp.set('prefs/openpgp_header = encrypt')

    # Set up dummy conctact importer fortesting, disable Gravatar
    mp.set('prefs/vcard/importers/demo/0/name = Mr. Rogers')
    mp.set('prefs/vcard/importers/gravatar/0/active = false')
    mp.set('prefs/vcard/importers/gpg/0/active = false')

    # Make sure that actually worked
    assert(not mp._config.prefs.vcard.importers.gpg[0].active)
    assert(not mp._config.prefs.vcard.importers.gravatar[0].active)

    # Do we have a Mr. Rogers contact?
    mp.rescan('vcards')
    assert(mp.contact('*****@*****.**'
                      ).result['contact']['fn'] == u'Mr. Rogers')
    assert(len(mp.contact_list('rogers').result['contacts']) == 1)

    # Add the mailboxes, scan them
    for mailbox in ('tests.mbx', 'Maildir'):
        mp.add(os.path.join(mailpile_test, mailbox))
    mp.rescan()

    # Save and load the index, just for kicks
    messages = len(mp._config.index.INDEX)
    assert(messages > 5)
    mp._config.index.save(mp._session)
    mp._session.ui.reset_marks()
    mp._config.index.load(mp._session)
Beispiel #3
0

try:
    # Set up initial tags and such
    mp.setup()

    # Configure our fake mail sending setup
    mp.set('profiles/0/email = %s' % MY_FROM)
    mp.set('profiles/0/name = Test Account')
    mp.set('profiles/0/route = |%s -i %%(rcpt)s' % mailpile_send)
    mp.set('sys/debug = sendmail log compose')

    # Add the mailboxes, scan them
    for mailbox in ('tests.mbx', 'Maildir'):
        mp.add(os.path.join(mailpile_test, mailbox))
    mp.rescan()

    # Save and load the index, just for kicks
    mp._config.index.save()
    mp._config.index.load()

    # Rescan AGAIN, so we can test for the presence of duplicates.
    mp.rescan()

    # Search for things, there should be exactly one match for each.
    mp.order('rev-date')
    for search in (FROM_BRE, ['agirorn'], ['subject:emerging'],
                   ['from:twitter',
                    'brennan'], ['dates:2013-09-17', 'feministinn'
                                 ], ['mailbox:tests.mbx'] + FROM_BRE,
                   ['att:jpg',
Beispiel #4
0
    mp.set('profiles/0/email = %s' % MY_FROM)
    mp.set('profiles/0/name = Test Account')
    mp.set('profiles/0/route = |%s -i %%(rcpt)s' % mailpile_send)
    mp.set('sys/debug = sendmail log compose')

    # Set up dummy conctact importer fortesting, disable Gravatar
    mp.set('prefs/vcard/importers/demo/0/name = Mr. Rogers')
    mp.set('prefs/vcard/importers/gravatar/0/active = false')
    mp.set('prefs/vcard/importers/gpg/0/active = false')

    # Make sure that actually worked
    assert(not mp._config.prefs.vcard.importers.gpg[0].active)
    assert(not mp._config.prefs.vcard.importers.gravatar[0].active)

    # Do we have a Mr. Rogers contact?
    mp.rescan('vcards')
    assert(mp.contact('*****@*****.**').result['contact']['fn'] == u'Mr. Rogers')
    assert(len(mp.contact_list('rogers').result['contacts']) == 1)

    # Add the mailboxes, scan them
    for mailbox in ('tests.mbx', 'Maildir'):
        mp.add(os.path.join(mailpile_test, mailbox))
    mp.rescan()

    # Save and load the index, just for kicks
    mp._config.index.save()
    mp._config.index.load()

    # Rescan AGAIN, so we can test for the presence of duplicates.
    mp.rescan()
Beispiel #5
0
    mp.set("profiles/0/email = %s" % MY_FROM)
    mp.set("profiles/0/name = Test Account")
    mp.set("profiles/0/route = |%s -i %%(rcpt)s" % mailpile_send)
    mp.set("sys/debug = sendmail log compose")

    # Set up dummy conctact importer fortesting, disable Gravatar
    mp.set("prefs/vcard/importers/demo/0/name = Mr. Rogers")
    mp.set("prefs/vcard/importers/gravatar/0/active = false")
    mp.set("prefs/vcard/importers/gpg/0/active = false")

    # Make sure that actually worked
    assert not mp._config.prefs.vcard.importers.gpg[0].active
    assert not mp._config.prefs.vcard.importers.gravatar[0].active

    # Do we have a Mr. Rogers contact?
    mp.rescan("vcards")
    assert mp.contact("*****@*****.**").result["contact"]["fn"] == u"Mr. Rogers"
    assert len(mp.contact_list("rogers").result["contacts"]) == 1

    # Add the mailboxes, scan them
    for mailbox in ("tests.mbx", "Maildir"):
        mp.add(os.path.join(mailpile_test, mailbox))
    mp.rescan()

    # Save and load the index, just for kicks
    messages = len(mp._config.index.INDEX)
    assert messages > 5
    mp._config.index.save(mp._session)
    mp._session.ui.reset_marks()
    mp._config.index.load(mp._session)
    mp._session.ui.reset_marks()