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

Function TestPatch_complex

patch_add_test.go:152–186  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

150}
151
152func TestPatch_complex(t *testing.T) {
153 raw, err := ioutil.ReadFile("testdata/patch/add/complex.json")
154 if err != nil {
155 t.Fatal(err)
156 }
157 var (
158 req = httptest.NewRequest(http.MethodPatch, "/Users/0001", bytes.NewReader(raw))
159 rr = httptest.NewRecorder()
160 )
161 newTestServer().ServeHTTP(rr, req)
162 if rr.Code != http.StatusOK {
163 t.Fatal(rr.Code, rr.Body.String())
164 }
165 var resource map[string]interface{}
166 if err := json.Unmarshal(rr.Body.Bytes(), &resource); err != nil {
167 t.Fatal(err)
168 }
169 rm, ok := resource["name"]
170 if !ok {
171 t.Fatal(resource["members"])
172 }
173 m, ok := rm.(map[string]interface{})
174 if !ok {
175 t.Fatal(rm)
176 }
177 if m["givenName"] != "Barbara" {
178 t.Error(m["givenName"])
179 }
180 if m["familyName"] != "Jensen" {
181 t.Error(m["familyName"])
182 }
183 if m["formatted"] != "Barbara Jensen" {
184 t.Error(m["formatted"])
185 }
186}

Callers

nothing calls this directly

Calls 4

ServeHTTPMethod · 0.80
StringMethod · 0.80
ErrorMethod · 0.80
newTestServerFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…