diff src/test/test_core_xmpp.py @ 780:9810f22ba733

test: store the constants in constants.py + better PEP8 compliance
author souliane <souliane@mailoo.org>
date Sat, 04 Jan 2014 15:45:08 +0100
parents e20c823f23e2
children 2136be5a44a8
line wrap: on
line diff
--- a/src/test/test_core_xmpp.py	Sat Jan 04 21:13:51 2014 +0100
+++ b/src/test/test_core_xmpp.py	Sat Jan 04 15:45:08 2014 +0100
@@ -18,6 +18,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 from sat.test import helpers
+from constants import Const
 from twisted.trial import unittest
 from sat.core.sat_main import SAT
 from sat.core import xmpp
@@ -67,13 +68,13 @@
         self.roster.parent = helpers.FakeClient(self.host)
 
     def test_onRosterSet(self):
-        roster_item = RosterItem(helpers.TEST_JID)
+        roster_item = RosterItem(Const.TEST_JID)
         roster_item.name = u"Test Man"
         roster_item.subscriptionTo = True
         roster_item.subscriptionFrom = True
         roster_item.ask = False
         roster_item.groups = set([u"Test Group 1", u"Test Group 2", u"Test Group 3"])
-        self.host.bridge.expectCall("newContact", helpers.TEST_JID_STR, {'to': 'True', 'from': 'True', 'ask': 'False', 'name': u'Test Man'}, set([u"Test Group 1", u"Test Group 2", u"Test Group 3"]), "test_profile")
+        self.host.bridge.expectCall("newContact", Const.TEST_JID_STR, {'to': 'True', 'from': 'True', 'ask': 'False', 'name': u'Test Man'}, set([u"Test Group 1", u"Test Group 2", u"Test Group 3"]), "test_profile")
         self.roster.onRosterSet(roster_item)
 
 
@@ -85,29 +86,29 @@
         self.presence.parent = helpers.FakeClient(self.host)
 
     def test_availableReceived(self):
-        self.host.bridge.expectCall("presenceUpdate", helpers.TEST_JID_STR, "xa", 15, {'default': "test status", 'fr': 'statut de test'}, helpers.TEST_PROFILE)
-        self.presence.availableReceived(helpers.TEST_JID, 'xa', {None: "test status", 'fr': 'statut de test'}, 15)
+        self.host.bridge.expectCall("presenceUpdate", Const.TEST_JID_STR, "xa", 15, {'default': "test status", 'fr': 'statut de test'}, Const.TEST_PROFILE)
+        self.presence.availableReceived(Const.TEST_JID, 'xa', {None: "test status", 'fr': 'statut de test'}, 15)
 
     def test_availableReceived_empty_statuses(self):
-        self.host.bridge.expectCall("presenceUpdate", helpers.TEST_JID_STR, "xa", 15, {}, helpers.TEST_PROFILE)
-        self.presence.availableReceived(helpers.TEST_JID, 'xa', None, 15)
+        self.host.bridge.expectCall("presenceUpdate", Const.TEST_JID_STR, "xa", 15, {}, Const.TEST_PROFILE)
+        self.presence.availableReceived(Const.TEST_JID, 'xa', None, 15)
 
     def test_unavailableReceived(self):
-        self.host.bridge.expectCall("presenceUpdate", helpers.TEST_JID_STR, "unavailable", 0, {}, helpers.TEST_PROFILE)
-        self.presence.unavailableReceived(helpers.TEST_JID, None)
+        self.host.bridge.expectCall("presenceUpdate", Const.TEST_JID_STR, "unavailable", 0, {}, Const.TEST_PROFILE)
+        self.presence.unavailableReceived(Const.TEST_JID, None)
 
     def test_subscribedReceived(self):
-        self.host.bridge.expectCall("subscribe", "subscribed", helpers.TEST_JID.userhost(), helpers.TEST_PROFILE)
-        self.presence.subscribedReceived(helpers.TEST_JID)
+        self.host.bridge.expectCall("subscribe", "subscribed", Const.TEST_JID.userhost(), Const.TEST_PROFILE)
+        self.presence.subscribedReceived(Const.TEST_JID)
 
     def test_unsubscribedReceived(self):
-        self.host.bridge.expectCall("subscribe", "unsubscribed", helpers.TEST_JID.userhost(), helpers.TEST_PROFILE)
-        self.presence.unsubscribedReceived(helpers.TEST_JID)
+        self.host.bridge.expectCall("subscribe", "unsubscribed", Const.TEST_JID.userhost(), Const.TEST_PROFILE)
+        self.presence.unsubscribedReceived(Const.TEST_JID)
 
     def test_subscribeReceived(self):
-        self.host.bridge.expectCall("subscribe", "subscribe", helpers.TEST_JID.userhost(), helpers.TEST_PROFILE)
-        self.presence.subscribeReceived(helpers.TEST_JID)
+        self.host.bridge.expectCall("subscribe", "subscribe", Const.TEST_JID.userhost(), Const.TEST_PROFILE)
+        self.presence.subscribeReceived(Const.TEST_JID)
 
     def test_unsubscribeReceived(self):
-        self.host.bridge.expectCall("subscribe", "unsubscribe", helpers.TEST_JID.userhost(), helpers.TEST_PROFILE)
-        self.presence.unsubscribeReceived(helpers.TEST_JID)
+        self.host.bridge.expectCall("subscribe", "unsubscribe", Const.TEST_JID.userhost(), Const.TEST_PROFILE)
+        self.presence.unsubscribeReceived(Const.TEST_JID)