lundi 2 novembre 2015

Clojure - test a Pedestal route

I would like to write tests for a Pedestal web-service.

If I have :

(defn pong
  [request]
  (ring-resp/response "pong"))

(defroutes routes[[["/" {:get pong}]]])

How would I write a test for that ?

(deftest alive-system
  (testing "ping-pong route"
    ;; how do I test my route ?
    ;; If possible :
    ;; - I would like to have direct access to it (ie. no need to bind pedestal to a port would be nice)
    ;; - The ability to omit some interceptors would be nice also, as it would allow me to receive plain Clojure data structures instead of, for instance, JSON.
    ...)

Aucun commentaire:

Enregistrer un commentaire