changeset 1424:2d8fccec84e8

core (tests): test fixes
author Goffi <goffi@goffi.org>
date Thu, 23 Apr 2015 14:19:43 +0200
parents 882e5fabf68c
children 7f8af1e69812
files src/test/test_plugin_misc_groupblog.py src/test/test_plugin_xep_0313.py src/tmp/wokkel/delay.py src/tmp/wokkel/mam.py src/tmp/wokkel/pubsub.py src/tmp/wokkel/rsm.py
diffstat 6 files changed, 15 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/test/test_plugin_misc_groupblog.py	Thu Apr 23 13:35:21 2015 +0200
+++ b/src/test/test_plugin_misc_groupblog.py	Thu Apr 23 14:19:43 2015 +0200
@@ -151,15 +151,16 @@
         if not self.__initialised:
             client.item_access_pubsub = jid.JID(SERVICE)
             xep_0060 = self.host.plugins['XEP-0060']
-            xep_0060.clients[profile] = helpers_plugins.FakeSatPubSubClient(self.host, xep_0060)
-            xep_0060.clients[profile].parent = client
-            self.psclient = xep_0060.clients[profile]
+            client.pubsub_client = helpers_plugins.FakeSatPubSubClient(self.host, xep_0060)
+            client.pubsub_client.parent = client
+            self.psclient = client.pubsub_client
             helpers.FakeSAT.getDiscoItems = self.psclient.service_getDiscoItems
             self.__initialised = True
         return defer.succeed((profile, client))
 
     def _addItem(self, profile, item, parent_node=None):
-        self.host.plugins['XEP-0060'].clients[profile]._addItem(item, parent_node)
+        client = self.host.getClient(profile)
+        client.pubsub_client._addItem(item, parent_node)
 
     def test_sendGroupBlog(self):
         self._initialise(C.PROFILE[0])
--- a/src/test/test_plugin_xep_0313.py	Thu Apr 23 13:35:21 2015 +0200
+++ b/src/test/test_plugin_xep_0313.py	Thu Apr 23 14:19:43 2015 +0200
@@ -151,7 +151,7 @@
         """ % (("H_%d" % domish.Element._idCounter), SERVICE)
         start = datetime.datetime(2010, 8, 7, 0, 0, 0, tzinfo=tzutc())
         form = buildForm(start=start)
-        rsm = RSMRequest(max=10)
+        rsm = RSMRequest(max_=10)
         d = self.plugin.queryArchive(SERVICE_JID, form=form, rsm=rsm, profile_key=C.PROFILE[0])
         d.addCallback(lambda dummy: self.assertEqualXML(self.host.getSentMessageXml(0), xml, True))
         return d
@@ -173,7 +173,7 @@
         """ % (("H_%d" % domish.Element._idCounter), SERVICE)
         start = datetime.datetime(2010, 8, 7, 0, 0, 0, tzinfo=tzutc())
         form = buildForm(start=start)
-        rsm = RSMRequest(max=10, after=u'09af3-cc343-b409f')
+        rsm = RSMRequest(max_=10, after=u'09af3-cc343-b409f')
         d = self.plugin.queryArchive(SERVICE_JID, form=form, rsm=rsm, profile_key=C.PROFILE[0])
         d.addCallback(lambda dummy: self.assertEqualXML(self.host.getSentMessageXml(0), xml, True))
         return d
--- a/src/tmp/wokkel/delay.py	Thu Apr 23 13:35:21 2015 +0200
+++ b/src/tmp/wokkel/delay.py	Thu Apr 23 14:19:43 2015 +0200
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 # -*- test-case-name: wokkel.test.test_delay -*-
 #
 # SàT adaptation for wokkel.delay
--- a/src/tmp/wokkel/mam.py	Thu Apr 23 13:35:21 2015 +0200
+++ b/src/tmp/wokkel/mam.py	Thu Apr 23 14:19:43 2015 +0200
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 # -*- test-case-name: wokkel.test.test_mam -*-
 #
 # SàT Wokkel extension for Message Archive Management (XEP-0313)
@@ -157,8 +158,9 @@
     @type never: C{list}
     """
 
-    def __init__(self, default, always=None, never=None):
-        assert default in ('always', 'never', 'roster')
+    def __init__(self, default=None, always=None, never=None):
+        if default is not None:
+            assert default in ('always', 'never', 'roster')
         self.default = default
         if always is not None:
             assert isinstance(always, list)
--- a/src/tmp/wokkel/pubsub.py	Thu Apr 23 13:35:21 2015 +0200
+++ b/src/tmp/wokkel/pubsub.py	Thu Apr 23 14:19:43 2015 +0200
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 # -*- test-case-name: wokkel.test.test_pubsub -*-
 #
 # SàT adaptation for wokkel.pubsub
@@ -1256,7 +1257,7 @@
             if request is None:
                 return defer.succeed(None)
 
-        # Process the request itself, 
+        # Process the request itself,
         if resource is not self:
             try:
                 handler = getattr(resource, request.verb)
--- a/src/tmp/wokkel/rsm.py	Thu Apr 23 13:35:21 2015 +0200
+++ b/src/tmp/wokkel/rsm.py	Thu Apr 23 14:19:43 2015 +0200
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 # -*- test-case-name: wokkel.test.test_rsm -*-
 #
 # SàT Wokkel extension for Result Set Management (XEP-0059)