From 64092cf3d77aaeb430c5809de76beea9fe4dd621 Mon Sep 17 00:00:00 2001 From: scosta Date: Tue, 16 May 2023 14:20:11 +0100 Subject: [PATCH] merge errors Signed-off-by: scosta --- .../security/privileges/PrivilegesEvaluatorTest.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/test/java/org/opensearch/security/privileges/PrivilegesEvaluatorTest.java b/src/test/java/org/opensearch/security/privileges/PrivilegesEvaluatorTest.java index 122fd4a698..09b3ce13b6 100644 --- a/src/test/java/org/opensearch/security/privileges/PrivilegesEvaluatorTest.java +++ b/src/test/java/org/opensearch/security/privileges/PrivilegesEvaluatorTest.java @@ -14,17 +14,24 @@ import org.apache.hc.core5.http.Header; import org.apache.hc.core5.http.HttpStatus; import org.junit.Assert; +import org.junit.Before; import org.junit.Test; import org.opensearch.common.settings.Settings; +import org.opensearch.rest.RestStatus; import org.opensearch.security.test.DynamicSecurityConfig; import org.opensearch.security.test.SingleClusterTest; import org.opensearch.security.test.helper.rest.RestHelper; +import static org.junit.Assert.assertEquals; + public class PrivilegesEvaluatorTest extends SingleClusterTest { private static final Header NegativeLookaheadUserHeader = encodeBasicHeader("negative_lookahead_user", "negative_lookahead_user"); private static final Header NegatedRegexUserHeader = encodeBasicHeader("negated_regex_user", "negated_regex_user"); + private static final String allAccessUser = "admin_all_access"; + private static final Header allAccessUserHeader = encodeBasicHeader(allAccessUser, allAccessUser); + @Before public void setupSettingsIndexPattern() throws Exception { Settings settings = Settings.builder() .put("plugins.security.system_indices.indices", ".testSystemExtensionIndex") @@ -46,7 +53,6 @@ public void setupSettingsIndexPattern() throws Exception { @Test public void testNegativeLookaheadPattern() throws Exception { - setupSettingsIndexPattern(); RestHelper rh = nonSslRestHelper(); RestHelper.HttpResponse response = rh.executeGetRequest( "*/_search", NegativeLookaheadUserHeader); @@ -57,8 +63,6 @@ public void testNegativeLookaheadPattern() throws Exception { @Test public void testRegexPattern() throws Exception { - setupSettingsIndexPattern(); - RestHelper rh = nonSslRestHelper(); RestHelper.HttpResponse response = rh.executeGetRequest( "*/_search", NegatedRegexUserHeader); Assert.assertEquals(HttpStatus.SC_FORBIDDEN, response.getStatusCode());