     (fixt/without-db-var
      (fn []
        (is (= {:name "foo"}
-              (json/parse-string (:body (get-response (str endpoint "/foo")))
-                                 true)))))))
+              (-> (query-response method (str endpoint "/foo"))
+                  :body
+                  (json/parse-string true))))))))
 
 (deftestseq environment-subqueries
-  [[version endpoint] endpoints]
+  [[version endpoint] endpoints
+   method [:get :post]]
 
   (let [{:keys [web1 web2 db puppet]} (tu-nodes/store-example-nodes)]
     (doseq [env ["foo" "bar" "baz"]]
       (storage/ensure-environment env))
 
     (are [query expected] (= expected
-                             (-> (:body (get-response endpoint query))
+                             (-> (query-response method endpoint query)
+                                 :body
+                                 slurp
                                  (json/parse-string true)))
 
          ["in" "name"

       (is (= #{{:name "foo"}
                {:name "bar"}
                {:name "baz"}}
              (set (json/parse-string (:body (get-response endpoint))
                                      true))))))
    (fixt/without-db-var
     (fn []
       (let [res (get-response endpoint)]
         (is (= #{{:name "foo"}
                  {:name "bar"}
                  {:name "baz"}}
                (set @(future (json/parse-string (:body res)
                                                 true))))))))))

(deftestseq test-query-environment
  [[version endpoint] endpoints]

  (testing "without environments"
    (fixt/without-db-var
     (fn []
       (is (= 404 (:status (get-response (str endpoint "/foo"))))))))

  (testing "with environments"
    (doseq [env ["foo" "bar" "baz"]]

                          [:v4 "/v4/environments/foo/resources"]])

(deftestseq unknown-parent-handling
  [[version endpoint] no-parent-endpoints
   method [:get :post]]

  (let [{:keys [status body]} (query-response method endpoint)]
    (is (= status http/status-not-found))
    (is (= {:error "No information is known about environment foo"} (json/parse-string body true)))))
