 
 (facts "about show-authorise-failure"
        (fact "when authorisation failure is rendered will add error=access_denied in the querystring of the callback uri"
-             (let [request (-> (r/request :get "/authorise-failure")
+             (let [request (-> (create-request :get "/authorise-failure" nil)
                                (assoc-in [:context :translator] {})
                                (assoc-in [:session :redirect-uri] "http://where.do.we.go.now"))
                    response (oauth/show-authorise-failure request)]
                (:status response)) => 200
              (provided
                (oauth/add-error-to-uri "http://where.do.we.go.now") => anything))
-       
+
        (fact "authorisation failure page is rendered with client name"
              (let [element-has-correct-client-name-fn (fn [element] (= (html/text element) "CLIENT_NAME"))]
                (-> (create-request :get (routes/path :show-authorise-failure) nil)

                   client-details (cl-client/register-client "MYAPP" "myapp.com")
                   access-token (cl-token/create-token client-details user)
                   csrf-token "CSRF-TOKEN"
                   request (-> (r/request :post "/authorisation")
                               (assoc :params {:client_id (:client-id client-details) :response_type "code" :redirect_uri "callback" :csrf-token csrf-token})
                               (assoc-in [:session :access_token] (:token access-token))
                               (assoc-in [:session :csrf-token] csrf-token)
                               (assoc :content-type "application/x-www-form-urlencoded") ;To mock a form post

       (let [user (user/store-user! user-email "password")
             client-details (cl-client/register-client "MYAPP" "myapp.com")
             auth-code (cl-auth-code/create-auth-code client-details user "callback")
             request (-> (create-request :get (routes/path :validate-token) {:grant_type   "authorization_code"
                                                                             :redirect_uri "callback"
                                                                             :code         (:code auth-code)})
                         (create-auth-header client-details))
             response (oauth/validate-token request)
             response-body (-> response :body (json/parse-string keyword))]
