 
 (def json-header {"Accept" "application/json"
                   "Content-Type" "application/json"})
+
+(defn upsert-algorithm
+  [http-host {:keys [algorithm enabled inputs_url_template] :as all}]
+  (req :put (str http-host "/algorithm/" algorithm)
+       :body (json/encode all)
+       :headers json-header))
+
+(defn get-algorithm
+  [http-host algorithm]
+  (req :get (str http-host "/algorithm/" algorithm)))
+
+(defn get-algorithms
+  [http-host]
+  (req :get (str http-host "/algorithms")))
 
 (deftest changes-health-resource
   (with-system

        (is (= (json/decode body true) expected))))

    (testing "get algorithms"
      (let [resp   (req :get (str http-host "/algorithms"))
            status (:status resp)
            body   (:body resp)
            expected [{:algorithm "good"


(deftest results
  (with-system
    ;; put a good alg in the system
    (upsert-algorithm http-host {:algorithm "test-alg"
                                 :enabled true
                                 :inputs_url_template
                                 "http://host/{algorithm}/{x}/{y}/{now}"})

    (testing "run non-existent algorithm")
    (testing "schedule existing algorithm")
    (testing "schedule same algorithm, get ticket")
