MCPcopy Create free account
hub / github.com/smallstep/cli / TestClaims_SetHeader

Function TestClaims_SetHeader

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

Source from the content-addressed store, hash-verified

48}
49
50func TestClaims_SetHeader(t *testing.T) {
51 type fields struct {
52 Claims jose.Claims
53 ExtraHeaders map[string]interface{}
54 }
55 type args struct {
56 key string
57 value interface{}
58 }
59 tests := []struct {
60 name string
61 fields fields
62 args args
63 want *Claims
64 }{
65 {"ok nil", fields{jose.Claims{}, nil}, args{"key", "value"}, &Claims{ExtraHeaders: map[string]interface{}{"key": "value"}}},
66 {"ok empty", fields{jose.Claims{}, make(map[string]interface{})}, args{"key", "value"}, &Claims{ExtraHeaders: map[string]interface{}{"key": "value"}}},
67 {"ok not empty", fields{jose.Claims{}, map[string]interface{}{"foo": "bar"}}, args{"key", "value"}, &Claims{ExtraHeaders: map[string]interface{}{"key": "value", "foo": "bar"}}},
68 }
69 for _, tt := range tests {
70 t.Run(tt.name, func(t *testing.T) {
71 c := &Claims{
72 Claims: tt.fields.Claims,
73 ExtraHeaders: tt.fields.ExtraHeaders,
74 }
75 c.SetHeader(tt.args.key, tt.args.value)
76 if !reflect.DeepEqual(c, tt.want) {
77 t.Errorf("Options claims = %v, want %v", c, tt.want)
78 }
79 })
80 }
81}
82
83func TestClaims_Sign(t *testing.T) {
84 type fields struct {

Callers

nothing calls this directly

Calls 2

SetHeaderMethod · 0.95
RunMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…