diff options
author | Kamil Kisiel <kamil@kamilkisiel.net> | 2015-08-06 21:04:18 +0300 |
---|---|---|
committer | Kamil Kisiel <kamil@kamilkisiel.net> | 2015-08-06 21:04:18 +0300 |
commit | c223d6df5316d3dc8d651d7762ba32dd867d9f69 (patch) | |
tree | f0aeed1f9090fce4a7a74f86df0ae89aed1c8953 /securecookie_test.go | |
parent | 5237f00be11e505c71d9fd0f2fd8580faa746614 (diff) |
add test for nil hash key
Diffstat (limited to 'securecookie_test.go')
-rw-r--r-- | securecookie_test.go | 12 |
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). |