Mercurial > libervia-backend
changeset 591:65821b3fa7ab
Fix pep8 support in src/test.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Fri, 18 Jan 2013 17:55:35 +0100 |
parents | 56531f9e9ac7 |
children | e5a875a3311b |
files | src/test/helpers.py src/test/test_core_xmpp.py |
diffstat | 2 files changed, 11 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/test/helpers.py Fri Jan 18 17:55:35 2013 +0100 +++ b/src/test/helpers.py Fri Jan 18 17:55:35 2013 +0100 @@ -26,9 +26,11 @@ TEST_JID = JID(u"test@example.org/SàT") TEST_PROFILE = 'test_profile' + class DifferentArgsException(Exception): pass + class FakeSAT(object): """Class to simulate a SAT instance""" @@ -75,6 +77,7 @@ def delWaitingSub(self, contact_jid, profile_key): pass + class FakeTriggerManager(object): def add(self, point_name, callback): @@ -84,11 +87,13 @@ """We always return true to continue the action""" return True + class FakeParent(object): def __init__(self): self.profile = 'test_profile' self.jid = TEST_JID + def _(text): return text
--- a/src/test/test_core_xmpp.py Fri Jan 18 17:55:35 2013 +0100 +++ b/src/test/test_core_xmpp.py Fri Jan 18 17:55:35 2013 +0100 @@ -29,7 +29,6 @@ from wokkel.xmppim import RosterItem - class SatXMPPClientTest(unittest.TestCase): def setUp(self): @@ -43,6 +42,7 @@ self.assertEqual(self.client.host_app, self.host) self.assertTrue(isinstance(self.client.client_initialized, defer.Deferred)) + class SatMessageProtocolTest(unittest.TestCase): def setUp(self): @@ -60,6 +60,7 @@ self.host.bridge.expectCall("newMessage", "sender@example.net/house", "test", "chat", u"test@example.org/SàT", profile="test_profile") self.message.onMessage(stanza) + class SatRosterProtocolTest(unittest.TestCase): def setUp(self): @@ -74,9 +75,10 @@ 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", 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.roster.onRosterSet(roster_item) + class SatPresenceProtocolTest(unittest.TestCase): def setUp(self): @@ -85,8 +87,8 @@ self.presence.parent = helpers.FakeParent() 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", 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) def test_availableReceived_empty_statuses(self): self.host.bridge.expectCall("presenceUpdate", helpers.TEST_JID_STR, "xa", 15, {}, helpers.TEST_PROFILE) @@ -111,4 +113,3 @@ def test_unsubscribeReceived(self): self.host.bridge.expectCall("subscribe", "unsubscribe", helpers.TEST_JID.userhost(), helpers.TEST_PROFILE) self.presence.unsubscribeReceived(helpers.TEST_JID) -