def test_forbiddenResource_customize(self):
        """
        The resource rendered for forbidden requests is stored as a class
        member so that users can customize it.
        """
        base = FilePath(self.mktemp())
        base.setContent(b'')
        markerResponse = b'custom-forbidden-response'

        def failingOpenForReading():
            raise IOError(errno.EACCES, "")

        class CustomForbiddenResource(resource.Resource):
            def render(self, request):
                return markerResponse

        class CustomStaticFile(static.File):
            forbidden = CustomForbiddenResource()

        fileResource = CustomStaticFile(base.path)
        fileResource.openForReading = failingOpenForReading
        request = DummyRequest([b''])

        result = fileResource.render(request)

        self.assertEqual(markerResponse, result)

        The resource rendered for forbidden requests is stored as a class
        member so that users can customize it.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/web/test/test_static.py