                                                              :short-name "s7"}})]
     (testing "find-with-parameters"
       (are3 [collections params]
-            (= (set collections)
+        (is (= (set collections)
                (set (-> (util/find-concepts :collection params)
                         :concepts
-                        concepts-for-comparison)))
-            "regular provider - provider-id"
-            [coll1 coll2-2 coll5-2] {:provider-id "REG_PROV" :latest true}
-
-            "small provider with tombstones - provider-id"
-            [coll3 coll6-2] {:provider-id "SMAL_PROV1" :latest true}
-
-            "small provider - provider-id"
-            [coll4-3] {:provider-id "SMAL_PROV2" :latest true}
-
-            "regular provider - provider-id, entry-title"
-            [coll1] {:provider-id "REG_PROV" :entry-title "et1" :latest true}
-
-            "small provider - provider-id, entry-title"
-            [coll3] {:provider-id "SMAL_PROV1" :entry-title "et3" :latest true}
-
-            "regular provider - provider-id, entry-id"
-            [coll2-2] {:provider-id "REG_PROV" :entry-id "entry-2" :latest true}
-
-            "small provider - provider-id, entry-id"
-            [coll4-3] {:provider-id "SMAL_PROV2" :entry-id "entry-1" :latest true}
-
-            "regular provider - short-name, version-id"
-            [coll2-2] {:short-name "s2" :version-id "v2" :latest true}
-
-            "small provider - short-name, version-id"
-            [coll4-3] {:short-name "s4" :version-id "v5" :latest true}
-
-            "small provider - match multiple - version-id"
-            [coll3] {:version-id "v3" :latest true}
-
-            ;; This test verifies that the provider-id is being used with the small_providers
-            ;; table. Otherwise we would get both coll3 and coll4 back (see previous test).
-            "small provider - provider-id, version-id"
-            [coll4-3] {:provider-id "SMAL_PROV2" :version-id "v5" :latest true}
-
-            "mixed providers - entry-title"
-            [coll1 coll4-3] {:entry-title "et1" :latest true}
-
-            "exclude-metadata=true"
-            [(dissoc coll3 :metadata)]
-            {:provider-id "SMAL_PROV1" :entry-id "entry-3" :exclude-metadata "true" :latest true}
-
-            "exclude-metadata=false"
-            [coll3]
-            {:provider-id "SMAL_PROV1" :entry-id "entry-3" :exclude-metadata "false" :latest true}
-
-            "regular provider - concept-id"
-            [coll1] {:concept-id (:concept-id coll1) :latest true}
-
-            "small provider - concept-id"
-            [coll4-3] {:concept-id (:concept-id coll4-1) :latest true}
-
-            "concept-id and version-id - latest"
-            [coll4-3] {:concept-id (:concept-id coll4-1) :version-id "v5" :latest true}
-
-            "find none - bad provider-id"
-            [] {:provider-id "PROV_NONE" :latest true}
-
-            "find none - provider-id, bad version-id"
-            [] {:provider-id "REG_PROV" :version-id "v7" :latest true}
-
-            ;; all revisions
-            "provider-id - all revisions"
-            [coll4-1 coll4-2 coll4-3] {:provider-id "SMAL_PROV2"}
-
-            "entry-title - all revisions"
-            [coll2-1 coll2-2] {:entry-title "et2"}
-
-            "entry-title - all revisions - find latest false"
-            [coll2-1 coll2-2] {:entry-title "et2" :latest false}
-
-            "concept-id - all revisions"
-            [coll4-1 coll4-2 coll4-3] {:concept-id (:concept-id coll4-1)}
-
-            "concept-id and version-id - all revisions"
-            [coll4-1] {:concept-id (:concept-id coll4-1) :version-id "v3"}
-
-            "params containing a vector are ORed"
-            [coll1 coll3 coll4-3] {:entry-title ["et1" "et3"] :latest true}
-
-            "multiple ORed param lists are ANDed together"
-            [coll3] {:entry-title ["et1" "et3"] :short-name ["s3" "s5"] :latest true}))))
+                        concepts-for-comparison))))
+        "regular provider - provider-id"
+        [coll1 coll2-2 coll5-2] {:provider-id "REG_PROV" :latest true}
+
+        "small provider with tombstones - provider-id"
+        [coll3 coll6-2] {:provider-id "SMAL_PROV1" :latest true}
+
+        "small provider - provider-id"
+        [coll4-3] {:provider-id "SMAL_PROV2" :latest true}
+
+        "regular provider - provider-id, entry-title"
+        [coll1] {:provider-id "REG_PROV" :entry-title "et1" :latest true}
+
+        "small provider - provider-id, entry-title"
+        [coll3] {:provider-id "SMAL_PROV1" :entry-title "et3" :latest true}
+
+        "regular provider - provider-id, entry-id"
+        [coll2-2] {:provider-id "REG_PROV" :entry-id "entry-2" :latest true}
+
+        "small provider - provider-id, entry-id"
+        [coll4-3] {:provider-id "SMAL_PROV2" :entry-id "entry-1" :latest true}
+
+        "regular provider - short-name, version-id"
+        [coll2-2] {:short-name "s2" :version-id "v2" :latest true}
+
+        "small provider - short-name, version-id"
+        [coll4-3] {:short-name "s4" :version-id "v5" :latest true}
+
+        "small provider - match multiple - version-id"
+        [coll3] {:version-id "v3" :latest true}
+
+        ;; This test verifies that the provider-id is being used with the small_providers
+        ;; table. Otherwise we would get both coll3 and coll4 back (see previous test).
+        "small provider - provider-id, version-id"
+        [coll4-3] {:provider-id "SMAL_PROV2" :version-id "v5" :latest true}
+
+        "mixed providers - entry-title"
+        [coll1 coll4-3] {:entry-title "et1" :latest true}
+
+        "exclude-metadata=true"
+        [(dissoc coll3 :metadata)]
+        {:provider-id "SMAL_PROV1" :entry-id "entry-3" :exclude-metadata "true" :latest true}
+
+        "exclude-metadata=false"
+        [coll3]
+        {:provider-id "SMAL_PROV1" :entry-id "entry-3" :exclude-metadata "false" :latest true}
+
+        "regular provider - concept-id"
+        [coll1] {:concept-id (:concept-id coll1) :latest true}
+
+        "small provider - concept-id"
+        [coll4-3] {:concept-id (:concept-id coll4-1) :latest true}
+
+        "concept-id and version-id - latest"
+        [coll4-3] {:concept-id (:concept-id coll4-1) :version-id "v5" :latest true}
+
+        "find none - bad provider-id"
+        [] {:provider-id "PROV_NONE" :latest true}
+
+        "find none - provider-id, bad version-id"
+        [] {:provider-id "REG_PROV" :version-id "v7" :latest true}
+
+        ;; all revisions
+        "provider-id - all revisions"
+        [coll4-1 coll4-2 coll4-3] {:provider-id "SMAL_PROV2"}
+
+        "entry-title - all revisions"
+        [coll2-1 coll2-2] {:entry-title "et2"}
+
+        "entry-title - all revisions - find latest false"
+        [coll2-1 coll2-2] {:entry-title "et2" :latest false}
+
+        "concept-id - all revisions"
+        [coll4-1 coll4-2 coll4-3] {:concept-id (:concept-id coll4-1)}
+
+        "concept-id and version-id - all revisions"
+        [coll4-1] {:concept-id (:concept-id coll4-1) :version-id "v3"}
+
+        "params containing a vector are ORed"
+        [coll1 coll3 coll4-3] {:entry-title ["et1" "et3"] :latest true}
+
+        "multiple ORed param lists are ANDed together"
+        [coll3] {:entry-title ["et1" "et3"] :short-name ["s3" "s5"] :latest true}))))
 
 (deftest get-expired-collections-concept-ids
   (let [time-now (tk/now)

           (util/find-concepts :tag-association {:provider-id "REG_PROV"})))))

