Fix unit test failures

This commit is contained in:
Abhishek Pandey 2023-12-03 17:39:56 -08:00
parent 1d971fb2ef
commit cddb5b2d15
3 changed files with 15 additions and 17 deletions

View File

@ -956,8 +956,8 @@ func (c *Collections) processItem(
"item_is_folder", isFolder)
if item.GetMalware() != nil {
// TODO(pandeyabs): Fix this after we move conversion logic to the top of this
// func.
// TODO(pandeyabs): Fix this after we move the ToLiteDriveItemable call
// to the beginning of this func.
addtl := graph.ItemInfo(custom.ToLiteDriveItemable(item))
skip := fault.FileSkip(fault.SkipMalware, driveID, itemID, itemName, addtl)

View File

@ -513,17 +513,15 @@ func appendIf(a []any, k string, v *string) []any {
func ItemInfo(item custom.LiteDriveItemable) map[string]any {
m := map[string]any{}
// TODO(pandeyabs): These fields are not available in the LiteDriveItemable
// yet. We need to add them.
// creator := item.GetCreatedByUser()
// if creator != nil {
// m[fault.AddtlCreatedBy] = ptr.Val(creator.GetId())
// }
creator := item.GetCreatedByUser()
if creator != nil {
m[fault.AddtlCreatedBy] = ptr.Val(creator.GetId())
}
// lastmodder := item.GetLastModifiedByUser()
// if lastmodder != nil {
// m[fault.AddtlLastModBy] = ptr.Val(lastmodder.GetId())
// }
lastmodder := item.GetLastModifiedByUser()
if lastmodder != nil {
m[fault.AddtlLastModBy] = ptr.Val(lastmodder.GetId())
}
parent := item.GetParentReference()
if parent != nil {
@ -540,10 +538,10 @@ func ItemInfo(item custom.LiteDriveItemable) map[string]any {
m[fault.AddtlContainerPath] = containerPath
}
// malware := item.GetMalware()
// if malware != nil {
// m[fault.AddtlMalwareDesc] = ptr.Val(malware.GetDescription())
// }
malware := item.GetMalware()
if malware != nil {
m[fault.AddtlMalwareDesc] = ptr.Val(malware.GetDescription())
}
return m
}

View File

@ -338,7 +338,7 @@ func ToLiteDriveItemable(item models.DriveItemable) LiteDriveItemable {
return di
}
func SetParentName(orig parentReferenceable, driveName string) parentReferenceable {
func SetParentName(orig itemReferenceable, driveName string) itemReferenceable {
if orig == nil {
return nil
}