@@ -11,13 +11,6 @@ import (
1111)
1212
1313func TestContext (t * testing.T ) {
14- errMsg := func (err error ) string {
15- if err == nil {
16- return ""
17- }
18- return err .Error ()
19- }
20-
2114 newGinCtx := func (value any , set bool ) * gin.Context {
2215 c , _ := gin .CreateTestContext (httptest .NewRecorder ())
2316 if set {
@@ -104,9 +97,9 @@ func TestContext(t *testing.T) {
10497 Username : "dave" , Provider : "github" ,
10598 OAuthGroups : "devs,admins" , OAuthSub : "sub-123" , OAuthName : "GitHub" ,
10699 })
107- return [4 ]any {got .Provider , got .OAuth .ID , got .OAuth .Sub , got .OAuth .DisplayName }
100+ return [5 ]any {got .Provider , got .OAuth .ID , got .OAuth .Sub , got .OAuth .DisplayName , got . OAuth . Groups }
108101 },
109- expected : [4 ]any {model .ProviderOAuth , "github" , "sub-123" , "GitHub" },
102+ expected : [5 ]any {model .ProviderOAuth , "github" , "sub-123" , "GitHub" , [] string { "devs" , "admins" } },
110103 },
111104 {
112105 description : "Local getters return BaseContext fields" ,
@@ -240,7 +233,7 @@ func TestContext(t *testing.T) {
240233 context : & model.UserContext {},
241234 run : func (c * model.UserContext ) any {
242235 _ , err := c .NewFromGin (newGinCtx (nil , false ))
243- return errMsg ( err )
236+ return err . Error ( )
244237 },
245238 expected : "failed to get user context" ,
246239 },
@@ -249,7 +242,7 @@ func TestContext(t *testing.T) {
249242 context : & model.UserContext {},
250243 run : func (c * model.UserContext ) any {
251244 _ , err := c .NewFromGin (newGinCtx ("not a user context" , true ))
252- return errMsg ( err )
245+ return err . Error ( )
253246 },
254247 expected : "invalid user context type" ,
255248 },
0 commit comments