aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamil Kisiel <kamil@kamilkisiel.net>2015-08-06 21:04:18 +0300
committerKamil Kisiel <kamil@kamilkisiel.net>2015-08-06 21:04:18 +0300
commitc223d6df5316d3dc8d651d7762ba32dd867d9f69 (patch)
treef0aeed1f9090fce4a7a74f86df0ae89aed1c8953
parent5237f00be11e505c71d9fd0f2fd8580faa746614 (diff)
add test for nil hash key
-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).