diff --git a/run_tests.py b/run_tests.py index 2b38bf1..81c4c03 100644 --- a/run_tests.py +++ b/run_tests.py @@ -39,6 +39,7 @@ from tests.jcl.jabber.test_component import * from tests.jcl.jabber.test_feeder import * from tests.jcl.jabber.test_x import * from tests.jcl.test_lang import * +from tests.jcl.model.test_account import * import jcl @@ -55,12 +56,14 @@ if __name__ == '__main__': field_suite = unittest.makeSuite(Field_TestCase, "test") option_suite = unittest.makeSuite(Option_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.addTest(FeederComponent_TestCase('test_handle_tick')) # jcl_suite.addTest(FeederComponent_TestCase('test_handle_get_register_new')) # 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, \ feeder_component_suite, \ feeder_suite, \ @@ -68,7 +71,9 @@ if __name__ == '__main__': dataform_suite, \ field_suite, \ option_suite, \ - lang_suite)) + lang_suite, \ + account_module_suite, \ + account_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.x) coverage.analysis(jcl.lang) +coverage.analysis(jcl.model.account) coverage.report([jcl.jabber.component, \ jcl.jabber.feeder, \ jcl.jabber.x, \ - jcl.lang]) + jcl.lang, \ + jcl.model.account]) diff --git a/src/jcl/jabber/component.py b/src/jcl/jabber/component.py index 65877f0..f3c2524 100644 --- a/src/jcl/jabber/component.py +++ b/src/jcl/jabber/component.py @@ -644,7 +644,7 @@ class JCLComponent(Component, object): reg_form.fields["name"].value = _account.name reg_form.fields["name"].type = "hidden" 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)) return reg_form diff --git a/src/jcl/model/account.py b/src/jcl/model/account.py index f4e0b2e..c5fb6fb 100644 --- a/src/jcl/model/account.py +++ b/src/jcl/model/account.py @@ -100,12 +100,12 @@ class Account(SQLObject): def set_status(self, status): """Set current Jabber status""" if status == OFFLINE: - if hasattr(self.__class__, 'waiting_password_reply') \ - and hasattr(self.__class__, 'store_password') \ - and hasattr(self.__class__, 'password'): - setattr(self.__class__, 'waiting_password_reply', False) - if not getattr(self.__class__, 'store_password'): - setattr(self.__class__, 'password', None) + if hasattr(self, 'waiting_password_reply') \ + and hasattr(self, 'store_password') \ + and hasattr(self, 'password'): + setattr(self, 'waiting_password_reply', False) + if not getattr(self, 'store_password'): + setattr(self, 'password', None) else: # TODO seems to be a bug : first_check = True only # if previous status was OFFLINE