mirror of
https://github.com/Alfresco/SearchServices.git
synced 2026-09-16 18:12:56 +00:00
update - formatting, adding some missing tests
This commit is contained in:
@@ -51,10 +51,12 @@ public class GetFavoriteSiteCoreTests extends RestTest
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.CORE })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION, description = "Verify User fails to get specific favorite site of admin with Rest API and response is 403")
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify User fails to get specific favorite site of admin with Rest API and response is 403")
|
||||
public void userFailsToGetFavoriteSiteOfAdmin() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(userModel).withCoreAPI().usingUser(dataUser.getAdminUser()).getFavoriteSite(site1);
|
||||
restClient.assertStatusCodeIs(HttpStatus.FORBIDDEN).assertLastError().containsSummary(RestErrorModel.PERMISSION_WAS_DENIED);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
package org.alfresco.rest.favorites;
|
||||
|
||||
import org.alfresco.dataprep.CMISUtil.DocumentType;
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.core.RestRequest;
|
||||
import org.alfresco.rest.model.RestErrorModel;
|
||||
import org.alfresco.rest.model.RestSiteModel;
|
||||
import org.alfresco.rest.model.RestSiteModelsCollection;
|
||||
import org.alfresco.utility.constants.UserRole;
|
||||
import org.alfresco.utility.model.FileModel;
|
||||
import org.alfresco.utility.model.FolderModel;
|
||||
import org.alfresco.utility.model.SiteModel;
|
||||
import org.alfresco.utility.model.TestGroup;
|
||||
@@ -126,6 +128,18 @@ public class GetFavoriteSiteFullTests extends RestTest
|
||||
.containsSummary(String.format(RestErrorModel.RELATIONSHIP_NOT_FOUND, userModel.getUsername(), folder.getName()));
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.FULL })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify invalid request returns status 404 when providing file name instead of site id")
|
||||
public void getFavoriteSiteUsingFile() throws Exception
|
||||
{
|
||||
FileModel file = dataContent.usingSite(site1).createContent(DocumentType.TEXT_PLAIN);
|
||||
SiteModel siteFolder = new SiteModel(file.getName());
|
||||
restSiteModel = restClient.authenticateUser(userModel).withCoreAPI().usingMe().getFavoriteSite(siteFolder);
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError()
|
||||
.containsSummary(String.format(RestErrorModel.RELATIONSHIP_NOT_FOUND, userModel.getUsername(), file.getName()));
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.FULL })
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.PEOPLE }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify request returns status 200 when using valid parameters")
|
||||
|
||||
@@ -40,10 +40,8 @@ public class AddSiteMemberCoreTests extends RestTest
|
||||
usersWithRolesToPrivateSite = dataUser.addUsersWithRolesToSite(privateSiteModel, UserRole.SiteManager, UserRole.SiteCollaborator,
|
||||
UserRole.SiteConsumer,UserRole.SiteContributor);
|
||||
addMembersJson = "{\"role\":\"%s\",\"id\":\"%s\"}, {\"role\":\"%s\",\"id\":\"%s\"}";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.SITES, TestGroup.CORE })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.SITES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify that manager can add another user as manager to a public site and gets status code CREATED (201)")
|
||||
|
||||
@@ -36,7 +36,12 @@ public class GetProcessCoreTests extends RestTest
|
||||
newProcess.setId(processId);
|
||||
restClient.authenticateUser(dataUser.getAdminUser())
|
||||
.withWorkflowAPI().usingProcess(newProcess).getProcess();
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError().containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, processId));
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND)
|
||||
.assertLastError()
|
||||
.containsSummary(String.format(RestErrorModel.ENTITY_NOT_FOUND, processId))
|
||||
.containsErrorKey(RestErrorModel.ENTITY_NOT_FOUND_ERRORKEY)
|
||||
.descriptionURLIs(RestErrorModel.RESTAPIEXPLORER)
|
||||
.stackTraceIs(RestErrorModel.STACKTRACE);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW,TestGroup.PROCESSES}, executionType = ExecutionType.REGRESSION,
|
||||
@@ -57,7 +62,9 @@ public class GetProcessCoreTests extends RestTest
|
||||
RestProcessModel networkProcess1 = restClient.authenticateUser(adminTenantUser1).withWorkflowAPI().addProcess("activitiReview", tenantUser1, false, CMISUtil.Priority.High);
|
||||
|
||||
restClient.authenticateUser(tenantUser2).withWorkflowAPI().usingProcess(networkProcess1).getProcess();
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED)
|
||||
.assertLastError().containsErrorKey(RestErrorModel.API_DEFAULT_ERRORKEY)
|
||||
.containsSummary(RestErrorModel.AUTHENTICATION_FAILED);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW,TestGroup.PROCESSES }, executionType = ExecutionType.REGRESSION,
|
||||
@@ -90,7 +97,9 @@ public class GetProcessCoreTests extends RestTest
|
||||
RestProcessModel networkProcess1 = restClient.authenticateUser(adminTenantUser1).withWorkflowAPI().addProcess("activitiReview", tenantUser1, false, CMISUtil.Priority.High);
|
||||
|
||||
restClient.authenticateUser(adminUser).withWorkflowAPI().usingProcess(networkProcess1).getProcess();
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED)
|
||||
.assertLastError().containsErrorKey(RestErrorModel.API_DEFAULT_ERRORKEY)
|
||||
.containsSummary(RestErrorModel.AUTHENTICATION_FAILED);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -66,8 +66,7 @@ public class UpdateTaskCoreTestsBulk2 extends RestTest
|
||||
|
||||
restClient.authenticateUser(owner)
|
||||
.withParams("select=state").withWorkflowAPI().usingTask(taskModel).updateTask("resolved");
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS, TestGroup.CORE })
|
||||
|
||||
+36
@@ -3,6 +3,8 @@ package org.alfresco.rest.workflow.tasks.variables;
|
||||
import org.alfresco.dataprep.CMISUtil;
|
||||
import org.alfresco.dataprep.CMISUtil.DocumentType;
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.core.RestRequest;
|
||||
import org.alfresco.rest.exception.EmptyJsonResponseException;
|
||||
import org.alfresco.rest.model.RestErrorModel;
|
||||
import org.alfresco.rest.model.RestProcessModel;
|
||||
import org.alfresco.rest.model.RestTaskModel;
|
||||
@@ -15,6 +17,7 @@ import org.alfresco.utility.model.TestGroup;
|
||||
import org.alfresco.utility.model.UserModel;
|
||||
import org.alfresco.utility.testrail.ExecutionType;
|
||||
import org.alfresco.utility.testrail.annotation.TestRail;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
@@ -29,6 +32,7 @@ public class AddTaskVariablesFullTests extends RestTest
|
||||
private TaskModel taskModel;
|
||||
private RestVariableModel restVariablemodel, variableModel, variableModel1;
|
||||
private RestVariableModelsCollection restVariableCollection;
|
||||
private String taskId;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws Exception
|
||||
@@ -39,6 +43,8 @@ public class AddTaskVariablesFullTests extends RestTest
|
||||
siteModel = dataSite.usingUser(adminUser).createPublicRandomSite();
|
||||
fileModel = dataContent.usingSite(siteModel).createContent(DocumentType.TEXT_PLAIN);
|
||||
taskModel = dataWorkflow.usingUser(userWhoStartsTask).usingSite(siteModel).usingResource(fileModel).createNewTaskAndAssignTo(assigneeUser);
|
||||
|
||||
taskId = taskModel.getId();
|
||||
}
|
||||
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS, TestGroup.FULL })
|
||||
@@ -102,6 +108,36 @@ public class AddTaskVariablesFullTests extends RestTest
|
||||
.stackTraceIs(RestErrorModel.STACKTRACE);
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Update task variable with invalid variable name")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS, TestGroup.FULL })
|
||||
public void createTaskVariableWithInvalidVariableName() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(adminUser).withWorkflowAPI();
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.POST, "{\"scope\": \"local\",\"names\": \"varName\",\"value\": \"test\","
|
||||
+ "\"type\": \"d:text\"}", "tasks/{taskId}/variables", taskId);
|
||||
restClient.processModel(RestVariableModel.class, request);
|
||||
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST)
|
||||
.assertLastError()
|
||||
.containsSummary(String.format(RestErrorModel.NO_CONTENT,"Unrecognized field " + "\"names\""));
|
||||
}
|
||||
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Create task variable with invalid name")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS, TestGroup.FULL })
|
||||
public void createTaskVariableWithInvalidName() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(adminUser).withWorkflowAPI();
|
||||
RestRequest request = RestRequest.requestWithBody(HttpMethod.POST, "{\"scope\": \"local\",\"name\": ',\"value\": \"test\","
|
||||
+ "\"type\": \"d:text\"}", "tasks/{taskId}/variables", taskId);
|
||||
restClient.processModel(RestVariableModel.class, request);
|
||||
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST)
|
||||
.assertLastError()
|
||||
.containsSummary(String.format(RestErrorModel.NO_CONTENT,"Unexpected character " + "('''"));
|
||||
}
|
||||
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS, TestGroup.FULL })
|
||||
@TestRail(section = {TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Create task variable with empty name")
|
||||
|
||||
+3
-3
@@ -38,7 +38,7 @@ public class DeleteTaskVariableCoreTests extends RestTest
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Delete task variable with any user")
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS, TestGroup.CORE })
|
||||
public void deleteTaskVarialbleByAnyUser() throws Exception
|
||||
public void deleteTaskVariableByAnyUser() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(userModel);
|
||||
RestVariableModel variableModel = RestVariableModel.getRandomTaskVariableModel("local", "d:text");
|
||||
@@ -97,7 +97,7 @@ public class DeleteTaskVariableCoreTests extends RestTest
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Delete task variable by non assigned user")
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS, TestGroup.CORE })
|
||||
public void deleteTaskVarialbleByNonAssignedUser() throws Exception
|
||||
public void deleteTaskVariableByNonAssignedUser() throws Exception
|
||||
{
|
||||
UserModel nonAssigned = dataUser.createRandomTestUser();
|
||||
RestVariableModel variableModel = RestVariableModel.getRandomTaskVariableModel("local", "d:text");
|
||||
@@ -112,7 +112,7 @@ public class DeleteTaskVariableCoreTests extends RestTest
|
||||
description = "Delete task variable by inexistent user")
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS, TestGroup.CORE })
|
||||
@Bug(id="MNT-16904", description = "It fails only on environment with tenants")
|
||||
public void deleteTaskVarialbleByInexistentUser() throws Exception
|
||||
public void deleteTaskVariableByInexistentUser() throws Exception
|
||||
{
|
||||
RestVariableModel variableModel = RestVariableModel.getRandomTaskVariableModel("local", "d:text");
|
||||
restClient.authenticateUser(userModel).withWorkflowAPI().usingTask(taskModel).addTaskVariable(variableModel);
|
||||
|
||||
+4
-4
@@ -40,7 +40,7 @@ public class DeleteTaskVariableFullTests extends RestTest
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Delete task variable twice")
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS, TestGroup.FULL })
|
||||
public void deleteTaskVarialbleTwice() throws Exception
|
||||
public void deleteTaskVariableTwice() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(userModel);
|
||||
RestVariableModel variableModel = RestVariableModel.getRandomTaskVariableModel("local", "d:text");
|
||||
@@ -62,7 +62,7 @@ public class DeleteTaskVariableFullTests extends RestTest
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Delete task variable with empty variable name")
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS, TestGroup.FULL })
|
||||
public void deleteTaskEmptyVarialbleName() throws Exception
|
||||
public void deleteTaskEmptyVariableName() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(userModel);
|
||||
RestVariableModel variableModel = RestVariableModel.getRandomTaskVariableModel("local", "d:text");
|
||||
@@ -80,7 +80,7 @@ public class DeleteTaskVariableFullTests extends RestTest
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Delete task variable with empty variable scope")
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS, TestGroup.FULL })
|
||||
public void deleteTaskEmptyVarialbleScope() throws Exception
|
||||
public void deleteTaskEmptyVariableScope() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(userModel);
|
||||
RestVariableModel variableModel = RestVariableModel.getRandomTaskVariableModel("local", "d:text");
|
||||
@@ -97,7 +97,7 @@ public class DeleteTaskVariableFullTests extends RestTest
|
||||
@TestRail(section = { TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Delete task variable with invalid variable name")
|
||||
@Test(groups = {TestGroup.REST_API, TestGroup.WORKFLOW, TestGroup.TASKS, TestGroup.FULL })
|
||||
public void deleteTaskInvalidVarialbleName() throws Exception
|
||||
public void deleteTaskInvalidVariableName() throws Exception
|
||||
{
|
||||
restClient.authenticateUser(userModel);
|
||||
RestVariableModel variableModel = RestVariableModel.getRandomTaskVariableModel("local", "d:text");
|
||||
|
||||
Reference in New Issue
Block a user