Initial commit
This commit is contained in:
24
server/internal/httpapi/auth_test.go
Normal file
24
server/internal/httpapi/auth_test.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package httpapi
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"calllinesystem/server/internal/config"
|
||||
"calllinesystem/server/internal/model"
|
||||
)
|
||||
|
||||
func TestPortalSessionsUseDifferentCookieNames(t *testing.T) {
|
||||
server := &Server{config: config.Config{SessionCookieName: "queue_session"}}
|
||||
|
||||
staffCookie := server.authCookieName(model.RoleStaff)
|
||||
adminCookie := server.authCookieName(model.RoleAdmin)
|
||||
if staffCookie != "queue_session_staff" {
|
||||
t.Fatalf("staff cookie = %q", staffCookie)
|
||||
}
|
||||
if adminCookie != "queue_session_admin" {
|
||||
t.Fatalf("admin cookie = %q", adminCookie)
|
||||
}
|
||||
if staffCookie == adminCookie {
|
||||
t.Fatal("staff and admin portals must not share a cookie")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user