33 lines
732 B
Clojure
33 lines
732 B
Clojure
(ns pmagnus.elprice.test-utils
|
|
(:require
|
|
[pmagnus.elprice.core :as core]
|
|
[peridot.core :as p]
|
|
[byte-streams :as bs]
|
|
[integrant.repl.state :as state]))
|
|
|
|
(defn system-state
|
|
[]
|
|
(or @core/system state/system))
|
|
|
|
(defn system-fixture
|
|
[]
|
|
(fn [f]
|
|
(when (nil? (system-state))
|
|
(core/start-app {:opts {:profile :test}}))
|
|
(f)
|
|
(core/stop-app)))
|
|
|
|
(defn get-response [ctx]
|
|
(-> ctx
|
|
:response
|
|
(update :body (fnil bs/to-string ""))))
|
|
|
|
(defn GET [app path params headers]
|
|
(-> (p/session app)
|
|
(p/request path
|
|
:request-method :get
|
|
:content-type "application/edn"
|
|
:headers headers
|
|
:params params)
|
|
(get-response)))
|