Commit 3c31574c authored by André's avatar André

Unittest: replace deprecated functions

parent f569084b
......@@ -101,7 +101,7 @@ class TestStatusChange(unittest.TestCase):
break
if not still_exists:
self.assert_(contact is None)
self.assertTrue(contact is None)
return
self.assertEqual('offline', contact.show)
......
......@@ -74,13 +74,13 @@ class TestRosterWindow(unittest.TestCase):
c_model = self.roster.model[titerC]
# name can be stricked if contact or group is blocked
# self.assertEquals(contact.get_shown_name(), c_model[self.C_NAME],
# self.assertEqual(contact.get_shown_name(), c_model[self.C_NAME],
# msg='Contact name missmatch')
self.assertEquals(contact.jid, c_model[self.C_JID],
self.assertEqual(contact.jid, c_model[self.C_JID],
msg='Jid missmatch')
if not self.roster.regroup:
self.assertEquals(account, c_model[self.C_ACCOUNT],
self.assertEqual(account, c_model[self.C_ACCOUNT],
msg='Account missmatch')
# Check for correct nesting
......@@ -111,15 +111,15 @@ class TestRosterWindow(unittest.TestCase):
msg='Account iter is invalid')
acc_model = self.roster.model[titerA]
self.assertEquals(acc_model[self.C_TYPE], 'account',
self.assertEqual(acc_model[self.C_TYPE], 'account',
msg='No account found')
if not self.roster.regroup:
self.assertEquals(acc_model[self.C_ACCOUNT], acc,
self.assertEqual(acc_model[self.C_ACCOUNT], acc,
msg='Account not found')
self_jid = app.get_jid_from_account(acc)
self.assertEquals(acc_model[self.C_JID], self_jid,
self.assertEqual(acc_model[self.C_JID], self_jid,
msg='Account JID not found in account row')
def assert_model_is_in_sync(self):
......@@ -139,7 +139,7 @@ class TestRosterWindow(unittest.TestCase):
# Contacts kept their info
contact = instances[0]
self.assertEquals(sorted(contact.groups), sorted(contacts[acc][jid]['groups']),
self.assertEqual(sorted(contact.groups), sorted(contacts[acc][jid]['groups']),
msg='Group Missmatch')
groups = contacts[acc][jid]['groups'] or ['General',]
......
......@@ -77,10 +77,10 @@ class PluginManagerTestCase(unittest.TestCase):
self.pluginmanager.test_arg = 1
secondPluginManager = PluginManager()
self.failUnlessEqual(id(secondPluginManager), id(self.pluginmanager),
'Different IDs in references to PluginManager objects (not a singleton)')
self.failUnlessEqual(secondPluginManager.test_arg, 1,
'References point to different PluginManager objects (not a singleton')
self.assertEqual(id(secondPluginManager), id(self.pluginmanager),
'Different IDs in references to PluginManager objects (not a singleton)')
self.assertEqual(secondPluginManager.test_arg, 1,
'References point to different PluginManager objects (not a singleton')
def suite():
suite = unittest.TestLoader().loadTestsFromTestCase(PluginManagerTestCase)
......
......@@ -13,7 +13,7 @@ class Test(unittest.TestCase):
def testInstantiate(self):
account = Account(name='MyAcc', contacts=None, gc_contacts=None)
self.assertEquals('MyAcc', account.name)
self.assertEqual('MyAcc', account.name)
self.assertTrue(account.gc_contacts is None)
self.assertTrue(account.contacts is None)
......
......@@ -44,8 +44,8 @@ class TestCapsCache(CommonCapsTest):
self.cc[self.client_caps].identities = self.identities
self.cc[self.client_caps].features = self.features
self.assert_(NS_MUC in self.cc[self.client_caps].features)
self.assert_(NS_PING not in self.cc[self.client_caps].features)
self.assertTrue(NS_MUC in self.cc[self.client_caps].features)
self.assertTrue(NS_PING not in self.cc[self.client_caps].features)
identities = self.cc[self.client_caps].identities
......
......@@ -39,15 +39,15 @@ class TestStanzaSession(unittest.TestCase):
def test_generate_thread_id(self):
# thread_id is a string
self.assert_(isinstance(self.sess.thread_id, str))
self.assertTrue(isinstance(self.sess.thread_id, str))
# it should be somewhat long, to avoid clashes
self.assert_(len(self.sess.thread_id) >= 32)
self.assertTrue(len(self.sess.thread_id) >= 32)
def test_is_loggable(self):
# by default a session should be loggable
# (unless the no_log_for setting says otherwise)
self.assert_(self.sess.is_loggable())
self.assertTrue(self.sess.is_loggable())
def test_terminate(self):
# termination is sent by default
......@@ -127,7 +127,7 @@ class TestChatControlSession(unittest.TestCase):
self.assert_new_message_notification()
notif = notify.notifications[-1]
first = notif.first_unread
self.assert_(first,
self.assertTrue(first,
'message should have been treated as a first message')
def assert_not_first_message_notification(self):
......@@ -135,7 +135,7 @@ class TestChatControlSession(unittest.TestCase):
self.assert_new_message_notification()
notif = notify.notifications[-1]
first = notif.first_unread
self.assert_(not first,
self.assertTrue(not first,
'message was unexpectedly treated as a first message')
# ----- tests -----
......@@ -148,7 +148,7 @@ class TestChatControlSession(unittest.TestCase):
self.receive_chat_msg(fjid, msgtxt)
# session is created
self.assert_((jid in self.conn.sessions) and (
self.assertTrue((jid in self.conn.sessions) and (
'123' in self.conn.sessions[jid]), 'session is not created')
sess = self.conn.sessions[jid]['123']
......
......@@ -114,10 +114,10 @@ class TestSocks5(unittest.TestCase):
s.connect(server)
s.send(mocksock.outgoing.pop(0))
self.assertEquals(s.recv(64), mocksock.incoming.pop(0))
self.assertEqual(s.recv(64), mocksock.incoming.pop(0))
s.send(mocksock.outgoing.pop(0))
self.assertEquals(s.recv(64), mocksock.incoming.pop(0))
self.assertEqual(s.recv(64), mocksock.incoming.pop(0))
def test_connection_client(self):
......@@ -138,12 +138,12 @@ class TestSocks5(unittest.TestCase):
(s, address) = s.accept()
self.assertEquals(s.recv(64), mocksock.incoming.pop(0))
self.assertEqual(s.recv(64), mocksock.incoming.pop(0))
s.send(mocksock.outgoing.pop(0))
buff = s.recv(64)
inco = mocksock.incoming.pop(0)
#self.assertEquals(s.recv(64), mocksock.incoming.pop(0))
#self.assertEqual(s.recv(64), mocksock.incoming.pop(0))
s.send(mocksock.outgoing.pop(0))
def test_client_negoc(self):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment