当前位置: 首页>>代码示例>>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;未经允许,请勿转载。