 (facts "about token endpoint"
        (let [user-email "email@user.com"
              user (storage/store-user! user-email "password")
-             client-details (client/register-client "MYAPP" "myapp.com")
-             auth-code (auth-code/create-auth-code client-details user "callback")
+             client-details (cl-client/register-client "MYAPP" "myapp.com")
+             auth-code (cl-auth-code/create-auth-code client-details user "callback")
              request (-> (r/request :get "/token")
                          (assoc :params {:grant_type   "authorization_code"
                                          :redirect_uri "callback"

       (fact "valid request goes to authorisation page with auth_code and email when there is an existing user session"
             (let [user-email "email@user.com"
                   user (storage/store-user! user-email "password")
                   client-details (client/register-client "MYAPP" "myapp.com") ; NB this saves into the client store
                   access-token (token/create-token client-details user) ; NB this saves into the token store
                   request (-> (r/request :get "/authorisation")
                               (assoc :params {:client_id (:client-id client-details) :response_type "code" :redirect_uri "callback"})
                               (r/header "accept" "text/html")

               (:uid user) =not=> nil?)

         (fact "user email stays in the session after validating token"
               (get-in response [:session :user :email]) => user-email)))
