def test_subscribeReturnsSubscription(self):
        def cb(subscription):
            self.assertEqual(JID('user@example.org'), subscription.subscriber)

        d = self.protocol.subscribe(JID('pubsub.example.org'), 'test',
                                      JID('user@example.org'))
        d.addCallback(cb)

        iq = self.stub.output[-1]

        response = toResponse(iq, 'result')
        pubsub = response.addElement((NS_PUBSUB, 'pubsub'))
        subscription = pubsub.addElement('subscription')
        subscription['node'] = 'test'
        subscription['jid'] = 'user@example.org'
        subscription['subscription'] = 'subscribed'
        self.stub.send(response)
        return d
A successful subscription should return a Subscription instance.
dataset/ETHPy150Open ralphm/wokkel/wokkel/test/test_pubsub.py/PubSubClientTest.test_subscribeReturnsSubscription