def METHOD_NAME():
    with patch(
        "salt.modules.postgres._run_psql",
        MagicMock(
            return_value={"retcode": 0, "stdout": test_privileges_list_function_csv}
        ),
    ), patch("salt.utils.path.which", MagicMock(return_value="/usr/bin/pgsql")):
        ret = postgres.has_privileges(
            "baruwa",
            "awl",
            "function",
            "EXECUTE",
            grant_option=True,
            maintenance_db="db_name",
            runas="user",
            host="testhost",
            port="testport",
            user="testuser",
            password="testpassword",
        )
        assert ret is True
        query = (
            "COPY (SELECT rolname AS name "
            "FROM pg_catalog.pg_proc p "
            "JOIN pg_catalog.pg_namespace n "
            "ON n.oid = p.pronamespace "
            "JOIN pg_catalog.pg_roles r "
            "ON p.proowner = r.oid "
            "WHERE nspname = 'public' "
            "AND p.oid::regprocedure::text = 'awl' "
            "ORDER BY proname, proargtypes) TO STDOUT WITH CSV HEADER"
        )
        postgres._run_psql.assert_any_call(
            [
                "/usr/bin/pgsql",
                "--no-align",
                "--no-readline",
                "--no-psqlrc",
                "--no-password",
                "--username",
                "testuser",
                "--host",
                "testhost",
                "--port",
                "testport",
                "--dbname",
                "db_name",
                "-v",
                "datestyle=ISO,MDY",
                "-c",
                query,
            ],
            host="testhost",
            port="testport",
            password="testpassword",
            user="testuser",
            runas="user",
        )