Esempio n. 1
0
 def test_basic(self):
     """
     getServiceAndNode parses an XMPP URI with node parameter.
     """
     uri = b'xmpp:pubsub.example.org?;node=test'
     service, nodeIdentifier = gateway.getServiceAndNode(uri)
     self.assertEqual(JID(u'pubsub.example.org'), service)
     self.assertEqual(u'test', nodeIdentifier)
Esempio n. 2
0
        def cb(response):
            xmppURI = response['uri']
            jid, nodeIdentifier = gateway.getServiceAndNode(xmppURI)
            rootNode = gateway.getXMPPURI(jid, '')

            d = self.client.subscribe(rootNode)
            d.addCallback(lambda _: xmppURI)
            return d
Esempio n. 3
0
 def test_basic(self):
     """
     getServiceAndNode parses an XMPP URI with node parameter.
     """
     uri = b'xmpp:pubsub.example.org?;node=test'
     service, nodeIdentifier = gateway.getServiceAndNode(uri)
     self.assertEqual(JID(u'pubsub.example.org'), service)
     self.assertEqual(u'test', nodeIdentifier)
Esempio n. 4
0
    def test_nodeAbsent(self):
        """
        If the node parameter is missing, the nodeIdentifier is empty.
        """
        uri = b'xmpp:pubsub.example.org?'
        service, nodeIdentifier = gateway.getServiceAndNode(uri)

        self.assertEqual(JID(u'pubsub.example.org'), service)
        self.assertEqual(u'', nodeIdentifier)
Esempio n. 5
0
    def test_queryEmpty(self):
        """
        If there is no query component, the nodeIdentifier is empty.
        """
        uri = b'xmpp:pubsub.example.org'
        service, nodeIdentifier = gateway.getServiceAndNode(uri)

        self.assertEqual(JID(u'pubsub.example.org'), service)
        self.assertEqual(u'', nodeIdentifier)
Esempio n. 6
0
    def test_queryEmpty(self):
        """
        If there is no query component, the nodeIdentifier is empty.
        """
        uri = b'xmpp:pubsub.example.org'
        service, nodeIdentifier = gateway.getServiceAndNode(uri)

        self.assertEqual(JID(u'pubsub.example.org'), service)
        self.assertEqual(u'', nodeIdentifier)
Esempio n. 7
0
        def cb(response):
            xmppURI = response['uri']
            jid, nodeIdentifier = gateway.getServiceAndNode(xmppURI)
            rootNode = gateway.getXMPPURI(jid, '')

            d = self.client.subscribe(rootNode)
            d.addCallback(lambda _: self.addCleanup(clean, rootNode))
            d.addCallback(lambda _: xmppURI)
            return d
Esempio n. 8
0
    def test_nodeAbsent(self):
        """
        If the node parameter is missing, the nodeIdentifier is empty.
        """
        uri = b'xmpp:pubsub.example.org?'
        service, nodeIdentifier = gateway.getServiceAndNode(uri)

        self.assertEqual(JID(u'pubsub.example.org'), service)
        self.assertEqual(u'', nodeIdentifier)
Esempio n. 9
0
 def gotNodes(nodeIdentifiers, uri):
     service, nodeIdentifier = gateway.getServiceAndNode(uri)
     self.assertIn(nodeIdentifier, nodeIdentifiers)
Esempio n. 10
0
 def gotNodes(nodeIdentifiers, uri):
     service, nodeIdentifier = gateway.getServiceAndNode(uri)
     self.assertIn(nodeIdentifier, nodeIdentifiers)