(deftest find-services
  (let [serv1 (util/create-and-save-service "REG_PROV" 1 3)
        serv2 (util/create-and-save-service "REG_PROV" 2 2)]
    (testing "find latest revsions"
      (are3 [servs params]
        (= (set servs)
           (set (->> (util/find-latest-concepts :service params)
                     :concepts
                     (map #(dissoc % :provider-id :revision-date :transaction-id)))))
        "with metadata search by concept-id"
        [serv1] {:concept-id (:concept-id serv1)}

        "with metadata search by native-id"
        [serv2] {:native-id (:native-id serv2)}

        "exclude metadata search by concept-id"
        [(dissoc serv1 :metadata)] {:concept-id (:concept-id serv1)
                                    :exclude-metadata true}

        "exclude metadata search by native-id"
        [(dissoc serv2 :metadata)] {:native-id (:native-id serv2)
                                    :exclude-metadata true}

        "no match by native id"

                                                            :version-id "v1"
                                                            :short-name "s1"}})
        coll2 (save-collection "REG_PROV" 2 {:extra-fields {:entry-id "entry-2"
                                                            :entry-title "et2"
                                                            :version-id "v1"
                                                            :short-name "s2"}})
        associated-tag (util/create-and-save-tag 1)
        tag-association1 (util/create-and-save-tag-association coll1 associated-tag 1 3)
        tag-association2 (util/create-and-save-tag-association coll2 associated-tag 2 2)]
    (testing "find latest revisions"
      (are3 [tag-associations params]
        (is (= (set tag-associations)
               (set (->> (util/find-latest-concepts :tag-association params)
                         :concepts
                         (map #(dissoc % :provider-id :revision-date :transaction-id))))))

        "by associated-concept-id"
        [tag-association1] {:associated-concept-id "C1200000000-REG_PROV"}

        "with metadata"
        [tag-association1 tag-association2] {}

        "exclude metadata"
        [(dissoc tag-association1 :metadata) (dissoc tag-association2 :metadata)] {:exclude-metadata true}))

    (testing "find all revisions"
      (let [num-of-tag-associations (-> (util/find-concepts :tag-association {})
