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

Function TestNullDocHandlingForMutable1xBody

rest/api_test.go:2890–2906  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

2888}
2889
2890func TestNullDocHandlingForMutable1xBody(t *testing.T) {
2891 rt := NewRestTester(t, nil)
2892 defer rt.Close()
2893 collection, ctx := rt.GetSingleTestDatabaseCollectionWithUser()
2894
2895 documentRev := db.DocumentRevision{DocID: "doc1", BodyBytes: []byte("null")}
2896
2897 body, err := documentRev.Mutable1xBody(ctx, collection, nil, nil, false, false)
2898 require.Error(t, err)
2899 require.Nil(t, body)
2900 assert.Contains(t, err.Error(), "null doc body for doc")
2901
2902 bodyBytes, err := documentRev.Inject1xBodyProperties(rt.Context(), collection, nil, nil, false)
2903 require.Error(t, err)
2904 require.Nil(t, bodyBytes)
2905 assert.Contains(t, err.Error(), "b is not a JSON object")
2906}
2907
2908// TestDatabaseXattrConfigHandlingForDBConfigUpdate:
2909// - Create database with xattrs enabled

Callers

nothing calls this directly

Calls 8

CloseMethod · 0.95
Mutable1xBodyMethod · 0.95
ContextMethod · 0.95
NewRestTesterFunction · 0.85
ContainsMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected