From a5b080c3578bb65b87be075c7ea835ef776c4bd2 Mon Sep 17 00:00:00 2001 From: jcule Date: Mon, 3 Jul 2017 23:16:54 +0100 Subject: [PATCH] REPO-2586: REST API: Retrieve Audit Application info - add TAS-level test --- .../rest/audit/GetAuditCoreTests.java | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/e2e-test/java/org/alfresco/rest/audit/GetAuditCoreTests.java b/e2e-test/java/org/alfresco/rest/audit/GetAuditCoreTests.java index ca477df5f..e31186544 100644 --- a/e2e-test/java/org/alfresco/rest/audit/GetAuditCoreTests.java +++ b/e2e-test/java/org/alfresco/rest/audit/GetAuditCoreTests.java @@ -2,6 +2,7 @@ package org.alfresco.rest.audit; import static org.testng.Assert.assertEquals; +import org.alfresco.rest.model.RestAuditAppModel; import org.alfresco.utility.model.TestGroup; import org.alfresco.utility.testrail.ExecutionType; import org.alfresco.utility.testrail.annotation.TestRail; @@ -21,6 +22,45 @@ public class GetAuditCoreTests extends AuditTest restClient.assertStatusCodeIs(HttpStatus.OK); restAuditCollection.assertThat().entriesListIsNotEmpty(); } + + @Test(groups = { TestGroup.REST_API, TestGroup.AUDIT, TestGroup.CORE }) + @TestRail(section = { TestGroup.REST_API, + TestGroup.AUDIT }, executionType = ExecutionType.SANITY, description = "Verify if the admin user gets audit application info") + public void getAuditApplicationInfoWithAdminUser() throws Exception + { + restAuditCollection = restClient.authenticateUser(dataUser.getAdminUser()).withCoreAPI().usingAudit().getAuditApplications(); + restClient.assertStatusCodeIs(HttpStatus.OK); + restAuditCollection.assertThat().entriesListIsNotEmpty(); + + RestAuditAppModel firstRestAuditAppModel = restAuditCollection.getEntries().get(0).onModel(); + firstRestAuditAppModel.assertThat().field("isEnabled").is(true); + firstRestAuditAppModel.assertThat().field("name").is("Alfresco Sync Service"); + firstRestAuditAppModel.assertThat().field("id").is("sync"); + + restClient.authenticateUser(dataUser.getAdminUser()).withCoreAPI().usingAudit() + .getAuditApp(firstRestAuditAppModel).assertThat().field("isEnabled").is(true); + + restClient.authenticateUser(dataUser.getAdminUser()).withCoreAPI().usingAudit() + .getAuditApp(firstRestAuditAppModel).assertThat().field("name").is("Alfresco Sync Service"); + + restClient.authenticateUser(dataUser.getAdminUser()).withCoreAPI().usingAudit() + .getAuditApp(firstRestAuditAppModel).assertThat().field("id").is("sync"); + + RestAuditAppModel secondRestAuditAppModel = restAuditCollection.getEntries().get(1).onModel(); + secondRestAuditAppModel.assertThat().field("isEnabled").is(true); + secondRestAuditAppModel.assertThat().field("name").is("Alfresco Tagging Service"); + secondRestAuditAppModel.assertThat().field("id").is("tagging"); + + restClient.authenticateUser(dataUser.getAdminUser()).withCoreAPI().usingAudit() + .getAuditApp(secondRestAuditAppModel).assertThat().field("isEnabled").is(true); + + restClient.authenticateUser(dataUser.getAdminUser()).withCoreAPI().usingAudit() + .getAuditApp(secondRestAuditAppModel).assertThat().field("name").is("Alfresco Tagging Service"); + + restClient.authenticateUser(dataUser.getAdminUser()).withCoreAPI().usingAudit() + .getAuditApp(secondRestAuditAppModel).assertThat().field("id").is("tagging"); + + } @Test(groups = { TestGroup.REST_API, TestGroup.AUDIT, TestGroup.CORE }) @TestRail(section = { TestGroup.REST_API,