github.com/khulnasoft-lab/defsec@v1.0.5-0.20230827010352-5e9f46893d95/pkg/scanners/azure/functions/scope_test.go (about) 1 package functions 2 3 import ( 4 "testing" 5 6 "github.com/stretchr/testify/assert" 7 ) 8 9 func Test_SubscriptionResourceID(t *testing.T) { 10 11 tests := []struct { 12 name string 13 args []interface{} 14 expected string 15 }{ 16 { 17 name: "scope resource id with subscription ID", 18 args: []interface{}{ 19 "4ec875a5-41a2-4837-88cf-4266466e65ed", 20 "Microsoft.Authorization/roleDefinitions", 21 "8e3af657-a8ff-443c-a75c-2fe8c4bcb635", 22 "b34282f6-5e3c-4306-8741-ebd7a871d187", 23 }, 24 expected: "/subscriptions/4ec875a5-41a2-4837-88cf-4266466e65ed/providers/Microsoft.Authorization/roleDefinitions/8e3af657-a8ff-443c-a75c-2fe8c4bcb635/b34282f6-5e3c-4306-8741-ebd7a871d187", 25 }, 26 } 27 28 for _, tt := range tests { 29 t.Run(tt.name, func(t *testing.T) { 30 actual := SubscriptionResourceID(tt.args...) 31 assert.Equal(t, tt.expected, actual) 32 }) 33 } 34 }