MCPcopy Create free account
hub / github.com/elimity-com/scim / TestServerResourcePatchHandlerReturnsNoContent

Function TestServerResourcePatchHandlerReturnsNoContent

handlers_test.go:288–326  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

286}
287
288func TestServerResourcePatchHandlerReturnsNoContent(t *testing.T) {
289 reqs := []*http.Request{
290 httptest.NewRequest(http.MethodPatch, "/Users/0001", strings.NewReader(`{
291 "schemas": ["urn:ietf:params:scim:api:messages:2.0:PatchOp"],
292 "Operations":[
293 {
294 "op": "add",
295 "path": "userName",
296 "value": "test01"
297 }
298 ]
299 }`)),
300 httptest.NewRequest(http.MethodPatch, "/Users/0002", strings.NewReader(`{
301 "schemas": ["urn:ietf:params:scim:api:messages:2.0:PatchOp"],
302 "Operations":[
303 {
304 "op": "replace",
305 "path": "userName",
306 "value": "test02"
307 }
308 ]
309 }`)),
310 httptest.NewRequest(http.MethodPatch, "/Users/0003", strings.NewReader(`{
311 "schemas": ["urn:ietf:params:scim:api:messages:2.0:PatchOp"],
312 "Operations":[
313 {
314 "op": "remove",
315 "path": "name.givenName"
316 }
317 ]
318 }`)),
319 }
320 for _, req := range reqs {
321 rr := httptest.NewRecorder()
322 newTestServer().ServeHTTP(rr, req)
323
324 assertEqualStatusCode(t, http.StatusNoContent, rr.Code)
325 }
326}
327
328// Tests valid add, replace, and remove operations.
329func TestServerResourcePatchHandlerValid(t *testing.T) {

Callers

nothing calls this directly

Calls 3

assertEqualStatusCodeFunction · 0.85
ServeHTTPMethod · 0.80
newTestServerFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…