mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
ACS-5506 Tests cleanup
This commit is contained in:
@@ -115,14 +115,16 @@ public class GroupsTests extends RestTest
|
|||||||
//+ve
|
//+ve
|
||||||
restClient.authenticateUser(adminUser).withCoreAPI().usingGroups().createGroupMembership("GROUP_"+groupName, groupMembershipBodyCreate);
|
restClient.authenticateUser(adminUser).withCoreAPI().usingGroups().createGroupMembership("GROUP_"+groupName, groupMembershipBodyCreate);
|
||||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||||
restClient.authenticateUser(adminUser).withCoreAPI().usingGroups().createGroupMembership("GROUP_"+groupName, groupMembershipGroupBodyCreate);
|
|
||||||
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
|
||||||
|
|
||||||
//ListPersonMembership
|
//ListPersonMembership
|
||||||
restClient.authenticateUser(userModel).withCoreAPI().usingUser(userModel).listGroupMemberships()
|
restClient.authenticateUser(userModel).withCoreAPI().usingUser(userModel).listGroupMemberships()
|
||||||
.assertThat().entriesListContains("id", "GROUP_"+groupName);
|
.assertThat().entriesListContains("id", "GROUP_"+groupName);
|
||||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||||
|
|
||||||
|
//AddChildGroup
|
||||||
|
restClient.authenticateUser(adminUser).withCoreAPI().usingGroups().createGroupMembership("GROUP_"+groupName, groupMembershipGroupBodyCreate);
|
||||||
|
restClient.assertStatusCodeIs(HttpStatus.CREATED);
|
||||||
|
|
||||||
//CheckListDetails
|
//CheckListDetails
|
||||||
restClient.withCoreAPI().usingParams("include=zones").usingGroups().getGroupDetail("GROUP_"+groupName)
|
restClient.withCoreAPI().usingParams("include=zones").usingGroups().getGroupDetail("GROUP_"+groupName)
|
||||||
.assertThat().field("id").is("GROUP_"+groupName)
|
.assertThat().field("id").is("GROUP_"+groupName)
|
||||||
|
@@ -229,7 +229,6 @@ public class GroupsTest extends BaseWebScriptTest
|
|||||||
assertEquals("shortName wrong", TEST_ROOTGROUP, rootGroup.getString("shortName"));
|
assertEquals("shortName wrong", TEST_ROOTGROUP, rootGroup.getString("shortName"));
|
||||||
assertEquals("displayName wrong", TEST_ROOTGROUP_DISPLAY_NAME, rootGroup.getString("displayName"));
|
assertEquals("displayName wrong", TEST_ROOTGROUP_DISPLAY_NAME, rootGroup.getString("displayName"));
|
||||||
assertEquals("authorityType wrong", "GROUP", rootGroup.getString("authorityType"));
|
assertEquals("authorityType wrong", "GROUP", rootGroup.getString("authorityType"));
|
||||||
assertEquals("hasSubgroups wrong", true, rootGroup.getString("hasSubgroups"));
|
|
||||||
gotRootGroup = true;
|
gotRootGroup = true;
|
||||||
}
|
}
|
||||||
if(rootGroup.getString("shortName").equals(EMAIL_GROUP))
|
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("shortName wrong", TEST_ROOTGROUP, rootGroup.getString("shortName"));
|
||||||
assertEquals("displayName wrong", TEST_ROOTGROUP_DISPLAY_NAME, rootGroup.getString("displayName"));
|
assertEquals("displayName wrong", TEST_ROOTGROUP_DISPLAY_NAME, rootGroup.getString("displayName"));
|
||||||
assertEquals("authorityType wrong", "GROUP", rootGroup.getString("authorityType"));
|
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("shortName wrong", TEST_ROOTGROUP, rootGroup.getString("shortName"));
|
||||||
assertEquals("displayName wrong", TEST_ROOTGROUP_DISPLAY_NAME, rootGroup.getString("displayName"));
|
assertEquals("displayName wrong", TEST_ROOTGROUP_DISPLAY_NAME, rootGroup.getString("displayName"));
|
||||||
assertEquals("authorityType wrong", "GROUP", rootGroup.getString("authorityType"));
|
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();
|
JSONObject newGroupJSON = new JSONObject();
|
||||||
newGroupJSON.put("displayName", myDisplayName);
|
newGroupJSON.put("displayName", myDisplayName);
|
||||||
newGroupJSON.put("description", "testDesc");
|
|
||||||
Response response = sendRequest(new PostRequest(URL_ROOTGROUPS + "/" + myGroupName, newGroupJSON.toString(), "application/json"), Status.STATUS_CREATED);
|
Response response = sendRequest(new PostRequest(URL_ROOTGROUPS + "/" + myGroupName, newGroupJSON.toString(), "application/json"), Status.STATUS_CREATED);
|
||||||
JSONObject top = new JSONObject(response.getContentAsString());
|
JSONObject top = new JSONObject(response.getContentAsString());
|
||||||
JSONObject rootGroup = top.getJSONObject("data");
|
JSONObject rootGroup = top.getJSONObject("data");
|
||||||
assertEquals("shortName wrong", myGroupName, rootGroup.getString("shortName"));
|
assertEquals("shortName wrong", myGroupName, rootGroup.getString("shortName"));
|
||||||
assertEquals("displayName wrong", myDisplayName, rootGroup.getString("displayName"));
|
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"));
|
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
|
* Now link in an existing user
|
||||||
*/
|
*/
|
||||||
@@ -571,17 +555,6 @@ public class GroupsTest extends BaseWebScriptTest
|
|||||||
|
|
||||||
//assertTrue("group B not removed", data.length() == 0);
|
//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)
|
* Create a new group (BUFFY)
|
||||||
@@ -640,9 +613,7 @@ public class GroupsTest extends BaseWebScriptTest
|
|||||||
{
|
{
|
||||||
String myGroupName = "GT_UG";
|
String myGroupName = "GT_UG";
|
||||||
String myDisplayName = "GT_UGDisplay";
|
String myDisplayName = "GT_UGDisplay";
|
||||||
String description = "GT_UGDesc";
|
|
||||||
String myNewDisplayName = "GT_UGDisplayNew";
|
String myNewDisplayName = "GT_UGDisplayNew";
|
||||||
String newDescription = "GT_UGDescNew";
|
|
||||||
|
|
||||||
this.authenticationComponent.setSystemUserAsCurrentUser();
|
this.authenticationComponent.setSystemUserAsCurrentUser();
|
||||||
|
|
||||||
@@ -654,7 +625,6 @@ public class GroupsTest extends BaseWebScriptTest
|
|||||||
{
|
{
|
||||||
JSONObject newGroupJSON = new JSONObject();
|
JSONObject newGroupJSON = new JSONObject();
|
||||||
newGroupJSON.put("displayName", myDisplayName);
|
newGroupJSON.put("displayName", myDisplayName);
|
||||||
newGroupJSON.put("description", description);
|
|
||||||
sendRequest(new PostRequest(URL_ROOTGROUPS + "/" + myGroupName, newGroupJSON.toString(), "application/json"), Status.STATUS_CREATED);
|
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();
|
JSONObject newGroupJSON = new JSONObject();
|
||||||
newGroupJSON.put("displayName", myNewDisplayName);
|
newGroupJSON.put("displayName", myNewDisplayName);
|
||||||
newGroupJSON.put("description", newDescription);
|
|
||||||
Response response = sendRequest(new PutRequest(URL_GROUPS + "/" + myGroupName, newGroupJSON.toString(), "application/json"), Status.STATUS_OK);
|
Response response = sendRequest(new PutRequest(URL_GROUPS + "/" + myGroupName, newGroupJSON.toString(), "application/json"), Status.STATUS_OK);
|
||||||
JSONObject top = new JSONObject(response.getContentAsString());
|
JSONObject top = new JSONObject(response.getContentAsString());
|
||||||
logger.debug(response.getContentAsString());
|
logger.debug(response.getContentAsString());
|
||||||
JSONObject data = top.getJSONObject("data");
|
JSONObject data = top.getJSONObject("data");
|
||||||
assertTrue(data.length() > 0);
|
assertTrue(data.length() > 0);
|
||||||
assertEquals("displayName wrong", myNewDisplayName, data.getString("displayName"));
|
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");
|
JSONObject data = top.getJSONObject("data");
|
||||||
assertTrue(data.length() > 0);
|
assertTrue(data.length() > 0);
|
||||||
assertEquals("displayName wrong", myNewDisplayName, data.getString("displayName"));
|
assertEquals("displayName wrong", myNewDisplayName, data.getString("displayName"));
|
||||||
assertEquals("description wrong", newDescription, data.getString("description"));
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Negative test
|
* Negative test
|
||||||
|
Reference in New Issue
Block a user