MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / TestDeleteEmptyBodyDoc

Function TestDeleteEmptyBodyDoc

rest/api_test.go:2454–2479  ·  view source on GitHub ↗

CBG-1153

(t *testing.T)

Source from the content-addressed store, hash-verified

2452
2453// CBG-1153
2454func TestDeleteEmptyBodyDoc(t *testing.T) {
2455 rt := NewRestTester(t, nil)
2456 defer rt.Close()
2457
2458 var body db.Body
2459 response := rt.SendAdminRequest("PUT", "/{{.keyspace}}/doc1", "{}")
2460 RequireStatus(t, response, http.StatusCreated)
2461 assert.NoError(t, json.Unmarshal(response.BodyBytes(), &body))
2462 rev := body["rev"].(string)
2463
2464 response = rt.SendAdminRequest("DELETE", "/{{.keyspace}}/doc1?rev="+rev, "")
2465 RequireStatus(t, response, http.StatusOK)
2466
2467 response = rt.SendAdminRequest("GET", "/{{.keyspace}}/doc1", "")
2468 RequireStatus(t, response, http.StatusNotFound)
2469
2470 var doc map[string]interface{}
2471 _, err := rt.GetSingleDataStore().Get("doc1", &doc)
2472
2473 if base.TestUseXattrs() {
2474 assert.Error(t, err)
2475 assert.True(t, base.IsDocNotFoundError(err))
2476 } else {
2477 assert.NoError(t, err)
2478 }
2479}
2480
2481func TestPutEmptyDoc(t *testing.T) {
2482 rt := NewRestTester(t, nil)

Callers

nothing calls this directly

Calls 11

CloseMethod · 0.95
SendAdminRequestMethod · 0.95
GetSingleDataStoreMethod · 0.95
TestUseXattrsFunction · 0.92
IsDocNotFoundErrorFunction · 0.92
NewRestTesterFunction · 0.85
RequireStatusFunction · 0.85
UnmarshalMethod · 0.45
BodyBytesMethod · 0.45
GetMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected