groovy - Mocking Grails SecurityContextHolderAwareRequestWrapper Integration Testing -


i trying test application uses backbone , sends json object server.

in actual controller can request.json.update access json value.

now set params in teh test creating controller , calling controller.params.name = "foo" etc etc.

now object securitycontextholderawarerequestwrapper , dont know how mock 1 or create one. here of code:

  void testprocessbatch(){      /* set request here before calling closure 'processbatch'      *  mockhttpservletrequest request = new mockhttpservletrequest();     */ requestcontextholder.setrequestattributes(new servletrequestattributes(request));      controller.processbatch.call()      def result = controller.response.content     def jsonresult = json.parse(controller.response.contentasstring)      assertnotnull jsonresult.data     assertnotnull controller.response.content     assertequals controller.response.status, 200     } 


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -