From 0dbdb60e3f64d2334ff5fcfb93298f434ec5914c Mon Sep 17 00:00:00 2001 From: Cam Saul <cammsaul@gmail.com> Date: Wed, 7 Nov 2018 12:33:00 -0800 Subject: [PATCH] Use middleware impl for test util fn bind-current-user --- test/metabase/test/data/users.clj | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/test/metabase/test/data/users.clj b/test/metabase/test/data/users.clj index cfbacc6c055..ef4365cde8e 100644 --- a/test/metabase/test/data/users.clj +++ b/test/metabase/test/data/users.clj @@ -4,8 +4,8 @@ [metabase [config :as config] [http-client :as http] + [middleware :as middleware] [util :as u]] - [metabase.api.common :as api] [metabase.core.initialization-status :as init-status] [metabase.models.user :as user :refer [User]] [toucan.db :as db]) @@ -166,11 +166,7 @@ (defn do-with-test-user "Call `f` with various `metabase.api.common` dynamic vars bound to the test User named by `user-kwd`." [user-kwd f] - (binding [api/*current-user* (delay (User (user->id user-kwd))) - api/*current-user-id* (user->id user-kwd) - api/*is-superuser?* (db/select-one-field :is_superuser User :id (user->id user-kwd)) - api/*current-user-permissions-set* (delay (user/permissions-set (user->id user-kwd)))] - (f))) + ((middleware/bind-current-user (fn [_] (f))) {:metabase-user-id (user->id user-kwd)})) (defmacro with-test-user "Call `body` with various `metabase.api.common` dynamic vars like `*current-user*` bound to the test User named by -- GitLab