Permalink
Browse files

Add users-test ... even if it's all commented out at the moment. Also…

… update build for the latest sdk.
  • Loading branch information...
1 parent a581860 commit 7fef3938464ca6d35ee8515017a9465bbbaed740 @duelinmarkers committed Apr 7, 2009
Showing with 18 additions and 2 deletions.
  1. +3 −2 build.xml
  2. +15 −0 test/appengine_clj/users_test.clj
View
@@ -1,6 +1,6 @@
<project name="appengine-clj" basedir="." default="compile">
- <property name="sdk.dir" location="../appengine-java-sdk" />
+ <property name="sdk.dir" location="../appengine-java-sdk-1.2.0" />
<property name="classes.dir" value="classes" />
<property name="lib.dir" value="lib" />
<property name="src.dir" value="src" />
@@ -50,7 +50,8 @@
<arg value="
(use 'clojure.contrib.test-is)
(require 'appengine-clj.datastore-test)
- (run-tests 'appengine-clj.datastore-test)" />
+ (require 'appengine-clj.users-test)
+ (apply run-tests '[appengine-clj.datastore-test appengine-clj.users-test])" />
</java>
</target>
@@ -0,0 +1,15 @@
+(ns appengine-clj.users-test
+ (:require [appengine-clj.users :as users])
+ (:use clojure.contrib.test-is))
+
+(comment
+(deftest wrap-requiring-login
+ (testing "redirects to login when user isn't logged in"
+ (let [fake-user-service (proxy [com.google.appengine.api.users.UserService] []
+ (isUserLoggedIn [] false)
+ (createLoginURL [dest] (str "/login?then=" dest)))
+ request {:appengine-clj/user-info {:user nil :user-service fake-user-service}}]
+ (is (= {:status 302 :headers {"Location" "/login?then=/path"}}
+ ((users/wrap-requiring-login #(throw (Exception.)) request)))))))
+)
+

0 comments on commit 7fef393

Please sign in to comment.