@@ -130,6 +130,21 @@ func TestConfigUnmarshal(t *testing.T) {
130130 assert .Equal (t , true , myContextSharing .AutoAcceptTrusted )
131131 assert .Equal (t , []string {"linagora.com" }, myContextSharing .TrustedDomains )
132132
133+ // Test GetAntivirusConfig for my-context (includes duration parsing)
134+ myContextAntivirus := GetAntivirusConfig ("my-context" )
135+ assert .Equal (t , true , myContextAntivirus .Enabled )
136+ assert .Equal (t , "localhost:3310" , myContextAntivirus .Address )
137+ assert .Equal (t , 5 * time .Minute , myContextAntivirus .Timeout )
138+ assert .Equal (t , int64 (104857600 ), myContextAntivirus .MaxFileSize )
139+ assert .Equal (t , "warn" , myContextAntivirus .OnInfected )
140+ assert .Equal (t , true , myContextAntivirus .Notifications .EmailOnInfected )
141+ assert .Equal (t , []string {"download" , "preview" }, myContextAntivirus .Actions ["pending" ])
142+ assert .Equal (t , []string {"delete" }, myContextAntivirus .Actions ["infected" ])
143+
144+ // Test GetAntivirusConfig for non-existent context returns disabled
145+ nonExistentAntivirus := GetAntivirusConfig ("non-existent" )
146+ assert .Equal (t , false , nonExistentAntivirus .Enabled )
147+
133148 // Test GetSharingConfig for default context
134149 defaultSharing := GetSharingConfig ("default" )
135150 assert .Equal (t , true , defaultSharing .AutoAcceptTrusted )
@@ -156,6 +171,21 @@ func TestConfigUnmarshal(t *testing.T) {
156171 "auto_accept_trusted" : true ,
157172 "trusted_domains" : []interface {}{"linagora.com" },
158173 },
174+ "antivirus" : map [string ]interface {}{
175+ "enabled" : true ,
176+ "address" : "localhost:3310" ,
177+ "timeout" : "5m" ,
178+ "max_file_size" : 104857600 ,
179+ "on_infected" : "warn" ,
180+ "notifications" : map [string ]interface {}{
181+ "email_on_infected" : true ,
182+ },
183+ "actions" : map [string ]interface {}{
184+ "pending" : []interface {}{"download" , "preview" },
185+ "clean" : []interface {}{"download" , "share" , "preview" , "delete" },
186+ "infected" : []interface {}{"delete" },
187+ },
188+ },
159189 "logos" : map [string ]interface {}{
160190 "coachco2" : map [string ]interface {}{
161191 "light" : []interface {}{
0 commit comments