                                    (:message status)))))))
 
     (testing "for internal exception"
-      (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]

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

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

(defn- json-response [body]
  (fn [_]
    {: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" (fn [_] {:status 500
                                                             :body ""})
      (with-local-vars [status nil]
        (sut/fetch-status (host-without-color-config "http://the_host/not_found")
                          timeout

                                   (:message status)))))))

    (testing "for 302"
      (with-fake-resource "http://the_host/redirect"  {:status 302
                                                       :body "Found"}
        (sut/fetch-status (host-without-color-config "http://the_host/redirect")
                          timeout
                          (fn [status]
