Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/dax/jmc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Rousselie <dax@happycoders.org>2009-07-01 23:36:04 +0400
committerDavid Rousselie <dax@happycoders.org>2009-07-01 23:36:04 +0400
commit4a9e1552f39ac1fbc16541b5a145d69c9b52eb01 (patch)
tree05317c7e033fbcfa89fda5c5e15d0fa5b23c6377
parent9bab12811370cda2e9b858e67d84c7843a836505 (diff)
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
-rw-r--r--run_tests.py2
-rw-r--r--src/jmc/jabber/command.py6
-rw-r--r--src/jmc/jabber/tests/command.py7
-rw-r--r--src/jmc/model/tests/account.py4
4 files changed, 11 insertions, 8 deletions
diff --git a/run_tests.py b/run_tests.py
index 844c43b..ed6ea9d 100644
--- a/run_tests.py
+++ b/run_tests.py
@@ -48,7 +48,7 @@ if __name__ == '__main__':
class MyTestProgram(unittest.TestProgram):
def runTests(self):
"""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)
logger = logging.getLogger()
diff --git a/src/jmc/jabber/command.py b/src/jmc/jabber/command.py
index 01fd1b4..c3a9748 100644
--- a/src/jmc/jabber/command.py
+++ b/src/jmc/jabber/command.py
@@ -68,10 +68,10 @@ class MailCommandManager(JCLCommandManager):
field_type="list-multi",
label="select attachments")
field.add_option(label="Next",
- values=["-1"])
+ value="-1")
for (mail_id, mail_title) in _account.get_mail_with_attachment_list():
field.add_option(label=mail_title,
- values=[mail_id])
+ value=mail_id)
result_form.as_xml(command_node)
return (result_form, [])
else:
@@ -154,7 +154,7 @@ class MailCommandManager(JCLCommandManager):
field_type="list-multi",
label=lang_class.field_email_subject)
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:
result_form.add_field(name="fetch_more",
field_type="boolean",
diff --git a/src/jmc/jabber/tests/command.py b/src/jmc/jabber/tests/command.py
index fb76c9f..3bd3291 100644
--- a/src/jmc/jabber/tests/command.py
+++ b/src/jmc/jabber/tests/command.py
@@ -31,6 +31,7 @@ import time
from pyxmpp.iq import Iq
from pyxmpp.jabber.dataforms import Field
+import pyxmpp.xmlextra
import jcl.tests
from jcl.tests import JCLTestCase
@@ -47,6 +48,8 @@ from jmc.lang import Lang
from jmc.jabber.tests.component import MockIMAPAccount
from jmc.jabber.command import MailCommandManager
+PYXMPP_NS = pyxmpp.xmlextra.COMMON_NS
+
class MailCommandManagerTestCase(JCLCommandManagerTestCase):
def setUp(self, tables=[]):
tables += [POP3Account, IMAPAccount, GlobalSMTPAccount,
@@ -286,7 +289,7 @@ class MailCommandManagerGetEmailCommand_TestCase(MailCommandManagerTestCase):
self.assertTrue(jcl.tests.is_xml_equal(\
u"<message from='account11@" + unicode(self.comp.jid)
+ "' to='test1@test.com' "
- + "xmlns='http://pyxmpp.jabberstudio.org/xmlns/common'>"
+ + "xmlns='" + PYXMPP_NS + "'>"
+ "<subject>" + Lang.en.mail_subject \
% ("from" + str(index) + "@test.com")
+ "</subject>"
@@ -570,7 +573,7 @@ class MailCommandManagerGetEmailCommand_TestCase(MailCommandManagerTestCase):
self.assertTrue(jcl.tests.is_xml_equal(\
u"<iq from='unknown@" + unicode(self.comp.jid)
+ "' to='test1@test.com' type='error' "
- + "xmlns='http://pyxmpp.jabberstudio.org/xmlns/common'>"
+ + "xmlns='" + PYXMPP_NS + "'>"
+ "<command xmlns='http://jabber.org/protocol/commands' "
+ "node='jmc#get-email' />"
+ "<error type='cancel'>"
diff --git a/src/jmc/model/tests/account.py b/src/jmc/model/tests/account.py
index 3affb13..fb2ec33 100644
--- a/src/jmc/model/tests/account.py
+++ b/src/jmc/model/tests/account.py
@@ -527,7 +527,7 @@ class IMAPAccount_TestCase(InheritableAccount_TestCase):
try:
tested_func()
except Exception, e:
- self.assertEquals(e.message, exception_message)
+ self.assertEquals(str(e), exception_message)
return
self.fail("No exception raised when selecting non existing mailbox")
test_func = self.make_test(\
@@ -608,7 +608,7 @@ class IMAPAccount_TestCase(InheritableAccount_TestCase):
try:
self.imap_account.get_new_mail_list()
except Exception, e:
- self.assertEquals(e.message, "Mailbox does not exist")
+ self.assertEquals(str(e), "Mailbox does not exist")
return
self.fail("No exception raised when selecting non existing mailbox")
test_func = self.make_test(\