Skip to content

Instantly share code, notes, and snippets.

@edgargoncalves
Created May 31, 2010 12:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save edgargoncalves/419774 to your computer and use it in GitHub Desktop.
Save edgargoncalves/419774 to your computer and use it in GitHub Desktop.
(defmacro with-local-user [& body]
`(try (.setUp (test/local-service-test-helper (LocalUserServiceTestConfig.)))
~@body
(finally
(test/tear-down))))
(defn wrap-with-gae-local-user-service
"Ring middleware method that wraps an application so that every request will have
a user-info map assoc'd to the request under the key :appengine/user-info."
[application]
(fn [request]
(with-local-user (application request))))
(wrap! my-app (:users/with-user-info))
(wrap! my-app (:with-gae-local-user-service))
(defservice my-app)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment