Beispiel #1
0
 def testNameToLabel(self):
     """
     Test the various kinds of inputs L{nameToLabel} supports.
     """
     nameData = [
         ('f', 'F'),
         ('fo', 'Fo'),
         ('foo', 'Foo'),
         ('fooBar', 'Foo Bar'),
         ('fooBarBaz', 'Foo Bar Baz'),
     ]
     for inp, out in nameData:
         got = util.nameToLabel(inp)
         self.assertEquals(got, out,
                           "nameToLabel(%r) == %r != %r" % (inp, got, out))
Beispiel #2
0
 def testNameToLabel(self):
     """
     Test the various kinds of inputs L{nameToLabel} supports.
     """
     nameData = [
         ('f', 'F'),
         ('fo', 'Fo'),
         ('foo', 'Foo'),
         ('fooBar', 'Foo Bar'),
         ('fooBarBaz', 'Foo Bar Baz'),
         ]
     for inp, out in nameData:
         got = util.nameToLabel(inp)
         self.assertEquals(
             got, out,
             "nameToLabel(%r) == %r != %r" % (inp, got, out))
Beispiel #3
0
 def inspect(self):
     """
     Return a multi-line, human-readable representation of this DN.
     """
     l = []
     lablen = 0
     def uniqueValues(mapping):
         return dict.fromkeys(mapping.itervalues()).keys()
     for k in uniqueValues(_x509names):
         label = util.nameToLabel(k)
         lablen = max(len(label), lablen)
         v = getattr(self, k, None)
         if v is not None:
             l.append((label, v))
     lablen += 2
     for n, (label, attr) in enumerate(l):
         l[n] = (label.rjust(lablen)+': '+ attr)
     return '\n'.join(l)
Beispiel #4
0
    def inspect(self):
        """
        Return a multi-line, human-readable representation of this DN.
        """
        l = []
        lablen = 0

        def uniqueValues(mapping):
            return dict.fromkeys(mapping.itervalues()).keys()

        for k in uniqueValues(_x509names):
            label = util.nameToLabel(k)
            lablen = max(len(label), lablen)
            v = getattr(self, k, None)
            if v is not None:
                l.append((label, v))
        lablen += 2
        for n, (label, attr) in enumerate(l):
            l[n] = (label.rjust(lablen) + ': ' + attr)
        return '\n'.join(l)