diff options
author | Kamil Kisiel <kamil@kamilkisiel.net> | 2013-07-09 03:08:57 +0400 |
---|---|---|
committer | Kamil Kisiel <kamil@kamilkisiel.net> | 2013-07-09 03:10:05 +0400 |
commit | ee375ad9efa3c4d4eb23eb79dd8f083596460edb (patch) | |
tree | 5a885ba45b87113f32d4d58cd8498adceeca23c6 /store_test.go | |
parent | c044c93603af0d545821becf4fae68ea969eb074 (diff) |
Copy store options to sessions instead of referencing them.
Fixes GH-8
Diffstat (limited to 'store_test.go')
-rw-r--r-- | store_test.go | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/store_test.go b/store_test.go new file mode 100644 index 0000000..77fea6b --- /dev/null +++ b/store_test.go @@ -0,0 +1,48 @@ +package sessions + +import ( + "net/http" + "testing" +) + +// Test for GH-8 for CookieStore +func TestGH8CookieStore(t *testing.T) { + originalPath := "/" + store := NewCookieStore() + store.Options.Path = originalPath + req, err := http.NewRequest("GET", "http://www.example.com", nil) + if err != nil { + t.Fatal("failed to create request", err) + } + + session, err := store.New(req, "hello") + if err != nil { + t.Fatal("failed to create session", err) + } + + store.Options.Path = "/foo" + if session.Options.Path != originalPath { + t.Fatalf("bad session path: got %q, want %q", session.Options.Path, originalPath) + } +} + +// Test for GH-8 for FilesystemStore +func TestGH8FilesystemStore(t *testing.T) { + originalPath := "/" + store := NewFilesystemStore("") + store.Options.Path = originalPath + req, err := http.NewRequest("GET", "http://www.example.com", nil) + if err != nil { + t.Fatal("failed to create request", err) + } + + session, err := store.New(req, "hello") + if err != nil { + t.Fatal("failed to create session", err) + } + + store.Options.Path = "/foo" + if session.Options.Path != originalPath { + t.Fatalf("bad session path: got %q, want %q", session.Options.Path, originalPath) + } +} |