   (f))
 
 (use-fixtures :each each-fixture)
+
+(defn a-build [jobName, buildNr, content]
+  (app (-> (request :put
+                    (format "/builds/%s/%s" jobName buildNr))
+           (body (json/generate-string content))
+           (content-type "application/json"))))
 
 (deftest Storage
   (testing "PUT to /builds/:job/:build"


  (testing "GET to /builds/:job/:build"
    ; GET should return 200
    (app (-> (request :put
                      "/builds/anotherBuild/1")
             (body (json/generate-string {:start 42 :end 43}))
             (content-type "application/json")))
    (let [response (app (request :get "/builds/anotherBuild/1"))]
      (is (= (:status response) 200)))

    ; GET should return content stored by PUT
    (app (-> (request :put
                  "/builds/yetAnotherBuild/1")
             (body (json/generate-string {:start 42 :end 43}))
             (content-type "application/json")))
    (let [response (app (request :get "/builds/yetAnotherBuild/1"))
          resp-data (json/parse-string (:body response))]
      (is (= resp-data

      (is (= resp-data {})))

    ; GET should return job summary
    (a-build "someBuild" 1, {:start 42 :end 43})
    (a-build "anotherBuild" 1, {:start 10 :end 12})
    (let [response (app (request :get "/pipeline"))
          resp-data (json/parse-string (:body response))]
      (is (= resp-data {"someBuild" {"averageRuntime" 1}
