Example #1
0
File: command.py Project: dax/jmc
    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(["*****@*****.**"])
        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="*****@*****.**")
        self.account11 = MockIMAPAccount(user=self.user1,
                                         name="account11",
                                         jid="account11@" + unicode(self.comp.jid))
        self.account12 = MockIMAPAccount(user=self.user1,
                                         name="account12",
                                         jid="account12@" + unicode(self.comp.jid))
        self.user2 = User(jid="*****@*****.**")
        self.account21 = MockIMAPAccount(user=self.user2,
                                         name="account21",
                                         jid="account21@" + unicode(self.comp.jid))
        self.account22 = MockIMAPAccount(user=self.user2,
                                         name="account11",
                                         jid="account11@" + unicode(self.comp.jid))
        self.user3 = User(jid="*****@*****.**")
        self.account31 = MockIMAPAccount(user=self.user3,
                                         name="account31",
                                         jid="account31@" + unicode(self.comp.jid))
        self.account32 = MockIMAPAccount(user=self.user3,
                                         name="account32",
                                         jid="account32@" + unicode(self.comp.jid))
        self.info_query = Iq(stanza_type="set",
                             from_jid="*****@*****.**",
                             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)
Example #2
0
File: presence.py Project: dax/jcl
 def setUp(self):
     JCLTestCase.setUp(self, tables=[User, LegacyJID, Account])
     self.comp = JCLComponent("jcl.test.com",
                              "password",
                              "localhost",
                              "5347",
                              None)
     self.handler = DefaultIQLastHandler(self.comp)
Example #3
0
File: message.py Project: dax/jcl
 def setUp(self):
     JCLTestCase.setUp(self, tables=[User, Account, ExampleAccount])
     self.comp = JCLComponent("jcl.test.com",
                              "password",
                              "localhost",
                              "5347",
                              self.db_url)
     self.handler = PasswordMessageHandler(self.comp)
Example #4
0
File: disco.py Project: dax/jcl
 def setUp(self):
     JCLTestCase.setUp(self, tables=[User, Account, ExampleAccount])
     self.comp = JCLComponent("jcl.test.com",
                              "password",
                              "localhost",
                              "5347",
                              self.db_url)
     self.comp.account_manager.account_classes = (ExampleAccount,)
     self.handler = AccountTypeDiscoGetItemsHandler(self.comp)
Example #5
0
File: account.py Project: dax/jcl
 def setUp(self, tables=[]):
     JCLTestCase.setUp(self, tables=[User, Account, PresenceAccount,
                                     PresenceAccountExample] + tables)
     model.db_connect()
     self.account = PresenceAccountExample(\
         user=User(jid="*****@*****.**"),
         name="account11",
         jid="*****@*****.**")
     model.db_disconnect()
     self.account_class = PresenceAccount
Example #6
0
File: account.py Project: dax/jmc
 def setUp(self):
     JCLTestCase.setUp(self, tables=[Account, PresenceAccount, User, MailAccount, IMAPAccount])
     self.imap_account = IMAPAccount(
         user=User(jid="*****@*****.**"), name="account1", jid="*****@*****.**", login="******"
     )
     self.imap_account.password = "******"
     self.imap_account.host = "localhost"
     self.imap_account.port = 1143
     self.imap_account.ssl = False
     self.account_class = IMAPAccount
Example #7
0
File: vcard.py Project: dax/jcl
 def setUp(self):
     JCLTestCase.setUp(self, tables=[User, Account, ExampleAccount])
     self.comp = JCLComponent("jcl.test.com",
                              "password",
                              "localhost",
                              "5347",
                              self.db_url)
     self.handler = DefaultVCardHandler(self.comp)
     self.comp.config = ConfigParser()
     self.comp.config.read("src/jcl/tests/jcl.conf")
Example #8
0
File: feeder.py Project: dax/jcl
 def setUp(self):
     JCLTestCase.setUp(self, tables=[Account, LegacyJID, ExampleAccount,
                                     Example2Account, User])
     self.comp = FeederComponent("jcl.test.com",
                                 "password",
                                 "localhost",
                                 "5347",
                                 None,
                                 None)
     self.comp.time_unit = 0
Example #9
0
File: feeder.py Project: dax/jcl
 def setUp(self):
     JCLTestCase.setUp(self, tables=[Account, User])
     self.comp = FeederComponent("jcl.test.com",
                                 "password",
                                 "localhost",
                                 "5347",
                                 None,
                                 None)
     self.sender = MessageSender(self.comp)
     self.message_type = None
Example #10
0
File: account.py Project: dax/jmc
 def setUp(self):
     JCLTestCase.setUp(self, tables=[Account, PresenceAccount, User, MailAccount, POP3Account])
     self.pop3_account = POP3Account(
         user=User(jid="*****@*****.**"), name="account1", jid="*****@*****.**", login="******"
     )
     self.pop3_account.password = "******"
     self.pop3_account.host = "localhost"
     self.pop3_account.port = 1110
     self.pop3_account.ssl = False
     model.db_disconnect()
     self.account_class = POP3Account
Example #11
0
File: runner.py Project: dax/jmc
 def setUp(self):
     JCLTestCase.setUp(self, tables=[Account, PresenceAccount, User,
                                     GlobalSMTPAccount, AbstractSMTPAccount])
     self.runner = JMCRunner("Jabber Mail Component", jmc.version)
     self.smtp_default_login = account.smtp_default_login
     self.smtp_default_password = account.smtp_default_password
     self.smtp_default_host = account.smtp_default_host
     self.smtp_default_port = account.smtp_default_port
     self.smtp_default_tls = account.smtp_default_tls
     self.smtp_default_ssl = account.smtp_default_ssl
     self.mail_default_encoding = MailAccount.default_encoding
     self.type_globalsmtp_name = Lang.en.type_globalsmtp_name
Example #12
0
File: presence.py Project: dax/jcl
 def setUp(self):
     JCLTestCase.setUp(self, tables=[User, LegacyJID, Account])
     self.config = ConfigParser()
     self.config_file = tempfile.mktemp(".conf", "jcltest", "/tmp")
     self.config.read(self.config_file)
     self.config.add_section("component")
     self.config.set("component", "motd", "Message Of The Day")
     self.comp = JCLComponent("jcl.test.com",
                              "password",
                              "localhost",
                              "5347",
                              self.config)
     self.handler = AccountPresenceUnavailableHandler(self.comp)
Example #13
0
File: account.py Project: dax/jcl
 def setUp(self):
     JCLTestCase.setUp(self, tables=[User, Account, ExampleAccount])
     self.account_class = Account
Example #14
0
File: account.py Project: dax/jcl
 def setUp(self):
     JCLTestCase.setUp(self, tables=[Account])
     self.account_class = Account
Example #15
0
File: feeder.py Project: dax/jcl
 def setUp(self):
     JCLTestCase.setUp(self, tables=[Account, ExampleAccount, User])
     self.tick_handlers = [FeederHandler(FeederMock(), SenderMock())]
Example #16
0
File: account.py Project: dax/jmc
 def setUp(self):
     JCLTestCase.setUp(
         self, tables=[Account, ExampleAccount, User, GlobalSMTPAccount, AbstractSMTPAccount, SMTPAccount]
     )
     self.account_class = SMTPAccount
Example #17
0
File: message.py Project: dax/jmc
 def setUp(self):
     JCLTestCase.setUp(self, tables=[Account, GlobalSMTPAccount,
                                     AbstractSMTPAccount,
                                     SMTPAccount, User])
     self.handler = RootSendMailMessageHandler(None)