def METHOD_NAME(config_file: str = 'pygeoapi-test-config.yml', **kwargs) -> StarletteClient:  # noqa
    """
    Mocks a Starlette client so we can test the API routing with applied
    API rules.
    Does not follow redirects by default. Set `follow_redirects=True` option
    on individual requests to enable.
    :param config_file: Optional configuration YAML file to use.
                        If not set, the default test configuration is used.
    """
    starlette_app = None
    env_conf = os.getenv('PYGEOAPI_CONFIG')
    try:
        # Temporarily override environment variable to import Starlette app
        os.environ['PYGEOAPI_CONFIG'] = get_test_file_path(config_file)
        # Import current pygeoapi Starlette app module
        from pygeoapi import starlette_app
        # Force a module reload to make sure we really use another config
        reload(starlette_app)
        # Get server root path
        base_url = starlette_app.CONFIG['server']['url'].rstrip('/')
        root_path = urlsplit(base_url).path.rstrip('/') or ''
        # Create and return test client
        # Note: setting the 'root_path' does NOT really work and
        # does not have the same effect as Flask's APPLICATION_ROOT
        client = StarletteClient(
            starlette_app.APP,
            base_url,
            root_path=root_path,
            **kwargs
        )
        # Override follow_redirects so behavior is the same as Flask mock
        client.follow_redirects = False
        yield client
    finally:
        if env_conf is None:
            # Remove env variable again if it was not set initially
            del os.environ['PYGEOAPI_CONFIG']
            # Unload Starlette app module
            del sys.modules['pygeoapi.starlette_app']
        else:
            # Restore env variable to original value and reload Starlette app
            os.environ['PYGEOAPI_CONFIG'] = env_conf
            if starlette_app:
                reload(starlette_app)
        del client