@@ -39,7 +39,7 @@ func TestAccountValidator_ValidateCreate(t *testing.T) {
3939 name : "non-organization account with denied name" ,
4040 account : & Account {
4141 ObjectMeta : metav1.ObjectMeta {Name : "admin" },
42- Spec : AccountSpec {Type : "personal " },
42+ Spec : AccountSpec {Type : "account " },
4343 },
4444 denyList : []string {"admin" , "root" , "system" },
4545 expectError : false ,
@@ -67,7 +67,7 @@ func TestAccountValidator_ValidateCreate(t *testing.T) {
6767
6868 for _ , tt := range tests {
6969 t .Run (tt .name , func (t * testing.T ) {
70- validator := & AccountValidator {DenyList : tt .denyList }
70+ validator := & AccountValidator {OrganizationNameDenyList : tt .denyList , AccountTypeAllowList : [] AccountType { AccountTypeAccount , AccountTypeOrg } }
7171 _ , err := validator .ValidateCreate (context .Background (), tt .account )
7272
7373 if tt .expectError {
@@ -117,10 +117,10 @@ func TestAccountValidator_ValidateUpdate(t *testing.T) {
117117 expectError : false ,
118118 },
119119 {
120- name : "changing from personal to organization with denied name" ,
120+ name : "changing from account to organization with denied name" ,
121121 oldAccount : & Account {
122122 ObjectMeta : metav1.ObjectMeta {Name : "admin" },
123- Spec : AccountSpec {Type : "personal " },
123+ Spec : AccountSpec {Type : "account " },
124124 },
125125 newAccount : & Account {
126126 ObjectMeta : metav1.ObjectMeta {Name : "admin" },
@@ -131,10 +131,10 @@ func TestAccountValidator_ValidateUpdate(t *testing.T) {
131131 errorMsg : `organization name "admin" is not allowed` ,
132132 },
133133 {
134- name : "changing from personal to organization with allowed name" ,
134+ name : "changing from account to organization with allowed name" ,
135135 oldAccount : & Account {
136136 ObjectMeta : metav1.ObjectMeta {Name : "my-account" },
137- Spec : AccountSpec {Type : "personal " },
137+ Spec : AccountSpec {Type : "account " },
138138 },
139139 newAccount : & Account {
140140 ObjectMeta : metav1.ObjectMeta {Name : "my-account" },
@@ -144,27 +144,27 @@ func TestAccountValidator_ValidateUpdate(t *testing.T) {
144144 expectError : false ,
145145 },
146146 {
147- name : "changing from organization to personal with denied name" ,
147+ name : "changing from organization to account with denied name" ,
148148 oldAccount : & Account {
149149 ObjectMeta : metav1.ObjectMeta {Name : "admin" },
150150 Spec : AccountSpec {Type : "org" },
151151 },
152152 newAccount : & Account {
153153 ObjectMeta : metav1.ObjectMeta {Name : "admin" },
154- Spec : AccountSpec {Type : "personal " },
154+ Spec : AccountSpec {Type : "account " },
155155 },
156156 denyList : []string {"admin" , "root" , "system" },
157157 expectError : false ,
158158 },
159159 {
160- name : "updating personal account with denied name" ,
160+ name : "updating account account with denied name" ,
161161 oldAccount : & Account {
162162 ObjectMeta : metav1.ObjectMeta {Name : "admin" },
163- Spec : AccountSpec {Type : "personal " },
163+ Spec : AccountSpec {Type : "account " },
164164 },
165165 newAccount : & Account {
166166 ObjectMeta : metav1.ObjectMeta {Name : "admin" },
167- Spec : AccountSpec {Type : "personal " },
167+ Spec : AccountSpec {Type : "account " },
168168 },
169169 denyList : []string {"admin" , "root" , "system" },
170170 expectError : false ,
@@ -200,7 +200,7 @@ func TestAccountValidator_ValidateUpdate(t *testing.T) {
200200
201201 for _ , tt := range tests {
202202 t .Run (tt .name , func (t * testing.T ) {
203- validator := & AccountValidator {DenyList : tt .denyList }
203+ validator := & AccountValidator {OrganizationNameDenyList : tt .denyList , AccountTypeAllowList : [] AccountType { AccountTypeAccount , AccountTypeOrg } }
204204 _ , err := validator .ValidateUpdate (context .Background (), tt .oldAccount , tt .newAccount )
205205
206206 if tt .expectError {
0 commit comments