Пример #1
0
    do_setup()
    if '-n' not in sys.argv:
        test_vcards()
        test_load_save_rescan()
        test_message_data()
        test_html()
        test_composition()
        test_smtp()
        if '-v' not in sys.argv:
            sys.stderr.write("\nTests passed, woot!\n")
        else:
            say("Tests passed, woot!")
except:
    sys.stderr.write("\nTests FAILED!\n")
    print
    traceback.print_exc()


##[ Interactive mode ]########################################################

if '-i' in sys.argv:
    mp.set('prefs/vcard/importers/gravatar/0/active = true')
    mp.set('prefs/vcard/importers/gpg/0/active = true')
    mp._session.ui = ui
    print '%s' % mp.help_splash()
    mp.Interact()


##[ Cleanup ]#################################################################
os.system('rm -rf %s' % mailpile_home)
Пример #2
0
    def grep(w, fn):
        return '\n'.join([l for l in open(fn, 'r').readlines() if w in l])

    def grepv(w, fn):
        return '\n'.join([l for l in open(fn, 'r').readlines() if w not in l])

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

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

    # Configure our fake mail sending setup
    mp.set('my_from: %s = Test Account' % MY_FROM)
    mp.set('my_sendmail: %s = |%s -i %%(rcpt)s' % (MY_FROM, mailpile_send))
    mp.set('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()
Пример #3
0
def grepv(w, fn):
    return '\n'.join([l for l in open(fn, 'r').readlines() if w not in l])


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


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')
    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?
Пример #4
0
def grep(w, fn):
    return '\n'.join([l for l in open(fn, 'r').readlines() if w in l])

def grepv(w, fn):
    return '\n'.join([l for l in open(fn, 'r').readlines() if w not in l])

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

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')

    # 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')
Пример #5
0
def grepv(w, fn):
    return '\n'.join([l for l in open(fn, 'r').readlines() if w not in l])


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


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()
Пример #6
0
def grepv(w, fn):
    return "\n".join([l for l in open(fn, "r").readlines() if w not in l])


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


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")

    # 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")
Пример #7
0
def grep(w, fn):
    return '\n'.join([l for l in open(fn, 'r').readlines() if w in l])

def grepv(w, fn):
    return '\n'.join([l for l in open(fn, 'r').readlines() if w not in l])

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

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()
Пример #8
0
def grep(w, fn):
    return '\n'.join([l for l in open(fn, 'r').readlines() if w in l])

def grepv(w, fn):
    return '\n'.join([l for l in open(fn, 'r').readlines() if w not in l])

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

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')
    mp.set('prefs/vcard/importers/demo/0/name = Mr. Rogers')

    # 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.