                                 :name "admin api"}]}}
       (logutils/with-test-logging
        (testing "when no encoded characters in uri"
-         (doseq [[endpoint http-method] endpoints]
-           (testing (str "for " endpoint " endpoint")
-             (let [response (http-method
-                             (str "https://localhost:8140/puppet-admin-api/v1" endpoint)
-                             ssl-request-options)]
-               (is (= 403 (:status response))
-                   (ks/pprint-to-string response))))))
+         (let [response (http-client/delete
+                         "https://localhost:8140/puppet-admin-api/v1/environment-cache"
+                         ssl-request-options)]
+           (is (= 403 (:status response))
+               (ks/pprint-to-string response))))
        (testing "when encoded characters in uri"
          (let [response (http-client/delete
                          (str "https://localhost:8140/pu%70pet-admin-api/"

  (testing "access allowed when cert allowed by rule and whitelist empty"
    (logutils/with-test-logging
     (bootstrap/with-puppetserver-running-with-mock-jrubies
      "JRuby mocking is safe here because the admin endpoint is implemented
       in Clojure."
      app
      {:jruby-puppet {:gem-path gem-path}
       :puppet-admin {:client-whitelist []}
       :authorization {:version 1
                       :rules [{:match-request
                                {:path "/puppet-admin-api/v1"
                                 :type "path"}
                                :allow "localhost"
                                :sort-order 1
                                :name "admin api"}]}}
      (doseq [[endpoint http-method] endpoints]
        (testing (str "for " endpoint " endpoint")
          (let [response (http-method
                          (str "https://localhost:8140/puppet-admin-api/v1" endpoint)
                          ssl-request-options)]
            (is (<= 200 (:status response) 299)
                (ks/pprint-to-string response))))))))

  (testing "server tolerates client specifying an 'Accept: */*' header"
    (bootstrap/with-puppetserver-running-with-mock-jrubies
     "JRuby mocking is safe here because the admin endpoint is implemented
       in Clojure."
     app
     {:jruby-puppet {:gem-path gem-path}}
     (doseq [[endpoint http-method] endpoints]
       (testing (str "for " endpoint " endpoint")
         (let [response (http-method
                         (str "https://localhost:8140/puppet-admin-api/v1" endpoint)
                         (assoc ssl-request-options :headers {"Accept" "*/*"}))]
           (is (<= 200 (:status response) 299)
               (ks/pprint-to-string response))))))))

(deftest ^:integration admin-api-pool-timeout-test
  (testing "pool lock timeout results in 503"


  (testing "when cert allowed by rule and whitelist not configured"
    (bootstrap/with-puppetserver-running-with-mock-jrubies
      "JRuby mocking is safe here because we do not care about the results of the API call."
      app
      {:jruby-puppet {:gem-path gem-path}
       :puppet-admin  nil
