diff --git a/session_test.go b/session_test.go index b32934b..832bc9d 100644 --- a/session_test.go +++ b/session_test.go @@ -28,3 +28,21 @@ func TestGetSessionCookieMissingCookie(t *testing.T) { } } } + +func TestGetSessionCookieCookieSet(t *testing.T) { + mySessionKey := "12341234" + + r, _ := http.NewRequest("GET", "/", nil) + cookie := &http.Cookie{Name: "session", Value: mySessionKey} + r.AddCookie(cookie) + + w := httptest.NewRecorder() + sessionKey, err := getSessionCookie(w, r) + if err != nil { + t.Errorf("err != nil in getSessionCookie") + } + if mySessionKey != sessionKey { + t.Errorf("getSessionKey didn't fetch sessionKey from \"session\" cookie") + } + +}