Created
December 21, 2012 17:28
-
-
Save boxxxie/4354264 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
user=> (use 'librarian-clojure.security) | |
nil | |
user=> (def request {:params {:login "jacek" :password "secr3t"}}) | |
#'user/request | |
user=> (log-in request) | |
AssertionError Assert failed: (somnium.congomongo/connection? c__793__auto__) librarian-clojure.db/db-get-user (db.clj:63) | |
user=> ;; no CongoDB up and running - mock its availability | |
user=> (def ^:dynamic db-get-user) | |
#'user/db-get-user | |
user=> (binding [db-get-user (fn [v] (println "user: " v) v)] | |
(log-in request)) | |
AssertionError Assert failed: (somnium.congomongo/connection? c__793__auto__) librarian-clojure.db/db-get-user (db.clj:63) | |
user=> ;; it doesn't seem to work for another namespace's vars - a bit of Google'ing and with-redefs-fn shows up | |
user=> (with-redefs-fn {#'librarian-clojure.db/db-get-user (fn [v] (println "user: " v) {:password "secr3t" :roles #{:admin}}) | |
#'librarian-clojure.security/check-password (fn [cd cr] (println "candidate: " cd " crypt: " cr) true)} | |
#(librarian-clojure.security/log-in request)) | |
user: jacek | |
candidate: secr3t crypt: secr3t | |
{:name "jacek", :roles #{:admin}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment