summaryrefslogtreecommitdiff
path: root/securecookie_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'securecookie_test.go')
-rw-r--r--securecookie_test.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/securecookie_test.go b/securecookie_test.go
index 1d7f640..33ce4fc 100644
--- a/securecookie_test.go
+++ b/securecookie_test.go
@@ -74,6 +74,18 @@ func TestSecureCookie(t *testing.T) {
}
}
+func TestSecureCookieNilKey(t *testing.T) {
+ s1 := New(nil, nil)
+ value := map[string]interface{}{
+ "foo": "bar",
+ "baz": 128,
+ }
+ _, err := s1.Encode("sid", value)
+ if err != errHashKeyNotSet {
+ t.Fatal("Wrong error returned:", err)
+ }
+}
+
func TestDecodeInvalid(t *testing.T) {
// List of invalid cookies, which must not be accepted, base64-decoded
// (they will be encoded before passing to Decode).