           token (e/login (s/context) "user1")
           _ (index/wait-until-indexed)
           tag (tags/save-tag token (tags/make-tag {:tag-key "tag1"}) [coll1])
-          assert-tag-associated (fn [expected-colls]
-                                  (is (d/refs-match?
-                                        expected-colls
-                                        (search/find-refs :collection
-                                                          {:tag-key "tag1"
-                                                            :token token}))))]
+          assert-tag-associated (partial assert-tag-associated-with-query token {:tag-key "tag1"})]
       (assert-tag-associated [coll1])
       (let [{:keys [status errors]} (tags/disassociate-by-query token "tag1" {:provider "PROV1"})]
         (is (= 200 status))

  "This tests associating tags with collections."
  (:require [clojure.test :refer :all]
            [clojure.string :as str]
            [cmr.common.util :refer [are2]]
            [cmr.system-int-test.utils.ingest-util :as ingest]
            [cmr.system-int-test.utils.search-util :as search]
            [cmr.system-int-test.utils.index-util :as index]

        token (e/login (s/context) "user1")
        prov3-token (e/login (s/context) "prov3-user" ["groupguid1"])
        {:keys [concept-id]} (tags/create-tag token tag)
        assert-tag-associated (partial assert-tag-associated-with-query prov3-token {:tag-key "tag1"})]
    (index/wait-until-indexed)
    ;; Associate the tag with every collection
    (tags/associate-by-query prov3-token tag-key {:or [{:provider "PROV1"}
