             [com.puppetlabs.http :as pl-http])
   (:use clojure.test
         ring.mock.request
+        [com.puppetlabs.utils :only (keyset)]
         [clj-time.core :only [now]]
         com.puppetlabs.puppetdb.examples
         com.puppetlabs.puppetdb.fixtures))

    (scf-store/replace-catalog! (assoc web1-catalog :certname web1) (now))
    (scf-store/replace-catalog! (assoc puppet-catalog :certname puppet) (now))
    (scf-store/replace-catalog! (assoc db-catalog :certname db) (now))

    (testing "basic equality is supported for name"
      (is-query-result ["=" "name" "web1.example.com"] [web1]))

  [query expected]
  (let [{:keys [body status]} (get-response query)
        result (try
                 (json/parse-string body true)
                 (catch com.fasterxml.jackson.core.JsonParseException e
                   body))]
    (doseq [res result]
      (is (= #{:name :deactivated :catalog_timestamp :facts_timestamp :report_timestamp} (keyset res))))
    (is (= status pl-http/status-ok))
    (is (= expected (mapv :name result))
        (str query))))

(deftest node-queries
