mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
ACS-4779: Adding update for tests after Tome's review
This commit is contained in:
@@ -10,10 +10,20 @@ import org.alfresco.utility.testrail.annotation.TestRail;
|
|||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
import static org.alfresco.utility.data.RandomData.getRandomName;
|
||||||
|
import static org.alfresco.utility.report.log.Step.STEP;
|
||||||
|
import static org.springframework.http.HttpStatus.CREATED;
|
||||||
|
import static org.springframework.http.HttpStatus.OK;
|
||||||
|
|
||||||
@Test(groups = {TestGroup.REQUIRE_SOLR})
|
@Test(groups = {TestGroup.REQUIRE_SOLR})
|
||||||
public class GetTagTests extends TagsDataPrep
|
public class GetTagTests extends TagsDataPrep
|
||||||
{
|
{
|
||||||
|
|
||||||
|
private static final String FIELD_ID = "id";
|
||||||
|
private static final String FIELD_TAG = "tag";
|
||||||
|
private static final String FIELD_COUNT = "count";
|
||||||
|
private static final String TAG_NAME_PREFIX = "tag-name";
|
||||||
|
|
||||||
@TestRail(section = { TestGroup.REST_API, TestGroup.TAGS }, executionType = ExecutionType.REGRESSION, description = "Verify admin user gets tag using REST API and status code is OK (200)")
|
@TestRail(section = { TestGroup.REST_API, TestGroup.TAGS }, executionType = ExecutionType.REGRESSION, description = "Verify admin user gets tag using REST API and status code is OK (200)")
|
||||||
@Test(groups = { TestGroup.REST_API, TestGroup.TAGS, TestGroup.REGRESSION })
|
@Test(groups = { TestGroup.REST_API, TestGroup.TAGS, TestGroup.REGRESSION })
|
||||||
public void adminIsAbleToGetTag() throws Exception
|
public void adminIsAbleToGetTag() throws Exception
|
||||||
@@ -128,4 +138,46 @@ public class GetTagTests extends TagsDataPrep
|
|||||||
.descriptionURLIs(RestErrorModel.RESTAPIEXPLORER)
|
.descriptionURLIs(RestErrorModel.RESTAPIEXPLORER)
|
||||||
.stackTraceIs(RestErrorModel.STACKTRACE);
|
.stackTraceIs(RestErrorModel.STACKTRACE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Verify if count field is present and with value 0 for searched tag.
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Test(groups = {TestGroup.REST_API, TestGroup.TAGS, TestGroup.REGRESSION})
|
||||||
|
public void testGetTag_includingCount() {
|
||||||
|
STEP("Create single tag as admin");
|
||||||
|
final RestTagModel tagModel = createTagModelWithName(getRandomName(TAG_NAME_PREFIX).toLowerCase());
|
||||||
|
final RestTagModel createdTag = restClient.authenticateUser(adminUserModel).withCoreAPI().createSingleTag(tagModel);
|
||||||
|
|
||||||
|
restClient.assertStatusCodeIs(CREATED);
|
||||||
|
|
||||||
|
STEP("Get a single tag, including count and verify if it is 0");
|
||||||
|
final RestTagModel searchedTag = restClient.withCoreAPI().include(FIELD_COUNT).getTag(createdTag);
|
||||||
|
|
||||||
|
restClient.assertStatusCodeIs(OK);
|
||||||
|
searchedTag.assertThat().field(FIELD_TAG).is(tagModel.getTag())
|
||||||
|
.assertThat().field(FIELD_ID).isNotEmpty()
|
||||||
|
.assertThat().field(FIELD_COUNT).is(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Verify if count field is not present for searched tag.
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Test(groups = {TestGroup.REST_API, TestGroup.TAGS, TestGroup.REGRESSION})
|
||||||
|
public void testGetTag_notIncludingCount() {
|
||||||
|
STEP("Create single tag as admin");
|
||||||
|
final RestTagModel tagModel = createTagModelWithName(getRandomName(TAG_NAME_PREFIX).toLowerCase());
|
||||||
|
final RestTagModel createdTag = restClient.authenticateUser(adminUserModel).withCoreAPI().createSingleTag(tagModel);
|
||||||
|
|
||||||
|
restClient.assertStatusCodeIs(CREATED);
|
||||||
|
|
||||||
|
STEP("Get a single tag, not including count and verify if it is not present in the response");
|
||||||
|
final RestTagModel searchedTag = restClient.withCoreAPI().getTag(createdTag);
|
||||||
|
|
||||||
|
restClient.assertStatusCodeIs(OK);
|
||||||
|
searchedTag.assertThat().field(FIELD_TAG).is(tagModel.getTag())
|
||||||
|
.assertThat().field(FIELD_ID).isNotEmpty()
|
||||||
|
.assertThat().field(FIELD_COUNT).isNull();
|
||||||
|
}
|
||||||
}
|
}
|
@@ -237,65 +237,17 @@ public class GetTagsTests extends TagsDataPrep
|
|||||||
.and().entriesListDoesNotContain("tag", removedTag.toLowerCase());
|
.and().entriesListDoesNotContain("tag", removedTag.toLowerCase());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Verify if count field is present and with value 0 for searched tag.
|
|
||||||
*/
|
|
||||||
|
|
||||||
@Test(groups = { TestGroup.REST_API, TestGroup.TAGS, TestGroup.REGRESSION })
|
|
||||||
public void testGetTag_includingCount()
|
|
||||||
{
|
|
||||||
STEP("Create single tag as admin including count and verify if it is 0");
|
|
||||||
final RestTagModel tagModel = createTagModelWithName(getRandomName(TAG_NAME_PREFIX).toLowerCase());
|
|
||||||
final RestTagModel createdTag = restClient.authenticateUser(adminUserModel).withCoreAPI().include(FIELD_COUNT).createSingleTag(tagModel);
|
|
||||||
|
|
||||||
restClient.assertStatusCodeIs(CREATED);
|
|
||||||
|
|
||||||
STEP("Get a single tag, including count and verify if it is 0");
|
|
||||||
final RestTagModel searchedTag = restClient.withCoreAPI().include(FIELD_COUNT).getTag(createdTag);
|
|
||||||
restClient.assertStatusCodeIs(OK);
|
|
||||||
searchedTag.assertThat().field(FIELD_TAG).is(tagModel.getTag())
|
|
||||||
.assertThat().field(FIELD_ID).isNotEmpty()
|
|
||||||
.assertThat().field(FIELD_COUNT).is(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Verify if count field is not present for searched tag.
|
|
||||||
*/
|
|
||||||
|
|
||||||
@Test(groups = { TestGroup.REST_API, TestGroup.TAGS, TestGroup.REGRESSION })
|
|
||||||
public void testGetTag_notIncludingCount()
|
|
||||||
{
|
|
||||||
STEP("Create single tag as admin including count and verify if it is 0");
|
|
||||||
final RestTagModel tagModel = createTagModelWithName(getRandomName(TAG_NAME_PREFIX).toLowerCase());
|
|
||||||
final RestTagModel createdTag = restClient.authenticateUser(adminUserModel).withCoreAPI().include(FIELD_COUNT).createSingleTag(tagModel);
|
|
||||||
|
|
||||||
restClient.assertStatusCodeIs(CREATED);
|
|
||||||
|
|
||||||
STEP("Get a single tag, not including count and verify if it is not present in the response");
|
|
||||||
final RestTagModel searchedTag = restClient.withCoreAPI().getTag(createdTag);
|
|
||||||
restClient.assertStatusCodeIs(OK);
|
|
||||||
searchedTag.assertThat().field(FIELD_TAG).is(tagModel.getTag())
|
|
||||||
.assertThat().field(FIELD_ID).isNotEmpty()
|
|
||||||
.assertThat().field(FIELD_COUNT).isNull();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Verify if count field is present for searched tags.
|
* Verify if count field is present for searched tags.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Test(groups = { TestGroup.REST_API, TestGroup.TAGS, TestGroup.REGRESSION })
|
@Test(groups = {TestGroup.REST_API, TestGroup.TAGS, TestGroup.REGRESSION})
|
||||||
public void testGetTags_includingCount()
|
public void testGetTags_includingCount() {
|
||||||
{
|
|
||||||
STEP("Create single tag as admin including count and verify if it is 0");
|
|
||||||
final RestTagModel tagModel = createTagModelWithName(getRandomName(TAG_NAME_PREFIX).toLowerCase());
|
|
||||||
final RestTagModel createdTag = restClient.authenticateUser(adminUserModel).withCoreAPI().include(FIELD_COUNT).createSingleTag(tagModel);
|
|
||||||
|
|
||||||
restClient.assertStatusCodeIs(CREATED);
|
|
||||||
|
|
||||||
STEP("Get tags including count and verify if it is present int the response");
|
STEP("Get tags including count and verify if it is present int the response");
|
||||||
final RestTagModelsCollection searchedTags = restClient.withCoreAPI().include(FIELD_COUNT).getTags();
|
final RestTagModelsCollection searchedTags = restClient.withCoreAPI().include(FIELD_COUNT).getTags();
|
||||||
restClient.assertStatusCodeIs(OK);
|
|
||||||
|
|
||||||
|
restClient.assertStatusCodeIs(OK);
|
||||||
searchedTags.assertThat().entriesListIsNotEmpty()
|
searchedTags.assertThat().entriesListIsNotEmpty()
|
||||||
.assertThat().entriesListContains(FIELD_COUNT)
|
.assertThat().entriesListContains(FIELD_COUNT)
|
||||||
.assertThat().entriesListContains(FIELD_TAG)
|
.assertThat().entriesListContains(FIELD_TAG)
|
||||||
@@ -306,23 +258,16 @@ public class GetTagsTests extends TagsDataPrep
|
|||||||
* Verify if count field is not present for searched tags.
|
* Verify if count field is not present for searched tags.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Test(groups = { TestGroup.REST_API, TestGroup.TAGS, TestGroup.REGRESSION })
|
@Test(groups = {TestGroup.REST_API, TestGroup.TAGS, TestGroup.REGRESSION})
|
||||||
public void testGetTags_notIncludingCount()
|
public void testGetTags_notIncludingCount() {
|
||||||
{
|
|
||||||
STEP("Create single tag as admin including count and verify if it is 0");
|
|
||||||
final RestTagModel tagModel = createTagModelWithName(getRandomName(TAG_NAME_PREFIX).toLowerCase());
|
|
||||||
final RestTagModel createdTag = restClient.authenticateUser(adminUserModel).withCoreAPI().include(FIELD_COUNT).createSingleTag(tagModel);
|
|
||||||
|
|
||||||
restClient.assertStatusCodeIs(CREATED);
|
|
||||||
|
|
||||||
STEP("Get tags, not including count and verify if it is not in the response");
|
STEP("Get tags, not including count and verify if it is not in the response");
|
||||||
final RestTagModelsCollection searchedTags = restClient.withCoreAPI().getTags();
|
final RestTagModelsCollection searchedTags = restClient.withCoreAPI().getTags();
|
||||||
restClient.assertStatusCodeIs(OK);
|
|
||||||
|
|
||||||
|
restClient.assertStatusCodeIs(OK);
|
||||||
searchedTags.assertThat().entriesListIsNotEmpty()
|
searchedTags.assertThat().entriesListIsNotEmpty()
|
||||||
.assertThat().entriesListDoesNotContain(FIELD_COUNT)
|
.assertThat().entriesListDoesNotContain(FIELD_COUNT)
|
||||||
.assertThat().entriesListContains(FIELD_TAG, tagModel.getTag())
|
.assertThat().entriesListContains(FIELD_TAG)
|
||||||
.assertThat().entriesListContains(FIELD_ID);
|
.assertThat().entriesListContains(FIELD_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user