Skip to content
This repository was archived by the owner on Jul 5, 2025. It is now read-only.

Commit e9ad7dd

Browse files
committed
test: adding test case
1 parent 47f0762 commit e9ad7dd

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

directive/tenant_test.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@ import (
55
"testing"
66

77
"github.com/99designs/gqlgen/graphql"
8+
"github.com/stretchr/testify/assert"
9+
"k8s.io/utils/ptr"
10+
811
openmfpcontext "github.com/openmfp/golang-commons/context"
912
"github.com/openmfp/golang-commons/logger"
10-
"github.com/stretchr/testify/assert"
1113
)
1214

1315
func TestSetTenantToContextForTechnicalUsers(t *testing.T) {
@@ -54,6 +56,15 @@ func TestSetTenantToContextForTechnicalUsers(t *testing.T) {
5456
expectedTenant: "tenant123",
5557
expectError: false,
5658
},
59+
{
60+
name: "Non-technical user with spiffee (*string)",
61+
ctx: openmfpcontext.AddIsTechnicalIssuerToContext(context.Background()),
62+
args: map[string]interface{}{
63+
"tenantId": ptr.To("tenant123"),
64+
},
65+
expectedTenant: "tenant123",
66+
expectError: false,
67+
},
5768
}
5869

5970
for _, tt := range tests {

0 commit comments

Comments
 (0)