@Before public void setUp() throws Exception { expect(request.getMethod()).andReturn("POST").anyTimes(); expect(request.getParameter(Param.URL.getKey())) .andReturn(REQUEST_URL.toString()).anyTimes(); JSONObject config = new JSONObject('{' + ContainerConfig.DEFAULT_CONTAINER + ':' + "{'gadgets.container': ['default']," + "'gadgets.features':{views:" + "{aliased: {aliases: ['some-alias', 'alias']}}" + ",'core.io':" + "{unparseableCruft :\"throw 1; < don't be evil' >\"}}}}"); containerConfig = new JsonContainerConfig(config, Expressions.forTesting()); ldService = new HashLockedDomainService(containerConfig, false, new HashShaLockedDomainPrefixGenerator()); handler = new MakeRequestHandler(containerConfig, pipeline, rewriterRegistry, feedProcessorProvider, gadgetAdminStore, processor, ldService); DUMMY_TOKEN.setAppUrl("http://some/gadget.xml"); DUMMY_TOKEN.setContainer(ContainerConfig.DEFAULT_CONTAINER); expect(request.getParameter(Param.GADGET.getKey())).andReturn("http://some/gadget.xml").anyTimes(); expect(processor.process(capture(context))).andReturn(gadget).anyTimes(); expect(gadgetAdminStore.isWhitelisted(isA(String.class), isA(String.class))).andReturn(true); }
@Before public void setUp() throws Exception { expect(request.getMethod()).andReturn("POST").anyTimes(); expect(request.getParameter(Param.URL.getKey())) .andReturn(REQUEST_URL.toString()).anyTimes(); JSONObject config = new JSONObject('{' + ContainerConfig.DEFAULT_CONTAINER + ':' + "{'gadgets.container': ['default']," + "'gadgets.features':{views:" + "{aliased: {aliases: ['some-alias', 'alias']}}" + ",'core.io':" + "{unparseableCruft :\"throw 1; < don't be evil' >\"}}}}"); containerConfig = new JsonContainerConfig(config, Expressions.forTesting()); ldService = new HashLockedDomainService(containerConfig, false, new HashShaLockedDomainPrefixGenerator()); handler = new MakeRequestHandler(containerConfig, pipeline, rewriterRegistry, feedProcessorProvider, gadgetAdminStore, processor, ldService); DUMMY_TOKEN.setAppUrl("http://some/gadget.xml"); DUMMY_TOKEN.setContainer(ContainerConfig.DEFAULT_CONTAINER); expect(request.getParameter(Param.GADGET.getKey())).andReturn("http://some/gadget.xml").anyTimes(); expect(processor.process(capture(context))).andReturn(gadget).anyTimes(); expect(gadgetAdminStore.isWhitelisted(isA(String.class), isA(String.class))).andReturn(true); }