From d6fe320f0e48e4af783c5ffe7a3274d1b55aa6c1 Mon Sep 17 00:00:00 2001 From: Sergey Date: Wed, 21 Aug 2024 11:14:29 +0200 Subject: [PATCH] Fix old name --- cmd/usecasevalidator/main.go | 20 +++++++++---------- cmd/usecasevalidator/rules.go | 7 +++---- cmd/usecasevalidator/validators.go | 16 +++++++-------- core/block/import/csv/converter_test.go | 4 ++-- .../notion/api/database/database_test.go | 18 ++++++++--------- .../block/import/notion/api/page/page_test.go | 18 ++++++++--------- core/relations_test.go | 2 +- tests/integration/import_test.go | 6 +++--- 8 files changed, 45 insertions(+), 46 deletions(-) diff --git a/cmd/usecasevalidator/main.go b/cmd/usecasevalidator/main.go index a1e82bd09..7d5f68e58 100644 --- a/cmd/usecasevalidator/main.go +++ b/cmd/usecasevalidator/main.go @@ -221,18 +221,18 @@ func collectUseCaseInfo(files []*zip.File, fileName string) (info *useCaseInfo, return nil, fmt.Errorf("failed to extract snapshot from file %s: %w", f.Name, err) } - id := snapshot.Snapshot.Data.Details.GetStringOrDefault(bundle.RelationKeyId, "") - name := snapshot.Snapshot.Data.Details.GetStringOrDefault(bundle.RelationKeyName, "") + id := snapshot.Snapshot.Data.Details.GetString(bundle.RelationKeyId, "") + name := snapshot.Snapshot.Data.Details.GetString(bundle.RelationKeyName, "") info.objects[id] = objectInfo{ - Type: snapshot.Snapshot.Data.Details.GetStringOrDefault(bundle.RelationKeyType, ""), + Type: snapshot.Snapshot.Data.Details.GetString(bundle.RelationKeyType, ""), Name: name, SbType: smartblock.SmartBlockType(snapshot.SbType), } switch snapshot.SbType { case model.SmartBlockType_STRelation: - uk := snapshot.Snapshot.Data.Details.GetStringOrDefault(bundle.RelationKeyUniqueKey, "") + uk := snapshot.Snapshot.Data.Details.GetString(bundle.RelationKeyUniqueKey, "") key := strings.TrimPrefix(uk, addr.RelationKeyToIdPrefix) info.relations[id] = domain.RelationKey(key) format := snapshot.Snapshot.Data.Details.GetInt64OrDefault(bundle.RelationKeyRelationFormat, 0) @@ -240,7 +240,7 @@ func collectUseCaseInfo(files []*zip.File, fileName string) (info *useCaseInfo, info.customTypesAndRelations[key] = customInfo{id: id, isUsed: false, relationFormat: model.RelationFormat(format)} } case model.SmartBlockType_STType: - uk := snapshot.Snapshot.Data.Details.GetStringOrDefault(bundle.RelationKeyUniqueKey, "") + uk := snapshot.Snapshot.Data.Details.GetString(bundle.RelationKeyUniqueKey, "") key := strings.TrimPrefix(uk, addr.ObjectTypeKeyToIdPrefix) info.types[id] = domain.TypeKey(key) if !bundle.HasObjectTypeByKey(domain.TypeKey(key)) { @@ -262,9 +262,9 @@ func collectUseCaseInfo(files []*zip.File, fileName string) (info *useCaseInfo, } } case model.SmartBlockType_Template: - info.templates[id] = snapshot.Snapshot.Data.Details.GetStringOrDefault(bundle.RelationKeyTargetObjectType, "") + info.templates[id] = snapshot.Snapshot.Data.Details.GetString(bundle.RelationKeyTargetObjectType, "") case model.SmartBlockType_STRelationOption: - info.options[id] = domain.RelationKey(snapshot.Snapshot.Data.Details.GetStringOrDefault(bundle.RelationKeyRelationKey, "")) + info.options[id] = domain.RelationKey(snapshot.Snapshot.Data.Details.GetString(bundle.RelationKeyRelationKey, "")) case model.SmartBlockType_FileObject: info.files = append(info.files, id) } @@ -418,7 +418,7 @@ func extractSnapshotAndType(data []byte, name string) (s *pb.SnapshotWithType, i func validate(snapshot *pb.SnapshotWithType, info *useCaseInfo) (err error) { isValid := true - id := snapshot.Snapshot.Data.Details.GetStringOrDefault(bundle.RelationKeyId, "") + id := snapshot.Snapshot.Data.Details.GetString(bundle.RelationKeyId, "") for _, v := range validators { if e := v(snapshot, info); e != nil { if errors.Is(e, errSkipObject) { @@ -430,14 +430,14 @@ func validate(snapshot *pb.SnapshotWithType, info *useCaseInfo) (err error) { } if !isValid { return fmt.Errorf("object '%s' (name: '%s') is invalid: %w", - id[len(id)-4:], snapshot.Snapshot.Data.Details.GetStringOrDefault(bundle.RelationKeyName, ""), err) + id[len(id)-4:], snapshot.Snapshot.Data.Details.GetString(bundle.RelationKeyName, ""), err) } return nil } func insertAnalyticsData(s *pb.ChangeSnapshot, info *useCaseInfo) { root := s.Data.Blocks[0] - id := s.Data.Details.GetStringOrDefault(bundle.RelationKeyId, "") + id := s.Data.Details.GetString(bundle.RelationKeyId, "") f := root.GetFields().GetFields() if f == nil { diff --git a/cmd/usecasevalidator/rules.go b/cmd/usecasevalidator/rules.go index 0cdeb3bd9..4b549e120 100644 --- a/cmd/usecasevalidator/rules.go +++ b/cmd/usecasevalidator/rules.go @@ -15,7 +15,6 @@ import ( "github.com/anyproto/anytype-heart/pb" "github.com/anyproto/anytype-heart/pkg/lib/bundle" "github.com/anyproto/anytype-heart/pkg/lib/pb/model" - "github.com/anyproto/anytype-heart/util/pbtypes" "github.com/anyproto/anytype-heart/util/slice" ) @@ -71,7 +70,7 @@ func readRules(fileName string) error { } func processRules(s *pb.ChangeSnapshot) { - id := s.Data.Details.GetStringOrDefault(bundle.RelationKeyId, "") + id := s.Data.Details.GetString(bundle.RelationKeyId, "") for i, r := range rules { if r.ObjectID != id && r.ObjectID != "" { @@ -164,7 +163,7 @@ func doDataViewTargetRule(s *pb.ChangeSnapshot, r rule) { } if !ok { fmt.Println("Failed to process rule as block" + r.BlockID + "of object" + - s.Data.Details.GetStringOrDefault(bundle.RelationKeyId, "") + "is not dataview block") + s.Data.Details.GetString(bundle.RelationKeyId, "") + "is not dataview block") return } switch r.Action { @@ -193,7 +192,7 @@ func doLinkTargetRule(s *pb.ChangeSnapshot, r rule) { } if !ok { fmt.Println("Failed to process rule as block" + r.BlockID + "of object" + - s.Data.Details.GetStringOrDefault(bundle.RelationKeyId, "") + "is not link block") + s.Data.Details.GetString(bundle.RelationKeyId, "") + "is not link block") return } switch r.Action { diff --git a/cmd/usecasevalidator/validators.go b/cmd/usecasevalidator/validators.go index 9c07d944a..11f8c78d9 100644 --- a/cmd/usecasevalidator/validators.go +++ b/cmd/usecasevalidator/validators.go @@ -41,7 +41,7 @@ var validators = []validator{ } func validateRelationLinks(s *pb.SnapshotWithType, info *useCaseInfo) (err error) { - id := s.Snapshot.Data.Details.GetStringOrDefault(bundle.RelationKeyId, "") + id := s.Snapshot.Data.Details.GetString(bundle.RelationKeyId, "") linksToDelete := make([]keyWithIndex, 0) for i, rel := range s.Snapshot.Data.RelationLinks { if bundle.HasRelation(rel.Key) { @@ -61,7 +61,7 @@ func validateRelationLinks(s *pb.SnapshotWithType, info *useCaseInfo) (err error } func validateRelationBlocks(s *pb.SnapshotWithType, info *useCaseInfo) (err error) { - id := s.Snapshot.Data.Details.GetStringOrDefault(bundle.RelationKeyId, "") + id := s.Snapshot.Data.Details.GetString(bundle.RelationKeyId, "") var relKeys []string for _, b := range s.Snapshot.Data.Blocks { if rel := simple.New(b).Model().GetRelation(); rel != nil { @@ -92,7 +92,7 @@ func validateRelationBlocks(s *pb.SnapshotWithType, info *useCaseInfo) (err erro } func validateDetails(s *pb.SnapshotWithType, info *useCaseInfo) (err error) { - id := s.Snapshot.Data.Details.GetStringOrDefault(bundle.RelationKeyId, "") + id := s.Snapshot.Data.Details.GetString(bundle.RelationKeyId, "") for k, v := range s.Snapshot.Data.Details.Fields { if isLinkRelation(k) { @@ -153,7 +153,7 @@ func validateDetails(s *pb.SnapshotWithType, info *useCaseInfo) (err error) { } func validateObjectTypes(s *pb.SnapshotWithType, info *useCaseInfo) (err error) { - id := s.Snapshot.Data.Details.GetStringOrDefault(bundle.RelationKeyId, "") + id := s.Snapshot.Data.Details.GetString(bundle.RelationKeyId, "") for _, ot := range s.Snapshot.Data.ObjectTypes { typeId := strings.TrimPrefix(ot, addr.ObjectTypeKeyToIdPrefix) if !bundle.HasObjectTypeByKey(domain.TypeKey(typeId)) { @@ -166,7 +166,7 @@ func validateObjectTypes(s *pb.SnapshotWithType, info *useCaseInfo) (err error) } func validateBlockLinks(s *pb.SnapshotWithType, info *useCaseInfo) (err error) { - id := s.Snapshot.Data.Details.GetStringOrDefault(bundle.RelationKeyId, "") + id := s.Snapshot.Data.Details.GetString(bundle.RelationKeyId, "") for _, b := range s.Snapshot.Data.Blocks { switch a := simple.New(b).(type) { case link.Block: @@ -214,7 +214,7 @@ func validateBlockLinks(s *pb.SnapshotWithType, info *useCaseInfo) (err error) { } func validateDeleted(s *pb.SnapshotWithType, _ *useCaseInfo) error { - id := s.Snapshot.Data.Details.GetStringOrDefault(bundle.RelationKeyId, "") + id := s.Snapshot.Data.Details.GetString(bundle.RelationKeyId, "") if s.Snapshot.Data.Details.GetBoolOrDefault(bundle.RelationKeyIsArchived, false) { fmt.Println("WARNING: object", id, " is archived, so it will be skipped") @@ -239,13 +239,13 @@ func validateRelationOption(s *pb.SnapshotWithType, info *useCaseInfo) error { return nil } - key := s.Snapshot.Data.Details.GetStringOrDefault(bundle.RelationKeyRelationKey, "") + key := s.Snapshot.Data.Details.GetString(bundle.RelationKeyRelationKey, "") if bundle.HasRelation(key) { return nil } if _, found := info.customTypesAndRelations[key]; !found { - id := s.Snapshot.Data.Details.GetStringOrDefault(bundle.RelationKeyId, "") + id := s.Snapshot.Data.Details.GetString(bundle.RelationKeyId, "") return fmt.Errorf("failed to find relation key %s of relation option %s", key, id) } return nil diff --git a/core/block/import/csv/converter_test.go b/core/block/import/csv/converter_test.go index 08f55fea3..e78d1f7ff 100644 --- a/core/block/import/csv/converter_test.go +++ b/core/block/import/csv/converter_test.go @@ -189,7 +189,7 @@ func TestCsv_GetSnapshotsTranspose(t *testing.T) { for _, snapshot := range sn.Snapshots { if snapshot.SbType == sb.SmartBlockTypeRelation { - name := snapshot.Snapshot.GetData().GetDetails().GetStringOrDefault(bundle.RelationKeyName, "") + name := snapshot.Snapshot.GetData().GetDetails().GetString(bundle.RelationKeyName, "") assert.True(t, name == "name" || name == "price") } } @@ -229,7 +229,7 @@ func TestCsv_GetSnapshotsTransposeUseFirstRowForRelationsOff(t *testing.T) { for _, snapshot := range sn.Snapshots { if snapshot.SbType == sb.SmartBlockTypeRelation { - name := snapshot.Snapshot.GetData().GetDetails().GetStringOrDefault(bundle.RelationKeyName, "") + name := snapshot.Snapshot.GetData().GetDetails().GetString(bundle.RelationKeyName, "") assert.True(t, name == "Field 1" || name == "Field 2") } } diff --git a/core/block/import/notion/api/database/database_test.go b/core/block/import/notion/api/database/database_test.go index 0a6c5dc95..115f1ddc5 100644 --- a/core/block/import/notion/api/database/database_test.go +++ b/core/block/import/notion/api/database/database_test.go @@ -400,7 +400,7 @@ func Test_makeDatabaseSnapshot(t *testing.T) { // then assert.Len(t, req.PropertyIdsToSnapshots, 1) - assert.Equal(t, bundle.RelationKeyTag.String(), req.PropertyIdsToSnapshots[p.ID].GetDetails().GetStringOrDefault(bundle.RelationKeyRelationKey, "")) + assert.Equal(t, bundle.RelationKeyTag.String(), req.PropertyIdsToSnapshots[p.ID].GetDetails().GetString(bundle.RelationKeyRelationKey, "")) }) t.Run("Database has Select property with Tags name", func(t *testing.T) { @@ -424,7 +424,7 @@ func Test_makeDatabaseSnapshot(t *testing.T) { // then assert.Len(t, req.PropertyIdsToSnapshots, 1) - assert.Equal(t, bundle.RelationKeyTag.String(), req.PropertyIdsToSnapshots[selectProperty.ID].GetDetails().GetStringOrDefault(bundle.RelationKeyRelationKey, "")) + assert.Equal(t, bundle.RelationKeyTag.String(), req.PropertyIdsToSnapshots[selectProperty.ID].GetDetails().GetString(bundle.RelationKeyRelationKey, "")) }) t.Run("Page has MultiSelect property with Tags name", func(t *testing.T) { @@ -447,7 +447,7 @@ func Test_makeDatabaseSnapshot(t *testing.T) { // then assert.Len(t, properties.PropertyIdsToSnapshots, 1) - assert.Equal(t, bundle.RelationKeyTag.String(), properties.PropertyIdsToSnapshots[multiSelectProperty.ID].GetDetails().GetStringOrDefault(bundle.RelationKeyRelationKey, "")) + assert.Equal(t, bundle.RelationKeyTag.String(), properties.PropertyIdsToSnapshots[multiSelectProperty.ID].GetDetails().GetString(bundle.RelationKeyRelationKey, "")) }) t.Run("Page has MultiSelect property with Tag name", func(t *testing.T) { @@ -470,7 +470,7 @@ func Test_makeDatabaseSnapshot(t *testing.T) { // then assert.Len(t, req.PropertyIdsToSnapshots, 1) - assert.Equal(t, bundle.RelationKeyTag.String(), req.PropertyIdsToSnapshots[multiSelectProperty.ID].GetDetails().GetStringOrDefault(bundle.RelationKeyRelationKey, "")) + assert.Equal(t, bundle.RelationKeyTag.String(), req.PropertyIdsToSnapshots[multiSelectProperty.ID].GetDetails().GetString(bundle.RelationKeyRelationKey, "")) }) t.Run("Page has MultiSelect property with Tag name and Select property with Tags name - MultiSelect is mapped to Tag relation", func(t *testing.T) { @@ -499,8 +499,8 @@ func Test_makeDatabaseSnapshot(t *testing.T) { // then assert.Len(t, req.PropertyIdsToSnapshots, 2) - assert.Equal(t, bundle.RelationKeyTag.String(), req.PropertyIdsToSnapshots[multiSelectProperty.ID].GetDetails().GetStringOrDefault(bundle.RelationKeyRelationKey, "")) - assert.NotEqual(t, bundle.RelationKeyTag.String(), req.PropertyIdsToSnapshots[selectProperty.ID].GetDetails().GetStringOrDefault(bundle.RelationKeyRelationKey, "")) + assert.Equal(t, bundle.RelationKeyTag.String(), req.PropertyIdsToSnapshots[multiSelectProperty.ID].GetDetails().GetString(bundle.RelationKeyRelationKey, "")) + assert.NotEqual(t, bundle.RelationKeyTag.String(), req.PropertyIdsToSnapshots[selectProperty.ID].GetDetails().GetString(bundle.RelationKeyRelationKey, "")) }) t.Run("Page has MultiSelect property with Tag name and Select property with tags name - MultiSelect is mapped to Tag relation", func(t *testing.T) { @@ -529,8 +529,8 @@ func Test_makeDatabaseSnapshot(t *testing.T) { // then assert.Len(t, req.PropertyIdsToSnapshots, 2) - assert.Equal(t, bundle.RelationKeyTag.String(), req.PropertyIdsToSnapshots[multiSelectProperty.ID].GetDetails().GetStringOrDefault(bundle.RelationKeyRelationKey, "")) - assert.NotEqual(t, bundle.RelationKeyTag.String(), req.PropertyIdsToSnapshots[selectProperty.ID].GetDetails().GetStringOrDefault(bundle.RelationKeyRelationKey, "")) + assert.Equal(t, bundle.RelationKeyTag.String(), req.PropertyIdsToSnapshots[multiSelectProperty.ID].GetDetails().GetString(bundle.RelationKeyRelationKey, "")) + assert.NotEqual(t, bundle.RelationKeyTag.String(), req.PropertyIdsToSnapshots[selectProperty.ID].GetDetails().GetString(bundle.RelationKeyRelationKey, "")) }) t.Run("Database has icon emoji - details have relation iconEmoji", func(t *testing.T) { @@ -618,6 +618,6 @@ func Test_makeDatabaseSnapshot(t *testing.T) { // then assert.Len(t, req.PropertyIdsToSnapshots, 1) - assert.Equal(t, property.UntitledProperty, req.PropertyIdsToSnapshots[selectProperty.ID].GetDetails().GetStringOrDefault(bundle.RelationKeyName, "")) + assert.Equal(t, property.UntitledProperty, req.PropertyIdsToSnapshots[selectProperty.ID].GetDetails().GetString(bundle.RelationKeyName, "")) }) } diff --git a/core/block/import/notion/api/page/page_test.go b/core/block/import/notion/api/page/page_test.go index 7fcfdb8b6..0057067f6 100644 --- a/core/block/import/notion/api/page/page_test.go +++ b/core/block/import/notion/api/page/page_test.go @@ -856,7 +856,7 @@ func Test_handlePagePropertiesSelectWithTagName(t *testing.T) { // then assert.Len(t, snapshots, 2) // 1 relation + 1 option assert.Len(t, req.PropertyIdsToSnapshots, 1) - assert.Equal(t, bundle.RelationKeyTag.String(), req.PropertyIdsToSnapshots[selectProperty.ID].GetDetails().GetStringOrDefault(bundle.RelationKeyRelationKey, "")) + assert.Equal(t, bundle.RelationKeyTag.String(), req.PropertyIdsToSnapshots[selectProperty.ID].GetDetails().GetString(bundle.RelationKeyRelationKey, "")) }) t.Run("Page has Select property with Tags name", func(t *testing.T) { @@ -895,7 +895,7 @@ func Test_handlePagePropertiesSelectWithTagName(t *testing.T) { // then assert.Len(t, snapshots, 2) // 1 relation + 1 option assert.Len(t, req.PropertyIdsToSnapshots, 1) - assert.Equal(t, bundle.RelationKeyTag.String(), req.PropertyIdsToSnapshots[selectProperty.ID].GetDetails().GetStringOrDefault(bundle.RelationKeyRelationKey, "")) + assert.Equal(t, bundle.RelationKeyTag.String(), req.PropertyIdsToSnapshots[selectProperty.ID].GetDetails().GetString(bundle.RelationKeyRelationKey, "")) }) t.Run("Page has MultiSelect property with Tags name", func(t *testing.T) { @@ -935,7 +935,7 @@ func Test_handlePagePropertiesSelectWithTagName(t *testing.T) { // then assert.Len(t, snapshots, 2) // 1 relation + 1 option assert.Len(t, req.PropertyIdsToSnapshots, 1) - assert.Equal(t, bundle.RelationKeyTag.String(), req.PropertyIdsToSnapshots[multiSelectProperty.ID].GetDetails().GetStringOrDefault(bundle.RelationKeyRelationKey, "")) + assert.Equal(t, bundle.RelationKeyTag.String(), req.PropertyIdsToSnapshots[multiSelectProperty.ID].GetDetails().GetString(bundle.RelationKeyRelationKey, "")) }) t.Run("Page has MultiSelect property with Tag name", func(t *testing.T) { @@ -975,7 +975,7 @@ func Test_handlePagePropertiesSelectWithTagName(t *testing.T) { // then assert.Len(t, snapshots, 2) // 1 relation + 1 option assert.Len(t, req.PropertyIdsToSnapshots, 1) - assert.Equal(t, bundle.RelationKeyTag.String(), req.PropertyIdsToSnapshots[multiSelectProperty.ID].GetDetails().GetStringOrDefault(bundle.RelationKeyRelationKey, "")) + assert.Equal(t, bundle.RelationKeyTag.String(), req.PropertyIdsToSnapshots[multiSelectProperty.ID].GetDetails().GetString(bundle.RelationKeyRelationKey, "")) }) t.Run("Page has MultiSelect property with Tag name and Select property with Tags name - MultiSelect is mapped to Tag relation", func(t *testing.T) { @@ -1025,8 +1025,8 @@ func Test_handlePagePropertiesSelectWithTagName(t *testing.T) { // then assert.Len(t, snapshots, 4) // 2 relation + 2 option assert.Len(t, req.PropertyIdsToSnapshots, 2) - assert.Equal(t, bundle.RelationKeyTag.String(), req.PropertyIdsToSnapshots[multiSelectProperty.ID].GetDetails().GetStringOrDefault(bundle.RelationKeyRelationKey, "")) - assert.NotEqual(t, bundle.RelationKeyTag.String(), req.PropertyIdsToSnapshots[selectProperty.ID].GetDetails().GetStringOrDefault(bundle.RelationKeyRelationKey, "")) + assert.Equal(t, bundle.RelationKeyTag.String(), req.PropertyIdsToSnapshots[multiSelectProperty.ID].GetDetails().GetString(bundle.RelationKeyRelationKey, "")) + assert.NotEqual(t, bundle.RelationKeyTag.String(), req.PropertyIdsToSnapshots[selectProperty.ID].GetDetails().GetString(bundle.RelationKeyRelationKey, "")) }) t.Run("Page has MultiSelect property with tags name and Select property with Tag name - Tag property is mapped to Tag relation, tags is a new relation", func(t *testing.T) { @@ -1076,8 +1076,8 @@ func Test_handlePagePropertiesSelectWithTagName(t *testing.T) { // then assert.Len(t, snapshots, 4) // 2 relation + 2 option assert.Len(t, req.PropertyIdsToSnapshots, 2) - assert.NotEqual(t, bundle.RelationKeyTag.String(), req.PropertyIdsToSnapshots[multiSelectProperty.ID].GetDetails().GetStringOrDefault(bundle.RelationKeyRelationKey, "")) - assert.Equal(t, bundle.RelationKeyTag.String(), req.PropertyIdsToSnapshots[selectProperty.ID].GetDetails().GetStringOrDefault(bundle.RelationKeyRelationKey, "")) + assert.NotEqual(t, bundle.RelationKeyTag.String(), req.PropertyIdsToSnapshots[multiSelectProperty.ID].GetDetails().GetString(bundle.RelationKeyRelationKey, "")) + assert.Equal(t, bundle.RelationKeyTag.String(), req.PropertyIdsToSnapshots[selectProperty.ID].GetDetails().GetString(bundle.RelationKeyRelationKey, "")) }) t.Run("Page has property with empty name - return relation with name Untitled", func(t *testing.T) { @@ -1112,7 +1112,7 @@ func Test_handlePagePropertiesSelectWithTagName(t *testing.T) { // then assert.Len(t, snapshots, 1) // 1 relation assert.Len(t, req.PropertyIdsToSnapshots, 1) - assert.Equal(t, property.UntitledProperty, req.PropertyIdsToSnapshots[selectProperty.ID].GetDetails().GetStringOrDefault(bundle.RelationKeyName, "")) + assert.Equal(t, property.UntitledProperty, req.PropertyIdsToSnapshots[selectProperty.ID].GetDetails().GetString(bundle.RelationKeyName, "")) }) } diff --git a/core/relations_test.go b/core/relations_test.go index d086c6398..b298eba61 100644 --- a/core/relations_test.go +++ b/core/relations_test.go @@ -125,7 +125,7 @@ func TestRelations_New_Account(t *testing.T) { } } require.NotNil(t, details, "we should receive details for the relation object") - require.Equal(t, relName, details.GetStringOrDefault(bundle.RelationKeyName, ""), "we should receive the correct name for the relation object") + require.Equal(t, relName, details.GetString(bundle.RelationKeyName, ""), "we should receive the correct name for the relation object") var dataviewBlock *model.Block for _, block := range respObjectShow.ObjectView.Blocks { diff --git a/tests/integration/import_test.go b/tests/integration/import_test.go index 32efb9fed..85ef3dda4 100644 --- a/tests/integration/import_test.go +++ b/tests/integration/import_test.go @@ -56,7 +56,7 @@ func TestImportFileFromRelation(t *testing.T) { var fileObjectId string fileSub.waitOneObjectDetailsSet(t, app, func(t *testing.T, msg *pb.EventObjectDetailsSet) { - fileObjectId = msg.Details.GetStringOrDefault(bundle.RelationKeyId, "") + fileObjectId = msg.Details.GetString(bundle.RelationKeyId, "") assertImageAvailableInGateway(t, app, fileObjectId) }) objectSub.waitObjectDetailsSetWithPredicate(t, app, func(t *testing.T, msg *pb.EventObjectDetailsSet) bool { @@ -113,7 +113,7 @@ func testImportFileFromMarkdown(t *testing.T, path string) { return false }) fileSub.waitOneObjectDetailsSet(t, app, func(t *testing.T, msg *pb.EventObjectDetailsSet) { - fileObjectId := msg.Details.GetStringOrDefault(bundle.RelationKeyId, "") + fileObjectId := msg.Details.GetString(bundle.RelationKeyId, "") assertImageAvailableInGateway(t, app, fileObjectId) }) } @@ -154,7 +154,7 @@ func testImportObjectWithFileBlock(t *testing.T, path string) { return false }) fileSub.waitOneObjectDetailsSet(t, app, func(t *testing.T, msg *pb.EventObjectDetailsSet) { - fileObjectId := msg.Details.GetStringOrDefault(bundle.RelationKeyId, "") + fileObjectId := msg.Details.GetString(bundle.RelationKeyId, "") assertImageAvailableInGateway(t, app, fileObjectId) }) }