added doormen ownership

This commit is contained in:
didier amyot committed 2015-06-14 23:21:42 -04:00
1 parent f0628e4682
commit f7a8d416c1
27 files changed
+489 -126

No files matched your search

+27
View File
@@ -0,0 +1,27 @@
package api
import (
"net/http"
"net/http/httptest"
"testing"
)
func TestAuthentication(t *testing.T) {
handler := func(w http.ResponseWriter, req *http.Request) {
if user := GetUser(req); user != "natasha" {
t.Error(user)
}
}
req, err := http.NewRequest("GET", "http://example.com/foo?user=natasha", nil)
if err != nil {
t.Error(err)
return
}
w := httptest.NewRecorder()
AuthenticationMiddleware(handler)(w, req)
if user := GetUser(req); user != "" {
t.Error(user)
}
}