From 0b753c23c264be726721817a0baaeb8d0f0b2bb2 Mon Sep 17 00:00:00 2001 From: MichalKinas Date: Wed, 5 Jul 2023 21:00:10 +0200 Subject: [PATCH] ACS-5506 Tests cleanup --- .../org/alfresco/rest/groups/GroupsTests.java | 6 ++-- .../repo/web/scripts/groups/GroupsTest.java | 35 +------------------ 2 files changed, 5 insertions(+), 36 deletions(-) diff --git a/packaging/tests/tas-restapi/src/test/java/org/alfresco/rest/groups/GroupsTests.java b/packaging/tests/tas-restapi/src/test/java/org/alfresco/rest/groups/GroupsTests.java index 7ab715465f..542f6f135c 100644 --- a/packaging/tests/tas-restapi/src/test/java/org/alfresco/rest/groups/GroupsTests.java +++ b/packaging/tests/tas-restapi/src/test/java/org/alfresco/rest/groups/GroupsTests.java @@ -115,14 +115,16 @@ public class GroupsTests extends RestTest //+ve restClient.authenticateUser(adminUser).withCoreAPI().usingGroups().createGroupMembership("GROUP_"+groupName, groupMembershipBodyCreate); restClient.assertStatusCodeIs(HttpStatus.CREATED); - restClient.authenticateUser(adminUser).withCoreAPI().usingGroups().createGroupMembership("GROUP_"+groupName, groupMembershipGroupBodyCreate); - restClient.assertStatusCodeIs(HttpStatus.CREATED); //ListPersonMembership restClient.authenticateUser(userModel).withCoreAPI().usingUser(userModel).listGroupMemberships() .assertThat().entriesListContains("id", "GROUP_"+groupName); restClient.assertStatusCodeIs(HttpStatus.OK); + //AddChildGroup + restClient.authenticateUser(adminUser).withCoreAPI().usingGroups().createGroupMembership("GROUP_"+groupName, groupMembershipGroupBodyCreate); + restClient.assertStatusCodeIs(HttpStatus.CREATED); + //CheckListDetails restClient.withCoreAPI().usingParams("include=zones").usingGroups().getGroupDetail("GROUP_"+groupName) .assertThat().field("id").is("GROUP_"+groupName) diff --git a/remote-api/src/test/java/org/alfresco/repo/web/scripts/groups/GroupsTest.java b/remote-api/src/test/java/org/alfresco/repo/web/scripts/groups/GroupsTest.java index 9c15689c0e..acb889682a 100644 --- a/remote-api/src/test/java/org/alfresco/repo/web/scripts/groups/GroupsTest.java +++ b/remote-api/src/test/java/org/alfresco/repo/web/scripts/groups/GroupsTest.java @@ -229,7 +229,6 @@ public class GroupsTest extends BaseWebScriptTest assertEquals("shortName wrong", TEST_ROOTGROUP, rootGroup.getString("shortName")); assertEquals("displayName wrong", TEST_ROOTGROUP_DISPLAY_NAME, rootGroup.getString("displayName")); assertEquals("authorityType wrong", "GROUP", rootGroup.getString("authorityType")); - assertEquals("hasSubgroups wrong", true, rootGroup.getString("hasSubgroups")); gotRootGroup = true; } if(rootGroup.getString("shortName").equals(EMAIL_GROUP)) @@ -271,7 +270,6 @@ public class GroupsTest extends BaseWebScriptTest assertEquals("shortName wrong", TEST_ROOTGROUP, rootGroup.getString("shortName")); assertEquals("displayName wrong", TEST_ROOTGROUP_DISPLAY_NAME, rootGroup.getString("displayName")); assertEquals("authorityType wrong", "GROUP", rootGroup.getString("authorityType")); - assertEquals("hasSubgroups wrong", true, rootGroup.getString("hasSubgroups")); } } } @@ -295,7 +293,6 @@ public class GroupsTest extends BaseWebScriptTest assertEquals("shortName wrong", TEST_ROOTGROUP, rootGroup.getString("shortName")); assertEquals("displayName wrong", TEST_ROOTGROUP_DISPLAY_NAME, rootGroup.getString("displayName")); assertEquals("authorityType wrong", "GROUP", rootGroup.getString("authorityType")); - assertEquals("hasSubgroups wrong", true, rootGroup.getString("hasSubgroups")); } } } @@ -386,13 +383,11 @@ public class GroupsTest extends BaseWebScriptTest { JSONObject newGroupJSON = new JSONObject(); newGroupJSON.put("displayName", myDisplayName); - newGroupJSON.put("description", "testDesc"); Response response = sendRequest(new PostRequest(URL_ROOTGROUPS + "/" + myGroupName, newGroupJSON.toString(), "application/json"), Status.STATUS_CREATED); JSONObject top = new JSONObject(response.getContentAsString()); JSONObject rootGroup = top.getJSONObject("data"); assertEquals("shortName wrong", myGroupName, rootGroup.getString("shortName")); assertEquals("displayName wrong", myDisplayName, rootGroup.getString("displayName")); - assertEquals("description wrong", "testDesc", rootGroup.getString("description")); } /** @@ -508,17 +503,6 @@ public class GroupsTest extends BaseWebScriptTest assertEquals("authorityType wrong", "GROUP", subGroup.getString("authorityType")); } - /** - * Check if myGroup has subgroups - */ - { - Response response = sendRequest(new GetRequest(URL_GROUPS + "/" + myRootGroup), Status.STATUS_OK); - JSONObject top = new JSONObject(response.getContentAsString()); - logger.debug(response.getContentAsString()); - JSONObject myGroup = top.getJSONObject("data"); - assertTrue(myGroup.getBoolean("hasSubgroups")); - } - /** * Now link in an existing user */ @@ -571,17 +555,6 @@ public class GroupsTest extends BaseWebScriptTest //assertTrue("group B not removed", data.length() == 0); } - - /** - * Check if myGroup has no subgroups - */ - { - Response response = sendRequest(new GetRequest(URL_GROUPS + "/" + myRootGroup), Status.STATUS_OK); - JSONObject top = new JSONObject(response.getContentAsString()); - logger.debug(response.getContentAsString()); - JSONObject myGroup = top.getJSONObject("data"); - assertFalse(myGroup.getBoolean("hasSubgroups")); - } /** * Create a new group (BUFFY) @@ -640,9 +613,7 @@ public class GroupsTest extends BaseWebScriptTest { String myGroupName = "GT_UG"; String myDisplayName = "GT_UGDisplay"; - String description = "GT_UGDesc"; String myNewDisplayName = "GT_UGDisplayNew"; - String newDescription = "GT_UGDescNew"; this.authenticationComponent.setSystemUserAsCurrentUser(); @@ -654,7 +625,6 @@ public class GroupsTest extends BaseWebScriptTest { JSONObject newGroupJSON = new JSONObject(); newGroupJSON.put("displayName", myDisplayName); - newGroupJSON.put("description", description); sendRequest(new PostRequest(URL_ROOTGROUPS + "/" + myGroupName, newGroupJSON.toString(), "application/json"), Status.STATUS_CREATED); } @@ -664,14 +634,12 @@ public class GroupsTest extends BaseWebScriptTest { JSONObject newGroupJSON = new JSONObject(); newGroupJSON.put("displayName", myNewDisplayName); - newGroupJSON.put("description", newDescription); Response response = sendRequest(new PutRequest(URL_GROUPS + "/" + myGroupName, newGroupJSON.toString(), "application/json"), Status.STATUS_OK); JSONObject top = new JSONObject(response.getContentAsString()); logger.debug(response.getContentAsString()); JSONObject data = top.getJSONObject("data"); assertTrue(data.length() > 0); assertEquals("displayName wrong", myNewDisplayName, data.getString("displayName")); - assertEquals("description wrong", newDescription, data.getString("description")); } /** @@ -684,8 +652,7 @@ public class GroupsTest extends BaseWebScriptTest JSONObject data = top.getJSONObject("data"); assertTrue(data.length() > 0); assertEquals("displayName wrong", myNewDisplayName, data.getString("displayName")); - assertEquals("description wrong", newDescription, data.getString("description")); - } + } /** * Negative test