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


Python Iq.set_new_content方法代碼示例

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


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

示例1: MailCommandManagerTestCase

# 需要導入模塊: from pyxmpp.iq import Iq [as 別名]
# 或者: from pyxmpp.iq.Iq import set_new_content [as 別名]
class MailCommandManagerTestCase(JCLCommandManagerTestCase):
    def setUp(self, tables=[]):
        tables += [POP3Account, IMAPAccount, GlobalSMTPAccount,
                   AbstractSMTPAccount, SMTPAccount,
                   MailAccount, MockIMAPAccount, User, Account, PresenceAccount]
        JCLTestCase.setUp(self, tables=tables)
        self.config_file = tempfile.mktemp(".conf", "jmctest", jcl.tests.DB_DIR)
        self.config = ConfigParser()
        self.config.read(self.config_file)
        self.comp = MailComponent("jmc.test.com",
                                  "password",
                                  "localhost",
                                  "5347",
                                  self.config,
                                  self.config_file)
        self.comp.set_admins(["[email protected]"])
        self.command_manager = MailCommandManager(self.comp,
                                                  self.comp.account_manager)
        self.comp.account_manager.account_classes = (POP3Account, IMAPAccount,
                                                     GlobalSMTPAccount,
                                                     AbstractSMTPAccount,
                                                     SMTPAccount, MockIMAPAccount)
        self.user1 = User(jid="[email protected]")
        self.account11 = MockIMAPAccount(user=self.user1,
                                         name="account11",
                                         jid="[email protected]" + unicode(self.comp.jid))
        self.account12 = MockIMAPAccount(user=self.user1,
                                         name="account12",
                                         jid="[email protected]" + unicode(self.comp.jid))
        self.user2 = User(jid="[email protected]")
        self.account21 = MockIMAPAccount(user=self.user2,
                                         name="account21",
                                         jid="[email protected]" + unicode(self.comp.jid))
        self.account22 = MockIMAPAccount(user=self.user2,
                                         name="account11",
                                         jid="[email protected]" + unicode(self.comp.jid))
        self.user3 = User(jid="[email protected]")
        self.account31 = MockIMAPAccount(user=self.user3,
                                         name="account31",
                                         jid="[email protected]" + unicode(self.comp.jid))
        self.account32 = MockIMAPAccount(user=self.user3,
                                         name="account32",
                                         jid="[email protected]" + unicode(self.comp.jid))
        self.info_query = Iq(stanza_type="set",
                             from_jid="[email protected]",
                             to_jid=self.comp.jid)
        self.command_node = self.info_query.set_new_content(command.COMMAND_NS,
                                                            "command")
        class MockFeederHandler(Feeder):
            def __init__(self, component):
                Feeder.__init__(self, component)
                self.checked_accounts = []

            def feed(self, _account):
                self.checked_accounts.append(_account)
                assert((int(time.time()) - _account.lastcheck \
                            >= (_account.interval * self.component.time_unit)))
                return []

        self.comp.tick_handlers[0].feeder = MockFeederHandler(self.comp)

    def tearDown(self):
        JCLTestCase.tearDown(self)
        if os.path.exists(self.config_file):
            os.unlink(self.config_file)
開發者ID:dax,項目名稱:jmc,代碼行數:67,代碼來源:command.py


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