mirror of
https://github.com/Alfresco/SearchServices.git
synced 2026-09-16 18:12:56 +00:00
REPO-1308: added 'GET /action-definitions' error status checks
Added a couple of error code checks: 400 (bad request) and 401 (unauthorised) - the latter actually fails and raises the question of whether the actions API implmentation or the TAS test framework are wrong. Committing to capture the test code, but will sort it out one way or another.
This commit is contained in:
@@ -3,6 +3,7 @@ package org.alfresco.rest.actions;
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.rest.model.RestActionDefinitionModelsCollection;
|
||||
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.HttpStatus;
|
||||
@@ -20,7 +21,11 @@ public class ActionsTests extends RestTest
|
||||
{
|
||||
restClient.authenticateUser(dataContent.getAdminUser());
|
||||
|
||||
RestActionDefinitionModelsCollection restActionDefinitions = restClient.withCoreAPI().usingActions().listActionDefinitions();
|
||||
RestActionDefinitionModelsCollection restActionDefinitions = restClient.
|
||||
withCoreAPI().
|
||||
usingActions().
|
||||
listActionDefinitions();
|
||||
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
assertFalse(restActionDefinitions.isEmpty());
|
||||
restActionDefinitions.assertThat().entriesListContains("name", "copy");
|
||||
@@ -28,4 +33,32 @@ public class ActionsTests extends RestTest
|
||||
restActionDefinitions.assertThat().entriesListContains("name", "check-out");
|
||||
restActionDefinitions.assertThat().entriesListContains("name", "check-in");
|
||||
}
|
||||
|
||||
// TODO: TestGroup.ACTIONS not TestGroup.NODES
|
||||
@TestRail(section = { TestGroup.REST_API,TestGroup.NODES }, executionType = ExecutionType.REGRESSION,
|
||||
description = "Verify actions error conditions")
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.NODES, TestGroup.REGRESSION})
|
||||
public void testActionDefinitionsNegative() throws Exception{
|
||||
// Badly formed request -> 400
|
||||
{
|
||||
restClient.authenticateUser(dataContent.getAdminUser()).
|
||||
// invalid skipCount
|
||||
withParams("skipCount=-1").
|
||||
withCoreAPI().
|
||||
usingActions().
|
||||
listActionDefinitions();
|
||||
|
||||
restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST);
|
||||
|
||||
}
|
||||
|
||||
// Unauthorized -> 401
|
||||
{
|
||||
|
||||
UserModel userUnauthorized = new UserModel("invalid-user", "invalid-pasword");
|
||||
restClient.authenticateUser(userUnauthorized).withCoreAPI().usingActions().listActionDefinitions();
|
||||
restClient.assertStatusCodeIs(HttpStatus.UNAUTHORIZED);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user