尝试使用compojure auth中间件运行Cloverage时发生异常

时间:2018-11-22 16:13:13

标签: unit-testing clojure compojure compojure-api

将基于角色的身份验证添加到compojure api之后,覆盖失败。运行lein cloverage时遇到此异常:

Exception in thread "main" java.lang.IllegalArgumentException: No method in multimethod 'restructure-param' for dispatch value: :auth-roles, compiling:(/private/var/folders/w_/yt926bqs21g44f257yz05ctsjbv948/T/form-init3368607975292148784.clj:1:125)

这是我的身份验证中间件:

(defmethod compojure.api.meta/restructure-param :auth-roles
[_ required-roles acc]

(update-in acc [:middleware] conj [require-roles required-roles]))

1 个答案:

答案 0 :(得分:0)

请参阅github问题:https://github.com/cloverage/cloverage/issues/164#issuecomment-281673566

(defmethod compojure.api.meta/restructure-param :auth-roles
  [_ required-roles acc]

  (update-in acc [:middleware] conj [`require-roles required-roles]))