6
6
"github.com/stretchr/testify/assert"
7
7
"github.com/stretchr/testify/require"
8
8
9
+ "github.com/aquasecurity/trivy/internal/testutil"
10
+ "github.com/aquasecurity/trivy/pkg/iac/providers/azure/storage"
9
11
"github.com/aquasecurity/trivy/pkg/iac/scanners/azure"
10
12
"github.com/aquasecurity/trivy/pkg/iac/types"
11
13
)
@@ -43,6 +45,10 @@ func Test_AdaptStorage(t *testing.T) {
43
45
"minimumTlsVersion" : azure .NewValue ("TLS1_2" , types .NewTestMetadata ()),
44
46
"supportsHttpsTrafficOnly" : azure .NewValue (true , types .NewTestMetadata ()),
45
47
"publicNetworkAccess" : azure .NewValue ("Disabled" , types .NewTestMetadata ()),
48
+ "networkAcls" : azure .NewValue (map [string ]azure.Value {
49
+ "bypass" : azure .NewValue ("Logging, Metrics" , types .NewTestMetadata ()),
50
+ "defaultAction" : azure .NewValue ("Allow" , types .NewTestMetadata ()),
51
+ }, types .NewTestMetadata ()),
46
52
}, types .NewTestMetadata ()),
47
53
},
48
54
},
@@ -52,9 +58,20 @@ func Test_AdaptStorage(t *testing.T) {
52
58
53
59
require .Len (t , output .Accounts , 1 )
54
60
55
- account := output .Accounts [0 ]
56
- assert .Equal (t , "TLS1_2" , account .MinimumTLSVersion .Value ())
57
- assert .True (t , account .EnforceHTTPS .Value ())
58
- assert .False (t , account .PublicNetworkAccess .Value ())
61
+ expected := storage.Storage {
62
+ Accounts : []storage.Account {{
63
+ MinimumTLSVersion : types .StringTest ("TLS1_2" ),
64
+ EnforceHTTPS : types .BoolTest (true ),
65
+ PublicNetworkAccess : types .BoolTest (false ),
66
+ NetworkRules : []storage.NetworkRule {{
67
+ Bypass : []types.StringValue {
68
+ types .StringTest ("Logging" ),
69
+ types .StringTest ("Metrics" ),
70
+ },
71
+ AllowByDefault : types .BoolTest (true ),
72
+ }},
73
+ }},
74
+ }
59
75
76
+ testutil .AssertDefsecEqual (t , expected , output )
60
77
}
0 commit comments