2009-10-25 23:56:14 +01:00
|
|
|
'''
|
|
|
|
Test for Contact, GC_Contact and Contacts
|
|
|
|
'''
|
|
|
|
import unittest
|
|
|
|
|
|
|
|
import lib
|
|
|
|
lib.setup_env()
|
|
|
|
|
2009-10-27 20:31:09 +01:00
|
|
|
from common.contacts import Contact, GC_Contact
|
2009-10-26 19:20:16 +01:00
|
|
|
from common.caps import NullClientCaps
|
2009-10-27 20:31:09 +01:00
|
|
|
from common.xmpp import NS_MUC
|
2009-10-25 23:56:14 +01:00
|
|
|
|
2009-10-27 20:31:09 +01:00
|
|
|
class TestCommonContact(unittest.TestCase):
|
|
|
|
|
|
|
|
def setUp(self):
|
|
|
|
self.contact = Contact()
|
2009-10-25 23:56:14 +01:00
|
|
|
|
2009-10-27 20:31:09 +01:00
|
|
|
def test_default_client_supports(self):
|
|
|
|
'''
|
|
|
|
Test the caps support method of contacts.
|
|
|
|
See test_caps for more enhanced tests.
|
|
|
|
'''
|
|
|
|
|
|
|
|
self.assertTrue(self.contact.supports(NS_MUC),
|
|
|
|
msg="Must not backtrace on simple check for supported feature")
|
|
|
|
|
2009-10-27 22:41:39 +01:00
|
|
|
self.contact.client_caps = NullClientCaps()
|
2009-10-27 20:31:09 +01:00
|
|
|
|
|
|
|
self.assertTrue(self.contact.supports(NS_MUC),
|
|
|
|
msg="Must not backtrace on simple check for supported feature")
|
|
|
|
|
2009-10-25 23:56:14 +01:00
|
|
|
|
2009-10-27 20:31:09 +01:00
|
|
|
class TestContact(TestCommonContact):
|
|
|
|
|
|
|
|
def setUp(self):
|
|
|
|
TestCommonContact.setUp(self)
|
|
|
|
self.contact = Contact()
|
|
|
|
|
|
|
|
|
|
|
|
class TestGC_Contact(TestCommonContact):
|
|
|
|
|
|
|
|
def setUp(self):
|
|
|
|
TestCommonContact.setUp(self)
|
|
|
|
self.contact = GC_Contact()
|
2009-10-25 23:56:14 +01:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
unittest.main()
|