當前位置: 首頁>>代碼示例>>Python>>正文


Python Mailpile.contact方法代碼示例

本文整理匯總了Python中mailpile.Mailpile.contact方法的典型用法代碼示例。如果您正苦於以下問題:Python Mailpile.contact方法的具體用法?Python Mailpile.contact怎麽用?Python Mailpile.contact使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在mailpile.Mailpile的用法示例。


在下文中一共展示了Mailpile.contact方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: assert

# 需要導入模塊: from mailpile import Mailpile [as 別名]
# 或者: from mailpile.Mailpile import contact [as 別名]
    assert(not mp._config.prefs.vcard.importers.gravatar[0].active)

    # 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()

    # Do we have a Mr. Rogers contact?
    assert(mp.contact('[email protected]').result[0].fn == u'Mr. Rogers')
    assert(len(mp.contact_list('rogers').result['contacts']) == 1)

    # 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', 'fimmtudaginn'],
                   ['subject:Moderation', 'kde-isl']):
        say('Searching for: %s' % search)
        results = mp.search(*search)
        assert(results.result['count'] == 1)
開發者ID:busla,項目名稱:Mailpile,代碼行數:33,代碼來源:mailpile-test.py

示例2: assert

# 需要導入模塊: from mailpile import Mailpile [as 別名]
# 或者: from mailpile.Mailpile import contact [as 別名]
    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('[email protected]'
                      ).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()
    assert(len(mp._config.index.INDEX) == messages)
開發者ID:crameth,項目名稱:Mailpile,代碼行數:34,代碼來源:mailpile-test.py

示例3: len

# 需要導入模塊: from mailpile import Mailpile [as 別名]
# 或者: from mailpile.Mailpile import contact [as 別名]
    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("[email protected]").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()
    assert len(mp._config.index.INDEX) == messages
開發者ID:vinchu,項目名稱:Mailpile,代碼行數:33,代碼來源:mailpile-test.py


注:本文中的mailpile.Mailpile.contact方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。