mirror of
https://gitlab.dit.htwk-leipzig.de/htwk-software/htwkalender.git
synced 2025-08-06 11:49:14 +02:00
feat:#36 added new event grpc message
This commit is contained in:
50
services/data-manager/service/db/dbFunctions_test.go
Normal file
50
services/data-manager/service/db/dbFunctions_test.go
Normal file
@@ -0,0 +1,50 @@
|
||||
package db
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestIsSafeIdentifier(t *testing.T) {
|
||||
type args struct {
|
||||
uuid string
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
args args
|
||||
want bool
|
||||
}{
|
||||
{
|
||||
name: "Test safe identifier",
|
||||
args: args{
|
||||
uuid: "1234567890-1234567890-1234567890-1234567890",
|
||||
},
|
||||
want: true,
|
||||
},
|
||||
{
|
||||
name: "Test safe identifier",
|
||||
args: args{
|
||||
uuid: "1234567890-1234567890-1234567890-1234567890",
|
||||
},
|
||||
want: true,
|
||||
},
|
||||
{
|
||||
name: "Test safe identifier",
|
||||
args: args{
|
||||
uuid: "77eddc32-c49d-5d0a-8c36-17b266396641",
|
||||
},
|
||||
want: true,
|
||||
},
|
||||
{
|
||||
name: "Test unsafe identifier",
|
||||
args: args{
|
||||
uuid: "77eddc32-c49d-5d0a-8c36-17/1!!b266396641-",
|
||||
},
|
||||
want: false,
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
if got := IsSafeIdentifier(tt.args.uuid); got != tt.want {
|
||||
t.Errorf("IsSafeIdentifier() = %v, want %v", got, tt.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user