Пример #1
0
    def _parseStreamServerTest(self, addressFamily, addressFamilyString):
        """
        Helper for unit tests for L{endpoints._SystemdParser.parseStreamServer}
        for different address families.

        Handling of the address family given will be verify.  If there is a
        problem a test-failing exception will be raised.

        @param addressFamily: An address family constant, like L{socket.AF_INET}.

        @param addressFamilyString: A string which should be recognized by the
            parser as representing C{addressFamily}.
        """
        reactor = object()
        descriptors = [5, 6, 7, 8, 9]
        index = 3

        parser = self._parserClass()
        parser._sddaemon = ListenFDs(descriptors)

        server = parser.parseStreamServer(reactor,
                                          domain=addressFamilyString,
                                          index=str(index))
        self.assertIdentical(server.reactor, reactor)
        self.assertEqual(server.addressFamily, addressFamily)
        self.assertEqual(server.fileno, descriptors[index])
Пример #2
0
 def getDaemon(self, start, count):
     """
     Invent C{count} new I{file descriptors} (actually integers, attached to
     no real file description), starting at C{start}.  Construct and return a
     new L{ListenFDs} which will claim those integers represent inherited
     file descriptors.
     """
     return ListenFDs(range(start, start + count))