 ;;; add indexer app etc later to this list
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (deftest concept-ingest-test
-  "Save a valid concept with no revision-id."
+  "Verrify successful ingest of concept."
   (swap! provider-suffix-num-atom inc)
   (try
-    (let [{:keys [status revision-id]} (save-concept (concept @provider-suffix-num-atom))]
+    (let [{:keys [status revision-id]} (ingest-concept "put" (concept @provider-suffix-num-atom))]
       (is (and (= status 200) (= revision-id 0))))
     (catch Exception e
       (error "Exception occurred while executing concept-ingest-test: " (.getMessage e))

    (let [N 4
          expected-revision-id (- N 1)
          last-revision-id (last (repeatedly N
                                             #(let [ {:keys [revision-id]} (save-concept (concept @provider-suffix-num-atom))]
                                                revision-id)))]
      (is (= expected-revision-id last-revision-id)))
    (catch Exception e

      (.printStackTrace e)
      (is false))))

;; ingest a concept first and delete the very same concept.
(deftest delete-concept-test
  "Verify concept is deleted from mdb and index."
  (swap! provider-suffix-num-atom inc)
  (try
    (let [{:keys [status revision-id]} (ingest-concept "put" (concept @provider-suffix-num-atom))
          saved? (and (= status 200) (= revision-id 0))]
      (if saved?
        (let [{:keys [status]} (ingest-concept "delete" (concept @provider-suffix-num-atom))]
          (is (= status 200)))
        (is false)))
    (catch Exception e
      (error "Exception occurred while executing concept-ingest-test: " (.getMessage e))
      (.printStackTrace e)
      (is false))))



