MCPcopy
hub / github.com/smallstep/cli / TestClaims_Set

Function TestClaims_Set

token/token_test.go:17–48  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

15)
16
17func TestClaims_Set(t *testing.T) {
18 type fields struct {
19 Claims jose.Claims
20 ExtraClaims map[string]interface{}
21 }
22 type args struct {
23 key string
24 value interface{}
25 }
26 tests := []struct {
27 name string
28 fields fields
29 args args
30 want *Claims
31 }{
32 {"ok nil", fields{jose.Claims{}, nil}, args{"key", "value"}, &Claims{ExtraClaims: map[string]interface{}{"key": "value"}}},
33 {"ok empty", fields{jose.Claims{}, make(map[string]interface{})}, args{"key", "value"}, &Claims{ExtraClaims: map[string]interface{}{"key": "value"}}},
34 {"ok not empty", fields{jose.Claims{}, map[string]interface{}{"foo": "bar"}}, args{"key", "value"}, &Claims{ExtraClaims: map[string]interface{}{"key": "value", "foo": "bar"}}},
35 }
36 for _, tt := range tests {
37 t.Run(tt.name, func(t *testing.T) {
38 c := &Claims{
39 Claims: tt.fields.Claims,
40 ExtraClaims: tt.fields.ExtraClaims,
41 }
42 c.Set(tt.args.key, tt.args.value)
43 if !reflect.DeepEqual(c, tt.want) {
44 t.Errorf("Options claims = %v, want %v", c, tt.want)
45 }
46 })
47 }
48}
49
50func TestClaims_SetHeader(t *testing.T) {
51 type fields struct {

Callers

nothing calls this directly

Calls 2

SetMethod · 0.95
RunMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…