Make JMC work with PyXMPP 1.0.1
Ignore-this: cc242e6115e0359528974bc6607a9585 It will now be incompatible with PyXMPP <1.0.1 darcs-hash:20090701193604-86b55-70288dbfa46c93da43cae0e36bffe2bdb6df0178.gz
This commit is contained in:
@@ -48,7 +48,7 @@ if __name__ == '__main__':
|
|||||||
class MyTestProgram(unittest.TestProgram):
|
class MyTestProgram(unittest.TestProgram):
|
||||||
def runTests(self):
|
def runTests(self):
|
||||||
"""run tests but do not exit after"""
|
"""run tests but do not exit after"""
|
||||||
self.testRunner = unittest.TextTestRunner(verbosity=self.verbosity)
|
self.testRunner = unittest.TextTestRunner(verbosity=self.verbosity)
|
||||||
self.testRunner.run(self.test)
|
self.testRunner.run(self.test)
|
||||||
|
|
||||||
logger = logging.getLogger()
|
logger = logging.getLogger()
|
||||||
|
|||||||
@@ -68,10 +68,10 @@ class MailCommandManager(JCLCommandManager):
|
|||||||
field_type="list-multi",
|
field_type="list-multi",
|
||||||
label="select attachments")
|
label="select attachments")
|
||||||
field.add_option(label="Next",
|
field.add_option(label="Next",
|
||||||
values=["-1"])
|
value="-1")
|
||||||
for (mail_id, mail_title) in _account.get_mail_with_attachment_list():
|
for (mail_id, mail_title) in _account.get_mail_with_attachment_list():
|
||||||
field.add_option(label=mail_title,
|
field.add_option(label=mail_title,
|
||||||
values=[mail_id])
|
value=mail_id)
|
||||||
result_form.as_xml(command_node)
|
result_form.as_xml(command_node)
|
||||||
return (result_form, [])
|
return (result_form, [])
|
||||||
else:
|
else:
|
||||||
@@ -154,7 +154,7 @@ class MailCommandManager(JCLCommandManager):
|
|||||||
field_type="list-multi",
|
field_type="list-multi",
|
||||||
label=lang_class.field_email_subject)
|
label=lang_class.field_email_subject)
|
||||||
for (email_index, email_subject) in email_list:
|
for (email_index, email_subject) in email_list:
|
||||||
field.add_option(label=email_subject, values=[email_index])
|
field.add_option(label=email_subject, value=email_index)
|
||||||
if len(email_list) == 10:
|
if len(email_list) == 10:
|
||||||
result_form.add_field(name="fetch_more",
|
result_form.add_field(name="fetch_more",
|
||||||
field_type="boolean",
|
field_type="boolean",
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ import time
|
|||||||
|
|
||||||
from pyxmpp.iq import Iq
|
from pyxmpp.iq import Iq
|
||||||
from pyxmpp.jabber.dataforms import Field
|
from pyxmpp.jabber.dataforms import Field
|
||||||
|
import pyxmpp.xmlextra
|
||||||
|
|
||||||
import jcl.tests
|
import jcl.tests
|
||||||
from jcl.tests import JCLTestCase
|
from jcl.tests import JCLTestCase
|
||||||
@@ -47,6 +48,8 @@ from jmc.lang import Lang
|
|||||||
from jmc.jabber.tests.component import MockIMAPAccount
|
from jmc.jabber.tests.component import MockIMAPAccount
|
||||||
from jmc.jabber.command import MailCommandManager
|
from jmc.jabber.command import MailCommandManager
|
||||||
|
|
||||||
|
PYXMPP_NS = pyxmpp.xmlextra.COMMON_NS
|
||||||
|
|
||||||
class MailCommandManagerTestCase(JCLCommandManagerTestCase):
|
class MailCommandManagerTestCase(JCLCommandManagerTestCase):
|
||||||
def setUp(self, tables=[]):
|
def setUp(self, tables=[]):
|
||||||
tables += [POP3Account, IMAPAccount, GlobalSMTPAccount,
|
tables += [POP3Account, IMAPAccount, GlobalSMTPAccount,
|
||||||
@@ -286,7 +289,7 @@ class MailCommandManagerGetEmailCommand_TestCase(MailCommandManagerTestCase):
|
|||||||
self.assertTrue(jcl.tests.is_xml_equal(\
|
self.assertTrue(jcl.tests.is_xml_equal(\
|
||||||
u"<message from='account11@" + unicode(self.comp.jid)
|
u"<message from='account11@" + unicode(self.comp.jid)
|
||||||
+ "' to='test1@test.com' "
|
+ "' to='test1@test.com' "
|
||||||
+ "xmlns='http://pyxmpp.jabberstudio.org/xmlns/common'>"
|
+ "xmlns='" + PYXMPP_NS + "'>"
|
||||||
+ "<subject>" + Lang.en.mail_subject \
|
+ "<subject>" + Lang.en.mail_subject \
|
||||||
% ("from" + str(index) + "@test.com")
|
% ("from" + str(index) + "@test.com")
|
||||||
+ "</subject>"
|
+ "</subject>"
|
||||||
@@ -570,7 +573,7 @@ class MailCommandManagerGetEmailCommand_TestCase(MailCommandManagerTestCase):
|
|||||||
self.assertTrue(jcl.tests.is_xml_equal(\
|
self.assertTrue(jcl.tests.is_xml_equal(\
|
||||||
u"<iq from='unknown@" + unicode(self.comp.jid)
|
u"<iq from='unknown@" + unicode(self.comp.jid)
|
||||||
+ "' to='test1@test.com' type='error' "
|
+ "' to='test1@test.com' type='error' "
|
||||||
+ "xmlns='http://pyxmpp.jabberstudio.org/xmlns/common'>"
|
+ "xmlns='" + PYXMPP_NS + "'>"
|
||||||
+ "<command xmlns='http://jabber.org/protocol/commands' "
|
+ "<command xmlns='http://jabber.org/protocol/commands' "
|
||||||
+ "node='jmc#get-email' />"
|
+ "node='jmc#get-email' />"
|
||||||
+ "<error type='cancel'>"
|
+ "<error type='cancel'>"
|
||||||
|
|||||||
@@ -527,7 +527,7 @@ class IMAPAccount_TestCase(InheritableAccount_TestCase):
|
|||||||
try:
|
try:
|
||||||
tested_func()
|
tested_func()
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
self.assertEquals(e.message, exception_message)
|
self.assertEquals(str(e), exception_message)
|
||||||
return
|
return
|
||||||
self.fail("No exception raised when selecting non existing mailbox")
|
self.fail("No exception raised when selecting non existing mailbox")
|
||||||
test_func = self.make_test(\
|
test_func = self.make_test(\
|
||||||
@@ -608,7 +608,7 @@ class IMAPAccount_TestCase(InheritableAccount_TestCase):
|
|||||||
try:
|
try:
|
||||||
self.imap_account.get_new_mail_list()
|
self.imap_account.get_new_mail_list()
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
self.assertEquals(e.message, "Mailbox does not exist")
|
self.assertEquals(str(e), "Mailbox does not exist")
|
||||||
return
|
return
|
||||||
self.fail("No exception raised when selecting non existing mailbox")
|
self.fail("No exception raised when selecting non existing mailbox")
|
||||||
test_func = self.make_test(\
|
test_func = self.make_test(\
|
||||||
|
|||||||
Reference in New Issue
Block a user