Package play.test

Examples of play.test.FakeRequest.withHeader()


          result = route(request);
          assertRoute(result, "routeCreateUser_check_3", Status.OK, null, false)
         
          //now the admin suspend him again
          request = new FakeRequest(PUT, "/admin/user/suspend/" + sFakeUser);
          request = request.withHeader(TestConfig.KEY_APPCODE, TestConfig.VALUE_APPCODE);
          request = request.withHeader(TestConfig.KEY_AUTH, TestConfig.encodeAuth(TestConfig.AUTH_ADMIN));
          result = route(request);
          assertRoute(result, "routeCreateUser_admin_suspend", Status.OK, null, false)
         
          //and the user cannot login
View Full Code Here


          assertRoute(result, "routeCreateUser_check_3", Status.OK, null, false)
         
          //now the admin suspend him again
          request = new FakeRequest(PUT, "/admin/user/suspend/" + sFakeUser);
          request = request.withHeader(TestConfig.KEY_APPCODE, TestConfig.VALUE_APPCODE);
          request = request.withHeader(TestConfig.KEY_AUTH, TestConfig.encodeAuth(TestConfig.AUTH_ADMIN));
          result = route(request);
          assertRoute(result, "routeCreateUser_admin_suspend", Status.OK, null, false)
         
          //and the user cannot login
          request = new FakeRequest(GET, getRouteAddress());
View Full Code Here

          result = route(request);
          assertRoute(result, "routeCreateUser_admin_suspend", Status.OK, null, false)
         
          //and the user cannot login
          request = new FakeRequest(GET, getRouteAddress());
          request = request.withHeader(TestConfig.KEY_APPCODE, TestConfig.VALUE_APPCODE);
          request = request.withHeader(TestConfig.KEY_TOKEN, token);
          result = route(request);
          assertRoute(result, "routeCreateUser_check_4", Status.UNAUTHORIZED, null, false);       
        }
      }
View Full Code Here

          assertRoute(result, "routeCreateUser_admin_suspend", Status.OK, null, false)
         
          //and the user cannot login
          request = new FakeRequest(GET, getRouteAddress());
          request = request.withHeader(TestConfig.KEY_APPCODE, TestConfig.VALUE_APPCODE);
          request = request.withHeader(TestConfig.KEY_TOKEN, token);
          result = route(request);
          assertRoute(result, "routeCreateUser_check_4", Status.UNAUTHORIZED, null, false);       
        }
      }
    )
View Full Code Here

      {
        public void run()
        {
          String sAuthEnc = TestConfig.AUTH_ADMIN_ENC;
          FakeRequest request = new FakeRequest("DELETE", "/admin/db/100");
          request = request.withHeader(TestConfig.KEY_APPCODE, TestConfig.VALUE_APPCODE);
          request = request.withHeader(TestConfig.KEY_AUTH, sAuthEnc);
          Result result = routeAndCall(request);
          assertRoute(result, "testDelete", Status.OK, null, true);
        }//run
      }//Runnable()
View Full Code Here

        public void run()
        {
          String sAuthEnc = TestConfig.AUTH_ADMIN_ENC;
          FakeRequest request = new FakeRequest("DELETE", "/admin/db/100");
          request = request.withHeader(TestConfig.KEY_APPCODE, TestConfig.VALUE_APPCODE);
          request = request.withHeader(TestConfig.KEY_AUTH, sAuthEnc);
          Result result = routeAndCall(request);
          assertRoute(result, "testDelete", Status.OK, null, true);
        }//run
      }//Runnable()
    );//running
View Full Code Here

      new Runnable()
      {
        public void run()
        {
          FakeRequest request = new FakeRequest(getMethod(), getRouteAddress());
          request = request.withHeader(TestConfig.KEY_APPCODE, TestConfig.VALUE_APPCODE);
          request = request.withHeader(TestConfig.KEY_AUTH, TestConfig.AUTH_ADMIN_ENC);
          Result result = routeAndCall(request);
          assertRoute(result, "RouteOK Admin user", Status.OK, null, true);
         
          request = request.withHeader(TestConfig.KEY_AUTH, TestConfig.AUTH_DEFAULT_ENC);
View Full Code Here

      {
        public void run()
        {
          FakeRequest request = new FakeRequest(getMethod(), getRouteAddress());
          request = request.withHeader(TestConfig.KEY_APPCODE, TestConfig.VALUE_APPCODE);
          request = request.withHeader(TestConfig.KEY_AUTH, TestConfig.AUTH_ADMIN_ENC);
          Result result = routeAndCall(request);
          assertRoute(result, "RouteOK Admin user", Status.OK, null, true);
         
          request = request.withHeader(TestConfig.KEY_AUTH, TestConfig.AUTH_DEFAULT_ENC);
          result = routeAndCall(request);
View Full Code Here

          request = request.withHeader(TestConfig.KEY_APPCODE, TestConfig.VALUE_APPCODE);
          request = request.withHeader(TestConfig.KEY_AUTH, TestConfig.AUTH_ADMIN_ENC);
          Result result = routeAndCall(request);
          assertRoute(result, "RouteOK Admin user", Status.OK, null, true);
         
          request = request.withHeader(TestConfig.KEY_AUTH, TestConfig.AUTH_DEFAULT_ENC);
          result = routeAndCall(request);
          assertRoute(result, "RouteOK BaasBox user", Status.FORBIDDEN, null, false);
        }
      }
    );   
View Full Code Here

      new Runnable()
      {
        public void run()
        {
          FakeRequest request = new FakeRequest(getMethod(), getRouteAddress() + "?where=user.name like \"user%25\" and user.name.length() = 5 and visibleByFriend.key = \"value\"&orderBy=user.signUpDate asc");
          request = request.withHeader(TestConfig.KEY_APPCODE, TestConfig.VALUE_APPCODE);
          request = request.withHeader(TestConfig.KEY_AUTH, TestConfig.AUTH_ADMIN_ENC);
          Result result = routeAndCall(request);
          assertRoute(result, "RouteOK Admin user", Status.OK, null, false);
         
        }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.