...
1 package handlers
2
3 import (
4 "encoding/json"
5 "testing"
6
7 "github.com/stretchr/testify/assert"
8
9 "edge-infra.dev/pkg/edge/auth-proxy/faker"
10 )
11
12 func TestSessionUserRole_Valid(t *testing.T) {
13 roles := []string{"EDGE_BANNER_STH"}
14 req, err := json.Marshal(faker.MockSessionUserRoleResponse())
15 proxyHandler.session.Set("roles", roles)
16 assert.NoError(t, err)
17 _, body, err := proxyHandler.SessionUserEdgeRole(nil, req)
18 assert.NoError(t, err)
19 assert.Equal(t, req, body)
20 }
21
View as plain text