Skip to content
Snippets Groups Projects
Commit fcbdbb41 authored by Thomas Mortagne's avatar Thomas Mortagne
Browse files

XWIKI-12171: Add a script right to manage script macro execution permissions

* fix unit tests
parent b3c3a27a
No related branches found
No related tags found
No related merge requests found
......@@ -29,7 +29,6 @@
import java.util.Map;
import org.junit.Assert;
import org.jmock.Expectations;
import org.junit.Test;
import org.xwiki.bridge.DocumentModelBridge;
......@@ -52,6 +51,7 @@
import org.xwiki.rendering.syntax.Syntax;
import org.xwiki.rendering.transformation.MacroTransformationContext;
import org.xwiki.rendering.transformation.Transformation;
import org.xwiki.security.authorization.AuthorizationManager;
import org.xwiki.test.jmock.AbstractComponentTestCase;
import org.xwiki.velocity.VelocityManager;
......@@ -68,6 +68,8 @@ public class DisplayMacroTest extends AbstractComponentTestCase
private PrintRendererFactory rendererFactory;
private AuthorizationManager mockAuthorization;
@Override
public void setUp() throws Exception
{
......@@ -84,6 +86,9 @@ protected void registerComponents() throws Exception
super.registerComponents();
this.mockSetup = new ScriptMockSetup(getMockery(), getComponentManager());
this.mockAuthorization = registerMockComponent(AuthorizationManager.class);
this.displayMacro = (DisplayMacro) getComponentManager().getInstance(Macro.class, "display");
this.rendererFactory = getComponentManager().getInstance(PrintRendererFactory.class, "event/1.0");
}
......
......@@ -19,8 +19,6 @@
*/
package org.xwiki.rendering.internal.macro;
import static org.xwiki.rendering.test.BlockAssert.*;
import java.io.StringReader;
import java.io.StringWriter;
import java.util.Collections;
......@@ -28,12 +26,11 @@
import java.util.List;
import java.util.Map;
import org.junit.Assert;
import org.hamcrest.collection.IsArray;
import org.jmock.Expectations;
import org.jmock.api.Invocation;
import org.jmock.lib.action.CustomAction;
import org.junit.Assert;
import org.junit.Test;
import org.xwiki.bridge.DocumentModelBridge;
import org.xwiki.context.Execution;
......@@ -59,9 +56,13 @@
import org.xwiki.rendering.syntax.Syntax;
import org.xwiki.rendering.transformation.MacroTransformationContext;
import org.xwiki.rendering.transformation.Transformation;
import org.xwiki.security.authorization.AuthorizationManager;
import org.xwiki.test.jmock.AbstractComponentTestCase;
import org.xwiki.velocity.VelocityManager;
import static org.xwiki.rendering.test.BlockAssert.assertBlocks;
import static org.xwiki.rendering.test.BlockAssert.assertBlocksStartsWith;
/**
* Unit tests for {@link IncludeMacro}.
*
......@@ -81,6 +82,8 @@ public class IncludeMacroTest extends AbstractComponentTestCase
*/
private DocumentReferenceResolver<String> mockDocumentReferenceResolver;
private AuthorizationManager mockAuthorization;
@Override
public void setUp() throws Exception
{
......@@ -97,8 +100,11 @@ protected void registerComponents() throws Exception
super.registerComponents();
this.mockSetup = new ScriptMockSetup(getMockery(), getComponentManager());
this.mockDocumentReferenceResolver =
registerMockComponent(DocumentReferenceResolver.TYPE_STRING, "macro", "macroDocumentReferenceResolver");
this.mockAuthorization = registerMockComponent(AuthorizationManager.class);
this.includeMacro = getComponentManager().getInstance(Macro.class, "include");
this.rendererFactory = getComponentManager().getInstance(PrintRendererFactory.class, "event/1.0");
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment