(t *testing.T)
| 286 | } |
| 287 | |
| 288 | func 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. |
| 329 | func TestServerResourcePatchHandlerValid(t *testing.T) { |
nothing calls this directly
no test coverage detected
searching dependent graphs…