mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-03 04:10:20 +08:00
fix: improve code specification (#231)
This commit is contained in:
@ -16,6 +16,7 @@ package object
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"github.com/casbin/casdoor/util"
|
||||
@ -78,3 +79,27 @@ func TestGetSaltedPassword(t *testing.T) {
|
||||
salt := "123"
|
||||
fmt.Printf("%s -> %s\n", password, getSaltedPassword(password, salt))
|
||||
}
|
||||
|
||||
func TestGetMaskedUsers(t *testing.T) {
|
||||
type args struct {
|
||||
users []*User
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
args args
|
||||
want []*User
|
||||
}{
|
||||
{
|
||||
name: "1",
|
||||
args: args{users: []*User{{Password: "casdoor"},{Password: "casbin"}}},
|
||||
want: []*User{{Password: "***"},{Password: "***"}},
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
if got := GetMaskedUsers(tt.args.users); !reflect.DeepEqual(got, tt.want) {
|
||||
t.Errorf("GetMaskedUsers() = %v, want %v", got, tt.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user