@@ -456,13 +456,33 @@ public void testAllowOnAllowedOSVersion() {
456
456
457
457
@ Test
458
458
public void testAllowOnAllowedOSInToolOsWithWarning () {
459
+ when (preferenceManager .getPreference (SystemPreferences .DOCKER_SECURITY_TOOL_OS ))
460
+ .thenReturn ("centos" );
461
+ when (preferenceManager .getPreference (SystemPreferences .DOCKER_SECURITY_TOOL_OS_WITH_WARNING ))
462
+ .thenReturn ("ubuntu:14" );
463
+ TestUtils .generateScanResult (0 , 0 ,
464
+ 1 , toolScanResult , new ToolOSVersion ("ubuntu" , "14" ));
465
+ Assert .assertTrue (aggregatingToolScanManager .checkTool (testTool , LATEST_VERSION ).isAllowed ());
466
+ }
467
+
468
+ @ Test
469
+ public void testAllowIfAllowedOSsIsEmpty () {
459
470
when (preferenceManager .getPreference (SystemPreferences .DOCKER_SECURITY_TOOL_OS_WITH_WARNING ))
460
471
.thenReturn ("ubuntu:14" );
461
472
TestUtils .generateScanResult (0 , 0 ,
462
473
1 , toolScanResult , new ToolOSVersion ("ubuntu" , "14" ));
463
474
Assert .assertTrue (aggregatingToolScanManager .checkTool (testTool , LATEST_VERSION ).isAllowed ());
464
475
}
465
476
477
+ @ Test
478
+ public void testAllowIfAllowedOSsIsEmptyAndAllowedOSesWithWarningDoesntAllow () {
479
+ when (preferenceManager .getPreference (SystemPreferences .DOCKER_SECURITY_TOOL_OS_WITH_WARNING ))
480
+ .thenReturn ("centos" );
481
+ TestUtils .generateScanResult (0 , 0 ,
482
+ 1 , toolScanResult , new ToolOSVersion ("ubuntu" , "14" ));
483
+ Assert .assertTrue (aggregatingToolScanManager .checkTool (testTool , LATEST_VERSION ).isAllowed ());
484
+ }
485
+
466
486
@ Test
467
487
public void testDenyOnHigh () {
468
488
TestUtils .generateScanResult (MAX_CRITICAL_VULNERABILITIES , MAX_HIGH_VULNERABILITIES + 1 ,
0 commit comments