示例#1
0
 def test_unicodeHalfwidthIdeographicFullStop(self):
     """
     Exotic dots in unicode names are converted to Full Stop.
     """
     name = u"\u00e9chec.example\uff61com"
     result = generic.prepareIDNName(name)
     self.assertEqual(b"xn--chec-9oa.example.com", result)
示例#2
0
 def test_unicode(self):
     """
     A unicode all-ASCII name is converted to an ASCII byte string.
     """
     name = u"example.com"
     result = generic.prepareIDNName(name)
     self.assertEqual(b"example.com", result)
示例#3
0
 def test_unicodeNonASCII(self):
     """
     A unicode with non-ASCII is converted to its ACE equivalent.
     """
     name = u"\u00e9chec.example.com"
     result = generic.prepareIDNName(name)
     self.assertEqual(b"xn--chec-9oa.example.com", result)
示例#4
0
 def test_unicodeHalfwidthIdeographicFullStop(self):
     """
     Exotic dots in unicode names are converted to Full Stop.
     """
     name = u"\u00e9chec.example\uff61com"
     result = generic.prepareIDNName(name)
     self.assertEqual(b"xn--chec-9oa.example.com", result)
示例#5
0
 def test_unicodeNonASCII(self):
     """
     A unicode with non-ASCII is converted to its ACE equivalent.
     """
     name = u"\u00e9chec.example.com"
     result = generic.prepareIDNName(name)
     self.assertEqual(b"xn--chec-9oa.example.com", result)
示例#6
0
 def test_unicode(self):
     """
     A unicode all-ASCII name is converted to an ASCII byte string.
     """
     name = u"example.com"
     result = generic.prepareIDNName(name)
     self.assertEqual(b"example.com", result)
示例#7
0
 def test_bytestring(self):
     """
     An ASCII-encoded byte string is left as-is.
     """
     name = b"example.com"
     result = generic.prepareIDNName(name)
     self.assertEqual(b"example.com", result)
示例#8
0
 def test_bytestring(self):
     """
     An ASCII-encoded byte string is left as-is.
     """
     name = b"example.com"
     result = generic.prepareIDNName(name)
     self.assertEqual(b"example.com", result)
示例#9
0
文件: client.py 项目: musabaloyi/vumi
    def __init__(self, jid, password, host=None, port=5222):
        self.jid = jid
        self.domain = generic.prepareIDNName(jid.host)
        self.host = host
        self.port = port

        factory = HybridClientFactory(jid, password)

        StreamManager.__init__(self, factory)
示例#10
0
    def test_unicodeTrailingDot(self):
        """
        Unicode names with trailing dots retain the trailing dot.

        L{encodings.idna.ToASCII} doesn't allow the empty string as the input,
        hence the implementation needs to strip a trailing dot, and re-add it
        after encoding the labels.
        """
        name = u"example.com."
        result = generic.prepareIDNName(name)
        self.assertEqual(b"example.com.", result)
示例#11
0
    def test_unicodeTrailingDot(self):
        """
        Unicode names with trailing dots retain the trailing dot.

        L{encodings.idna.ToASCII} doesn't allow the empty string as the input,
        hence the implementation needs to strip a trailing dot, and re-add it
        after encoding the labels.
        """
        name = u"example.com."
        result = generic.prepareIDNName(name)
        self.assertEqual(b"example.com.", result)
示例#12
0
def initiateS2S(factory):
    domain = prepareIDNName(factory.authenticator.otherHost)
    c = XMPPServerConnector(reactor, domain, factory)
    c.connect()
    return factory.deferred
示例#13
0
文件: client.py 项目: musabaloyi/vumi
def clientCreator(factory):
    domain = generic.prepareIDNName(factory.authenticator.jid.host)
    c = XMPPClientConnector(reactor, domain, factory)
    c.connect()
    return factory.deferred
示例#14
0
def initiateS2S(factory):
    domain = prepareIDNName(factory.authenticator.otherHost)
    c = XMPPServerConnector(reactor, domain, factory)
    c.connect()
    return factory.deferred