Exemple #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)
Exemple #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
Exemple #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)
Exemple #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)
Exemple #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)
Exemple #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)
Exemple #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
Exemple #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)
Exemple #9
0
 def gotNodes(nodeIdentifiers, uri):
     service, nodeIdentifier = gateway.getServiceAndNode(uri)
     self.assertIn(nodeIdentifier, nodeIdentifiers)
Exemple #10
0
 def gotNodes(nodeIdentifiers, uri):
     service, nodeIdentifier = gateway.getServiceAndNode(uri)
     self.assertIn(nodeIdentifier, nodeIdentifiers)