From e8771e59a7ebb40541d532f4c7aa6b0b3c830667 Mon Sep 17 00:00:00 2001 From: Matt Gilman Date: Thu, 6 Apr 2017 14:39:40 -0400 Subject: [PATCH] NIFI-2940: - Fixing broken integration test following changes introduced in NIFI-2940. This closes #1653. Signed-off-by: Bryan Bende --- .../accesscontrol/ITFlowAccessControl.java | 32 ++++++++++++++++--- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/accesscontrol/ITFlowAccessControl.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/accesscontrol/ITFlowAccessControl.java index 9c7b5c6ba6..0deffeff88 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/accesscontrol/ITFlowAccessControl.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/integration/accesscontrol/ITFlowAccessControl.java @@ -183,19 +183,21 @@ public class ITFlowAccessControl { */ @Test public void testGetAction() throws Exception { - final String uri = helper.getBaseUrl() + "/flow/history/1"; + final String uri = helper.getBaseUrl() + "/flow/history/98766"; ClientResponse response; - // the action does not exist... all users should return 403 + // the action does not exist... should return 404 // read response = helper.getReadUser().testGet(uri); - assertEquals(403, response.getStatus()); + assertEquals(404, response.getStatus()); // read/write response = helper.getReadWriteUser().testGet(uri); - assertEquals(403, response.getStatus()); + assertEquals(404, response.getStatus()); + + // no read access should return 403 // write response = helper.getWriteUser().testGet(uri); @@ -213,7 +215,27 @@ public class ITFlowAccessControl { */ @Test public void testGetComponentHistory() throws Exception { - testComponentSpecificGetUri(helper.getBaseUrl() + "/flow/history/components/my-component"); + final String uri = helper.getBaseUrl() + "/flow/history/components/my-component-id"; + + // will succeed due to controller level access + + // read + ClientResponse response = helper.getReadUser().testGet(uri); + assertEquals(200, response.getStatus()); + + // read/write + response = helper.getReadWriteUser().testGet(uri); + assertEquals(200, response.getStatus()); + + // will be denied because component does not exist and no controller level access + + // write + response = helper.getWriteUser().testGet(uri); + assertEquals(403, response.getStatus()); + + // none + response = helper.getNoneUser().testGet(uri); + assertEquals(403, response.getStatus()); } public void testComponentSpecificGetUri(final String uri) throws Exception {