MCPcopy
hub / github.com/zincsearch/zincsearch / TestDeleteUser

Function TestDeleteUser

pkg/handlers/auth/user_test.go:109–153  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

107}
108
109func TestDeleteUser(t *testing.T) {
110 type args struct {
111 code int
112 data map[string]string
113 result string
114 }
115 tests := []struct {
116 name string
117 args args
118 }{
119 {
120 name: "normal",
121 args: args{
122 code: http.StatusOK,
123 data: map[string]string{"id": "1"},
124 result: "message",
125 },
126 },
127 {
128 name: "empty",
129 args: args{
130 code: http.StatusOK,
131 data: map[string]string{"id": ""},
132 result: "message",
133 },
134 },
135 {
136 name: "nil",
137 args: args{
138 code: http.StatusOK,
139 data: nil,
140 result: "message",
141 },
142 },
143 }
144 for _, tt := range tests {
145 t.Run(tt.name, func(t *testing.T) {
146 c, w := utils.NewGinContext()
147 utils.SetGinRequestParams(c, tt.args.data)
148 DeleteUser(c)
149 assert.Equal(t, tt.args.code, w.Code)
150 assert.Contains(t, w.Body.String(), tt.args.result)
151 })
152 }
153}

Callers

nothing calls this directly

Calls 4

NewGinContextFunction · 0.92
SetGinRequestParamsFunction · 0.92
ContainsMethod · 0.80
DeleteUserFunction · 0.70

Tested by

no test coverage detected