zitadel/internal/api/grpc/admin/iam_member_converter_test.go
2023-04-26 19:55:13 +03:00

61 lines
1.1 KiB
Go

package admin
import (
"testing"
"github.com/zitadel/zitadel/internal/test"
"github.com/zitadel/zitadel/pkg/grpc/admin"
)
func TestAddIAMMemberToDomain(t *testing.T) {
type args struct {
req *admin.AddIAMMemberRequest
}
tests := []struct {
name string
args args
}{
{
name: "all fields filled",
args: args{
req: &admin.AddIAMMemberRequest{
UserId: "1232452",
Roles: []string{"admin"},
},
},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got := AddIAMMemberToDomain(tt.args.req)
test.AssertFieldsMapped(t, got, "ObjectRoot")
})
}
}
func TestUpdateIAMMemberToDomain(t *testing.T) {
type args struct {
req *admin.UpdateIAMMemberRequest
}
tests := []struct {
name string
args args
}{
{
name: "all fields filled",
args: args{
req: &admin.UpdateIAMMemberRequest{
UserId: "1232452",
Roles: []string{"admin"},
},
},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got := UpdateIAMMemberToDomain(tt.args.req)
test.AssertFieldsMapped(t, got, "ObjectRoot")
})
}
}