def test_indexNames(self):
        """
        If a request is made which encounters a L{File} before a final empty
        segment, a file in the L{File} instance's C{indexNames} list which
        exists in the path the L{File} was created with is served as the
        response to the request.
        """
        base = FilePath(self.mktemp())
        base.makedirs()
        base.child("foo.bar").setContent(b"baz")
        file = static.File(base.path)
        file.indexNames = ['foo.bar']

        request = DummyRequest([b''])
        child = resource.getChildForRequest(file, request)

        d = self._render(child, request)
        def cbRendered(ignored):
            self.assertEqual(b''.join(request.written), b'baz')
            self.assertEqual(
                request.responseHeaders.getRawHeaders(b'content-length')[0],
                b'3')
        d.addCallback(cbRendered)
        return d

        If a request is made which encounters a L{File} before a final empty
        segment, a file in the L{File} instance's C{indexNames} list which
        exists in the path the L{File} was created with is served as the
        response to the request.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/web/test/test_static.py