Account test suite implementation

darcs-hash:20061123180515-86b55-fd6db5bd3cba07f2a3d5987d4c92c07f7ec32c5e.gz
This commit is contained in:
David Rousselie
2006-11-23 19:05:15 +01:00
parent 4eabef61f6
commit 8b4ec434ac
3 changed files with 18 additions and 11 deletions

View File

@@ -39,6 +39,7 @@ from tests.jcl.jabber.test_component import *
from tests.jcl.jabber.test_feeder import * from tests.jcl.jabber.test_feeder import *
from tests.jcl.jabber.test_x import * from tests.jcl.jabber.test_x import *
from tests.jcl.test_lang import * from tests.jcl.test_lang import *
from tests.jcl.model.test_account import *
import jcl import jcl
@@ -55,12 +56,14 @@ if __name__ == '__main__':
field_suite = unittest.makeSuite(Field_TestCase, "test") field_suite = unittest.makeSuite(Field_TestCase, "test")
option_suite = unittest.makeSuite(Option_TestCase, "test") option_suite = unittest.makeSuite(Option_TestCase, "test")
lang_suite = unittest.makeSuite(Lang_TestCase, "test") lang_suite = unittest.makeSuite(Lang_TestCase, "test")
account_module_suite = unittest.makeSuite(AccountModule_TestCase, "test")
account_suite = unittest.makeSuite(Account_TestCase, "test")
jcl_suite = unittest.TestSuite() jcl_suite = unittest.TestSuite()
# jcl_suite.addTest(FeederComponent_TestCase('test_handle_tick')) # jcl_suite.addTest(FeederComponent_TestCase('test_handle_tick'))
# jcl_suite.addTest(FeederComponent_TestCase('test_handle_get_register_new')) # jcl_suite.addTest(FeederComponent_TestCase('test_handle_get_register_new'))
# jcl_suite = unittest.TestSuite((feeder_component_suite)) # jcl_suite = unittest.TestSuite((feeder_component_suite))
# jcl_suite = unittest.TestSuite((component_suite)) # jcl_suite = unittest.TestSuite((account_suite))
jcl_suite = unittest.TestSuite((component_suite, \ jcl_suite = unittest.TestSuite((component_suite, \
feeder_component_suite, \ feeder_component_suite, \
feeder_suite, \ feeder_suite, \
@@ -68,7 +71,9 @@ if __name__ == '__main__':
dataform_suite, \ dataform_suite, \
field_suite, \ field_suite, \
option_suite, \ option_suite, \
lang_suite)) lang_suite, \
account_module_suite, \
account_suite))
test_support.run_suite(jcl_suite) test_support.run_suite(jcl_suite)
@@ -77,9 +82,11 @@ coverage.analysis(jcl.jabber.component)
coverage.analysis(jcl.jabber.feeder) coverage.analysis(jcl.jabber.feeder)
coverage.analysis(jcl.jabber.x) coverage.analysis(jcl.jabber.x)
coverage.analysis(jcl.lang) coverage.analysis(jcl.lang)
coverage.analysis(jcl.model.account)
coverage.report([jcl.jabber.component, \ coverage.report([jcl.jabber.component, \
jcl.jabber.feeder, \ jcl.jabber.feeder, \
jcl.jabber.x, \ jcl.jabber.x, \
jcl.lang]) jcl.lang, \
jcl.model.account])

View File

@@ -644,7 +644,7 @@ class JCLComponent(Component, object):
reg_form.fields["name"].value = _account.name reg_form.fields["name"].value = _account.name
reg_form.fields["name"].type = "hidden" reg_form.fields["name"].type = "hidden"
for (field_name, field) in reg_form.fields.items(): for (field_name, field) in reg_form.fields.items():
if hasattr(self.account_class, field_name): if hasattr(_account, field_name):
field.value = str(getattr(_account, field_name)) field.value = str(getattr(_account, field_name))
return reg_form return reg_form

View File

@@ -100,12 +100,12 @@ class Account(SQLObject):
def set_status(self, status): def set_status(self, status):
"""Set current Jabber status""" """Set current Jabber status"""
if status == OFFLINE: if status == OFFLINE:
if hasattr(self.__class__, 'waiting_password_reply') \ if hasattr(self, 'waiting_password_reply') \
and hasattr(self.__class__, 'store_password') \ and hasattr(self, 'store_password') \
and hasattr(self.__class__, 'password'): and hasattr(self, 'password'):
setattr(self.__class__, 'waiting_password_reply', False) setattr(self, 'waiting_password_reply', False)
if not getattr(self.__class__, 'store_password'): if not getattr(self, 'store_password'):
setattr(self.__class__, 'password', None) setattr(self, 'password', None)
else: else:
# TODO seems to be a bug : first_check = True only # TODO seems to be a bug : first_check = True only
# if previous status was OFFLINE # if previous status was OFFLINE