@@ -283,14 +283,26 @@ class OrganizationServiceIntegrationTest : CsmRedisTestBase() {
283
283
val name = " o-connector-test-1"
284
284
val organizationRegistered =
285
285
organizationApiService.createOrganization(makeSimpleOrganizationCreateRequest(name))
286
+ val newName = " my-new-name"
287
+ val organizationUpdated = organizationApiService.updateOrganization(
288
+ organizationRegistered.id, OrganizationUpdateRequest (newName))
286
289
287
- organizationRegistered.name = " my-new-name"
288
- organizationApiService.updateOrganization(
289
- organizationRegistered.id, OrganizationUpdateRequest (organizationRegistered.name))
290
+ assertEquals(
291
+ newName, organizationApiService.getOrganization(organizationUpdated.id).name)
290
292
291
- assertEquals(
292
- organizationRegistered,
293
- organizationApiService.getOrganization(organizationRegistered.id))
293
+ // Update organization with empty body
294
+ organizationApiService.updateOrganization(
295
+ organizationUpdated.id, OrganizationUpdateRequest ())
296
+
297
+ assertEquals(
298
+ newName, organizationApiService.getOrganization(organizationUpdated.id).name)
299
+
300
+ // Update organization with null value as name
301
+ organizationApiService.updateOrganization(
302
+ organizationUpdated.id, OrganizationUpdateRequest (null ))
303
+
304
+ assertEquals(
305
+ newName, organizationApiService.getOrganization(organizationUpdated.id).name)
294
306
}
295
307
}
296
308
@@ -306,13 +318,26 @@ class OrganizationServiceIntegrationTest : CsmRedisTestBase() {
306
318
307
319
runAsOrganizationUser()
308
320
309
- organizationRegistered.name = " my-new-name"
310
- organizationApiService.updateOrganization(
311
- organizationRegistered.id, OrganizationUpdateRequest (organizationRegistered.name ))
321
+ val newName = " my-new-name"
322
+ val organizationUpdated = organizationApiService.updateOrganization(
323
+ organizationRegistered.id, OrganizationUpdateRequest (newName ))
312
324
313
- assertEquals(
314
- organizationRegistered,
315
- organizationApiService.getOrganization(organizationRegistered.id))
325
+ assertEquals(
326
+ newName, organizationApiService.getOrganization(organizationUpdated.id).name)
327
+
328
+ // Update organization with empty body
329
+ organizationApiService.updateOrganization(
330
+ organizationUpdated.id, OrganizationUpdateRequest ())
331
+
332
+ assertEquals(
333
+ newName, organizationApiService.getOrganization(organizationUpdated.id).name)
334
+
335
+ // Update organization with null value as name
336
+ organizationApiService.updateOrganization(
337
+ organizationUpdated.id, OrganizationUpdateRequest (null ))
338
+
339
+ assertEquals(
340
+ newName, organizationApiService.getOrganization(organizationUpdated.id).name)
316
341
}
317
342
}
318
343
@@ -1214,16 +1239,29 @@ class OrganizationServiceIntegrationTest : CsmRedisTestBase() {
1214
1239
@Test
1215
1240
fun `updateOrganization as resource admin organization name` () {
1216
1241
assertDoesNotThrow {
1217
- val name = " o-connector-test-1"
1218
- val organizationRegistered =
1219
- organizationApiService.createOrganization(makeSimpleOrganizationCreateRequest(name))
1220
1242
1221
- organizationRegistered.name = " my-new-name"
1222
- organizationApiService.updateOrganization(
1223
- organizationRegistered.id, OrganizationUpdateRequest (" my-new-name" ))
1243
+ val organizationRegistered =
1244
+ organizationApiService.createOrganization(makeSimpleOrganizationCreateRequest(" o-connector-test-1" ))
1245
+ val newName = " my-new-name"
1246
+ val organizationUpdated = organizationApiService.updateOrganization(
1247
+ organizationRegistered.id, OrganizationUpdateRequest (newName))
1224
1248
1225
1249
assertEquals(
1226
- organizationRegistered, organizationApiService.getOrganization(organizationRegistered.id))
1250
+ newName, organizationApiService.getOrganization(organizationUpdated.id).name)
1251
+
1252
+ // Update organization with empty body
1253
+ organizationApiService.updateOrganization(
1254
+ organizationUpdated.id, OrganizationUpdateRequest ())
1255
+
1256
+ assertEquals(
1257
+ newName, organizationApiService.getOrganization(organizationUpdated.id).name)
1258
+
1259
+ // Update organization with null value as name
1260
+ organizationApiService.updateOrganization(
1261
+ organizationUpdated.id, OrganizationUpdateRequest (null ))
1262
+
1263
+ assertEquals(
1264
+ newName, organizationApiService.getOrganization(organizationUpdated.id).name)
1227
1265
}
1228
1266
}
1229
1267
@@ -1239,12 +1277,26 @@ class OrganizationServiceIntegrationTest : CsmRedisTestBase() {
1239
1277
1240
1278
runAsPlatformAdmin()
1241
1279
1242
- organizationRegistered.name = " my-new-name"
1243
- organizationApiService.updateOrganization(
1244
- organizationRegistered.id, OrganizationUpdateRequest (organizationRegistered.name ))
1280
+ val newName = " my-new-name"
1281
+ val organizationUpdated = organizationApiService.updateOrganization(
1282
+ organizationRegistered.id, OrganizationUpdateRequest (newName ))
1245
1283
1246
- assertEquals(
1247
- organizationRegistered, organizationApiService.getOrganization(organizationRegistered.id))
1284
+ assertEquals(
1285
+ newName, organizationApiService.getOrganization(organizationUpdated.id).name)
1286
+
1287
+ // Update organization with empty body
1288
+ organizationApiService.updateOrganization(
1289
+ organizationUpdated.id, OrganizationUpdateRequest ())
1290
+
1291
+ assertEquals(
1292
+ newName, organizationApiService.getOrganization(organizationUpdated.id).name)
1293
+
1294
+ // Update organization with null value as name
1295
+ organizationApiService.updateOrganization(
1296
+ organizationUpdated.id, OrganizationUpdateRequest (null ))
1297
+
1298
+ assertEquals(
1299
+ newName, organizationApiService.getOrganization(organizationUpdated.id).name)
1248
1300
}
1249
1301
}
1250
1302
@@ -1256,8 +1308,26 @@ class OrganizationServiceIntegrationTest : CsmRedisTestBase() {
1256
1308
val organizationRegistered =
1257
1309
organizationApiService.createOrganization(makeSimpleOrganizationCreateRequest(name))
1258
1310
runAsPlatformAdmin()
1259
- organizationApiService.updateOrganization(
1260
- organizationRegistered.id, OrganizationUpdateRequest (" name" ))
1311
+ val newName = " my-new-name"
1312
+ val organizationUpdated = organizationApiService.updateOrganization(
1313
+ organizationRegistered.id, OrganizationUpdateRequest (newName))
1314
+
1315
+ assertEquals(
1316
+ newName, organizationApiService.getOrganization(organizationUpdated.id).name)
1317
+
1318
+ // Update organization with empty body
1319
+ organizationApiService.updateOrganization(
1320
+ organizationUpdated.id, OrganizationUpdateRequest ())
1321
+
1322
+ assertEquals(
1323
+ newName, organizationApiService.getOrganization(organizationUpdated.id).name)
1324
+
1325
+ // Update organization with null value as name
1326
+ organizationApiService.updateOrganization(
1327
+ organizationUpdated.id, OrganizationUpdateRequest (null ))
1328
+
1329
+ assertEquals(
1330
+ newName, organizationApiService.getOrganization(organizationUpdated.id).name)
1261
1331
}
1262
1332
}
1263
1333
0 commit comments