        (is (= #{{:name "foo"}
                 {:name "bar"}
                 {:name "baz"}}
-              (set (json/parse-string (:body (get-response endpoint))
-                                      true))))))
+              (query-result method endpoint)))))
+
     (fixt/without-db-var
      (fn []
-       (let [res (get-response endpoint)]
+       (let [res (query-response method endpoint)]
          (is (= #{{:name "foo"}
                   {:name "bar"}
                   {:name "baz"}}
-                (set @(future (json/parse-string (:body res)
-                                                 true))))))))))
+                (set @(future (-> (query-response method endpoint)
+                                  :body
+                                  slurp
+                                  (json/parse-string true)))))))))))
 
 (deftestseq test-query-environment
-  [[version endpoint] endpoints]
+  [[version endpoint] endpoints
+   method [:get :post]]
 
   (testing "without environments"
     (fixt/without-db-var
      (fn []
-       (is (= 404 (:status (get-response (str endpoint "/foo"))))))))
+       (is (= 404 (:status (query-response method (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]

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

            [puppetlabs.puppetdb.scf.storage :as storage]
            [clojure.test :refer :all]
            [puppetlabs.puppetdb.testutils :refer [get-request deftestseq]]
            [puppetlabs.puppetdb.testutils.http :refer [query-response
                                                        query-result
                                                        order-param]]
            [puppetlabs.puppetdb.testutils.nodes :as tu-nodes]))

(use-fixtures :each fixt/with-test-db fixt/with-http-app)

(def endpoints [[:v4 "/v4/environments"]])

;; TESTS

(deftestseq test-all-environments
  [[version endpoint] endpoints
   method [:get :post]]

  (testing "without environments"
    (is (empty? (query-result method endpoint))))

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