Ignore:
Timestamp:
Aug 30, 2016, 9:42:32 PM (5 years ago)
Author:
souliane <souliane@…>
Branch:
default
committer:
souliane <souliane@mailoo.org> 1472587266 -7200
hg-git-rename-source:
git
Message:

implement item retract + notification

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wokkel/test/test_pubsub.py

    r183 r225  
    841841
    842842
     843    def test_retractItems(self):
     844        """
     845        Test sending items retraction.
     846        """
     847        d = self.protocol.retractItems(JID('pubsub.example.org'), 'test',
     848                                       itemIdentifiers=['item1', 'item2'])
     849
     850        iq = self.stub.output[-1]
     851        self.assertEquals('pubsub.example.org', iq.getAttribute('to'))
     852        self.assertEquals('set', iq.getAttribute('type'))
     853        self.assertEquals('pubsub', iq.pubsub.name)
     854        self.assertEquals(NS_PUBSUB, iq.pubsub.uri)
     855        children = list(domish.generateElementsQNamed(iq.pubsub.children,
     856                                                      'retract', NS_PUBSUB))
     857        self.assertEquals(1, len(children))
     858        child = children[0]
     859        self.assertEquals('test', child['node'])
     860        itemIdentifiers = [item.getAttribute('id') for item in
     861                           domish.generateElementsQNamed(child.children, 'item',
     862                                                         NS_PUBSUB)]
     863        self.assertEquals(['item1', 'item2'], itemIdentifiers)
     864
     865        self.stub.send(toResponse(iq, 'result'))
     866        return d
     867
     868
     869    def test_retractItemsWithSender(self):
     870        """
     871        Test retracting items request from a specific JID.
     872        """
     873        d = self.protocol.retractItems(JID('pubsub.example.org'), 'test',
     874                                       itemIdentifiers=['item1', 'item2'],
     875                                       sender=JID('user@example.org'))
     876
     877        iq = self.stub.output[-1]
     878        self.assertEquals('user@example.org', iq['from'])
     879
     880        self.stub.send(toResponse(iq, 'result'))
     881        return d
     882
     883
    843884    def test_getOptions(self):
    844885        def cb(form):
Note: See TracChangeset for help on using the changeset viewer.