github.com/openshift/installer@v1.4.17/pkg/destroy/gcp/policybinding_test.go (about) 1 package gcp 2 3 import ( 4 "testing" 5 6 "github.com/stretchr/testify/assert" 7 ) 8 9 func Test_policyMemberToEmail(t *testing.T) { 10 cases := []struct { 11 member string 12 email string 13 }{{ 14 member: "serviceAccount:operator@project", 15 email: "operator@project", 16 }, { 17 member: "deleted:serviceAccount:operator@project", 18 email: "operator@project", 19 }, { 20 member: "deleted:serviceAccount:operator@project?uid=1231243234", 21 email: "operator@project", 22 }, { 23 member: "user:user@project", 24 email: "user:user@project", 25 }, { 26 member: "deleted:user:user@project", 27 email: "user:user@project", 28 }, { 29 member: "deleted:user:user@project?uid=1232131243", 30 email: "user:user@project", 31 }} 32 for _, test := range cases { 33 t.Run("", func(t *testing.T) { 34 email := policyMemberToEmail(test.member) 35 assert.Equal(t, email, test.email) 36 }) 37 } 38 }