mirror of
https://github.com/Alfresco/SearchServices.git
synced 2026-09-16 18:12:56 +00:00
REPO-1821 : Avatar REST API
Rename GetAvatarPeopleSanityTest.java to AvatarPeopleSanityTests.java because this class contains GET/PUT/POST /people/{personId}/avatar requests.
Format the code avatar API specific code (Tests+requests).
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
package org.alfresco.rest.people;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.utility.Utility;
|
||||
import org.alfresco.utility.exception.DataPreparationException;
|
||||
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;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class AvatarPeopleSanityTest extends RestTest {
|
||||
|
||||
private UserModel userModel;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws DataPreparationException
|
||||
{
|
||||
userModel = dataUser.createRandomTestUser();
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API,
|
||||
TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Update Avatar for People")
|
||||
public void updateGetAvatarForPeople() throws Exception
|
||||
{
|
||||
|
||||
File avatarFile = Utility.getResourceTestDataFile("avatar.jpg");
|
||||
restClient.authenticateUser(userModel);
|
||||
restClient.withCoreAPI().usingAuthUser().uploadAvatarContent(restProperties.envProperty().getFullServerUrl(), avatarFile).statusCode(200);
|
||||
restClient.authenticateUser(userModel).withCoreAPI().usingAuthUser().downloadAvatarContent();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API,
|
||||
TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Update Avatar for People")
|
||||
public void removeGetAvatarForPeople() throws Exception
|
||||
{
|
||||
File avatarFile = Utility.getResourceTestDataFile("avatar.jpg");
|
||||
restClient.authenticateUser(userModel);
|
||||
restClient.withCoreAPI().usingAuthUser().uploadAvatarContent(restProperties.envProperty().getFullServerUrl(), avatarFile).statusCode(200);
|
||||
|
||||
restClient.authenticateUser(userModel);
|
||||
restClient.withCoreAPI().usingAuthUser().resetAvatarImageRequest();
|
||||
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
|
||||
|
||||
restClient.authenticateUser(userModel).withCoreAPI().usingAuthUser().downloadAvatarContent();
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
package org.alfresco.rest.people;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.alfresco.rest.RestTest;
|
||||
import org.alfresco.utility.Utility;
|
||||
import org.alfresco.utility.exception.DataPreparationException;
|
||||
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;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
public class GetAvatarPeopleSanityTest extends RestTest {
|
||||
|
||||
private UserModel userModel;
|
||||
|
||||
@BeforeClass(alwaysRun = true)
|
||||
public void dataPreparation() throws DataPreparationException {
|
||||
userModel = dataUser.createRandomTestUser();
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API,
|
||||
TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Update Avatar for People")
|
||||
public void updateGetAvatarForPeople() throws Exception {
|
||||
|
||||
File avatarFile = Utility.getResourceTestDataFile("avatar.jpg");
|
||||
restClient.authenticateUser(userModel);
|
||||
restClient.withCoreAPI().usingAuthUser()
|
||||
.uploadAvatarContent(restProperties.envProperty().getFullServerUrl(), avatarFile).statusCode(200);
|
||||
restClient.authenticateUser(userModel).withCoreAPI().usingAuthUser().downloadAvatarContent();
|
||||
restClient.assertStatusCodeIs(HttpStatus.OK);
|
||||
|
||||
}
|
||||
|
||||
@Test(groups = { TestGroup.REST_API, TestGroup.PEOPLE, TestGroup.SANITY })
|
||||
@TestRail(section = { TestGroup.REST_API,
|
||||
TestGroup.PEOPLE }, executionType = ExecutionType.SANITY, description = "Update Avatar for People")
|
||||
public void removeGetAvatarForPeople() throws Exception {
|
||||
File avatarFile = Utility.getResourceTestDataFile("avatar.jpg");
|
||||
restClient.authenticateUser(userModel);
|
||||
restClient.withCoreAPI().usingAuthUser()
|
||||
.uploadAvatarContent(restProperties.envProperty().getFullServerUrl(), avatarFile).statusCode(200);
|
||||
|
||||
restClient.authenticateUser(userModel);
|
||||
restClient.withCoreAPI().usingAuthUser().resetAvatarImageRequest();
|
||||
restClient.assertStatusCodeIs(HttpStatus.NO_CONTENT);
|
||||
|
||||
restClient.authenticateUser(userModel).withCoreAPI().usingAuthUser().downloadAvatarContent();
|
||||
restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
# dataprep related
|
||||
alfresco.scheme=http
|
||||
alfresco.server=localhost
|
||||
alfresco.server=172.29.100.209
|
||||
alfresco.port=8080
|
||||
|
||||
# credentials
|
||||
|
||||
Reference in New Issue
Block a user