MCPcopy
hub / github.com/weaviate/weaviate / Test_ReferenceDelete_Ref2Vec

Function Test_ReferenceDelete_Ref2Vec

usecases/objects/references_test.go:670–709  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

668}
669
670func Test_ReferenceDelete_Ref2Vec(t *testing.T) {
671 t.Parallel()
672
673 ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
674 defer cancel()
675
676 m := newFakeGetManager(articleSchemaForTest())
677
678 req := DeleteReferenceInput{
679 Class: "Article",
680 ID: strfmt.UUID("e1a60252-c38c-496d-8e54-306e1cedc5c4"),
681 Property: "hasParagraphs",
682 Reference: models.SingleRef{
683 Beacon: strfmt.URI("weaviate://localhost/Paragraph/494a2fe5-3e4c-4e9a-a47e-afcd9814f5ea"),
684 },
685 }
686
687 tenant := "randomTenant"
688
689 parent := &search.Result{
690 ID: strfmt.UUID("e1a60252-c38c-496d-8e54-306e1cedc5c4"),
691 ClassName: "Article",
692 Schema: map[string]interface{}{},
693 }
694
695 ref1 := &search.Result{
696 ID: strfmt.UUID("494a2fe5-3e4c-4e9a-a47e-afcd9814f5ea"),
697 ClassName: "Paragraph",
698 Vector: []float32{2, 4, 6},
699 }
700
701 m.repo.On("Exists", "Article", parent.ID).Return(true, nil)
702 m.repo.On("Exists", "Paragraph", ref1.ID).Return(true, nil)
703 m.repo.On("Object", req.Class, req.ID, search.SelectProperties{}, additional.Properties{}, tenant).Return(parent, nil)
704 m.repo.On("PutObject", parent.Object(), []float32(nil)).Return(nil)
705 m.modulesProvider.On("UsingRef2Vec", mock.Anything).Return(true)
706
707 err := m.Manager.DeleteObjectReference(ctx, nil, &req, nil, tenant)
708 assert.Nil(t, err)
709}
710
711func articleSchemaForTest() schema.Schema {
712 return schema.Schema{

Callers

nothing calls this directly

Calls 8

ObjectMethod · 0.95
newFakeGetManagerFunction · 0.85
articleSchemaForTestFunction · 0.85
UUIDMethod · 0.80
URIMethod · 0.80
DeleteObjectReferenceMethod · 0.65
WithTimeoutMethod · 0.45
ReturnMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…