mirror of
https://github.com/zitadel/zitadel.git
synced 2025-12-10 14:02:18 +00:00
feat: device authorization RFC 8628 (#5646)
* device auth: implement the write events * add grant type device code * fix(init): check if default value implements stringer --------- Co-authored-by: adlerhurst <silvan.reusser@gmail.com>
This commit is contained in:
49
internal/eventstore/handler/crdb/init_test.go
Normal file
49
internal/eventstore/handler/crdb/init_test.go
Normal file
@@ -0,0 +1,49 @@
|
||||
package crdb
|
||||
|
||||
import "testing"
|
||||
|
||||
func Test_defaultValue(t *testing.T) {
|
||||
type args struct {
|
||||
value interface{}
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
args args
|
||||
want string
|
||||
}{
|
||||
{
|
||||
name: "string",
|
||||
args: args{
|
||||
value: "asdf",
|
||||
},
|
||||
want: "'asdf'",
|
||||
},
|
||||
{
|
||||
name: "primitive non string",
|
||||
args: args{
|
||||
value: 1,
|
||||
},
|
||||
want: "1",
|
||||
},
|
||||
{
|
||||
name: "stringer",
|
||||
args: args{
|
||||
value: testStringer(0),
|
||||
},
|
||||
want: "0",
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
if got := defaultValue(tt.args.value); got != tt.want {
|
||||
t.Errorf("defaultValue() = %v, want %v", got, tt.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
type testStringer int
|
||||
|
||||
func (t testStringer) String() string {
|
||||
return "0529958243"
|
||||
}
|
||||
Reference in New Issue
Block a user