Changeset 73:f574beee3bca in ralphm-patches for roster_server.patch


Ignore:
Timestamp:
May 6, 2013, 10:01:18 PM (7 years ago)
Author:
Ralph Meijer <ralphm@…>
Branch:
default
Children:
74:355afce3af27, 75:9b7b8b99da61
Message:

Minor cleanups, improved error message handling, and upstreamed patch.

  • Upstreamed deprecation of prepareIDNName.
  • MessageProtocol? now properly handles error message stanzas.
  • Renamed methods for RosterServerProtocol?.
  • Prefer connectionInitialized for setting up stanza observers.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • roster_server.patch

    r72 r73  
    2626+
    2727+
    28 +    def test_onRosterGet(self):
     28+    def test_getRosterReceived(self):
    2929+        """
    3030+        A roster get request should trigger getRoster with the request.
    3131+        """
    3232+        xml = """
    33 +          <iq type='get' from='user@example.org' to='user@example.org'>
     33+          <iq type='get' from='user@example.org/Home'>
    3434+            <query xmlns='jabber:iq:roster'/>
    3535+          </iq>
    3636+        """
    3737+
    38 +        def getRoster(request):
    39 +            self.assertEqual(JID('user@example.org'), request.sender)
     38+        def getRosterReceived(request):
     39+            self.assertEqual(JID('user@example.org/Home'), request.sender)
    4040+            item = xmppim.RosterItem(JID('other@example.org'), True, False,
    4141+                                 'The User')
     
    5454+            self.assertEquals(u'The User', item.getAttribute('name'))
    5555+
    56 +        self.service.getRoster = getRoster
     56+        self.service.getRosterReceived = getRosterReceived
    5757+        d = self.handleRequest(xml)
    5858+        d.addCallback(cb)
     
    6060+
    6161+
    62 +    def test_onRosterGetNotOverridden(self):
     62+    def test_getRosterReceivedNotOverridden(self):
    6363+        """
    6464+        If getRoster is not overridden, return feature-not-implemented.
    6565+        """
    6666+        xml = """
    67 +          <iq type='get' from='user@example.org' to='user@example.org'>
     67+          <iq type='get' from='user@example.org/Home'>
    6868+            <query xmlns='jabber:iq:roster'/>
    6969+          </iq>
     
    7575+
    7676+
    77 +    def test_onRosterSet(self):
     77+    def test_setRosterReceived(self):
    7878+        """
    7979+        Roster set is not yet supported.
    8080+        """
    8181+        xml = """
    82 +          <iq type='set' from='user@example.org' to='user@example.org'>
     82+          <iq type='set' from='user@example.org/Home'>
    8383+            <query xmlns='jabber:iq:roster'>
    8484+              <item jid='other@example.org' name='Other User'/>
     
    231231+            return roster.toElement()
    232232+
    233 +        d = self.getRoster(request)
     233+        d = self.getRosterReceived(request)
    234234+        d.addCallback(toResponse)
    235235+        return d
    236236+
    237237+
    238 +    def getRoster(self, request):
     238+    def getRosterReceived(self, request):
    239239+        """
    240240+        Called when the roster is requested.
Note: See TracChangeset for help on using the changeset viewer.