MCPcopy
hub / github.com/perkeep/perkeep / initTests

Function initTests

pkg/search/handler_test.go:311–843  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

309var handlerTests []handlerTest
310
311func initTests() []handlerTest {
312 return []handlerTest{
313 {
314 name: "describe-missing",
315 setup: func(t *testing.T) indexAndOwner {
316 return indexAndOwner{
317 index: index.NewMemoryIndex(),
318 owner: owner.BlobRef(),
319 }
320 },
321 query: "describe?blobref=eabfakeref-0555",
322 want: parseJSON(`{
323 "meta": {
324 }
325 }`),
326 },
327
328 {
329 name: "describe-jpeg-blob",
330 setup: func(t *testing.T) indexAndOwner {
331 idx := index.NewMemoryIndex()
332 tb, ok := testBlobs["blobcontents1"]
333 if !ok {
334 panic("blobcontents1 not found")
335 }
336 if _, err := idx.ReceiveBlob(ctxbg, tb.BlobRef(), tb.Reader()); err != nil {
337 panic(err)
338 }
339 return indexAndOwner{
340 index: idx,
341 owner: owner.BlobRef(),
342 }
343 },
344 query: "describe?blobref=" + tbRefStr("blobcontents1"),
345 want: parseJSON(`{
346 "meta": {
347 "` + tbRefStr("blobcontents1") + `": {
348 "blobRef": "` + tbRefStr("blobcontents1") + `",
349 "size": ` + tbSize("blobcontents1") + `
350 }
351 }
352 }`),
353 },
354
355 {
356 name: "describe-permanode",
357 setup: handlerDescribeTestSetup,
358 query: "describe",
359 postBody: `{
360 "blobref": "` + tbRefStr("perma-123") + `",
361 "rules": [
362 {"attrs": ["camliContent"]}
363 ]
364 }`,
365 want: parseJSON(`{
366 "meta": {
367 "` + tbRefStr("fakeref-232") + `": {
368 "blobRef": "` + tbRefStr("fakeref-232") + `",

Callers 1

initFunction · 0.85

Calls 15

addBlobMethod · 0.95
addClaimMethod · 0.95
NewPlannedPermanodeMethod · 0.95
SetAttributeMethod · 0.95
UploadFileMethod · 0.95
AddAttributeMethod · 0.95
DelAttributeMethod · 0.95
NewMemoryIndexFunction · 0.92
NewSetAttributeClaimFunction · 0.92
NewIndexDepsFunction · 0.92
PkSourceRootFunction · 0.92
tbRefStrFunction · 0.85

Tested by

no test coverage detected