25 lines
655 B
Go
25 lines
655 B
Go
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")
|
|
}
|
|
}
|