                                  (:color status)))))))
 
   (testing "should fail if status key is configured but no JSON is provided"
-    (with-fake-resource "http://the_host/status.json" (fn [_] {:status 200
-                                                               :body "some body"})
+    (with-fake-resource "http://the_host/status.json" {:status 200
+                                                       :body "some body"}
       (sut/fetch-status (host-with-color-config "http://the_host/status.json" "status")
                         timeout
                         (fn [status]

                                   (:color status))))))))

  (testing "should return green for 200"
    (with-fake-resource "http://the_host/found" (fn [_] {:status 200
                                                         :body ""})
      (sut/fetch-status (host-without-color-config "http://the_host/found")
                        timeout
                        (fn [status]

   :config {:color "color"
            :components component-config}})

(defmacro with-fake-resource [url resp & body]
  `(fake/with-fake-http [{:url ~url} ~resp]
     ~@body))

(defn- json-response [body]
  {:status 200
   :headers {"Content-Type" "application/json"}
   :body (j/generate-string body)})

(def timeout 42)

(deftest test-with-status
  (testing "should return red for 500"
    (with-fake-resource "http://the_host/not_found" {:status 500
                                                     :body ""}
      (with-local-vars [status nil]
        (sut/fetch-status (host-without-color-config "http://the_host/not_found")
                          timeout
