Package play.test

Examples of play.test.FakeRequest.withHeader()


          JsonNode node = updatePayloadFieldValue("/adminUserCreatePayload.json", "username", sFakeUser);
          //this MUST not raise an error
          ((ObjectNode) node).put(dao.ATTRIBUTES_VISIBLE_BY_ANONYMOUS_USER,(JsonNode)null);
          // Create user
          FakeRequest request = new FakeRequest(getMethod(), getRouteAddress());
          request = request.withHeader(TestConfig.KEY_APPCODE, TestConfig.VALUE_APPCODE);
          request = request.withJsonBody(node, getMethod());
          Result result = routeAndCall(request);
         
          assertRoute(result, "routeCreateUser_issue_401", Status.BAD_REQUEST, "One or more profile sections is not a valid JSON object", true);
        }
View Full Code Here


          // Prepare test user
          JsonNode node = updatePayloadFieldValue("/adminUserCreatePayload.json", "username", sFakeUser);

          // Create user
          FakeRequest request = new FakeRequest(getMethod(), getRouteAddress());
          request = request.withHeader(TestConfig.KEY_APPCODE, TestConfig.VALUE_APPCODE);
          request = request.withJsonBody(node, getMethod());
          Result result = routeAndCall(request);
          assertRoute(result, "routeCreateUserCaseInsensitive", Status.CREATED, null, false);
          // try to create the second one
          node = updatePayloadFieldValue("/adminUserCreatePayload.json", "username", sFakeUser2);
View Full Code Here

          Result result = routeAndCall(request);
          assertRoute(result, "routeCreateUserCaseInsensitive", Status.CREATED, null, false);
          // try to create the second one
          node = updatePayloadFieldValue("/adminUserCreatePayload.json", "username", sFakeUser2);
          request = new FakeRequest(getMethod(), getRouteAddress());
          request = request.withHeader(TestConfig.KEY_APPCODE, TestConfig.VALUE_APPCODE);
          request = request.withJsonBody(node, getMethod());
          result = routeAndCall(request);
          //it should be fail
          assertRoute(result, "routeCreateUserCaseInsensitive", Status.BAD_REQUEST, sFakeUser2 + " already exists", true);
         
View Full Code Here

      {
        public void run()
        {

          FakeRequest request = new FakeRequest(PUT, "/admin/user/suspend/baasbox");
          request = request.withHeader(TestConfig.KEY_APPCODE, TestConfig.VALUE_APPCODE);
          request = request.withHeader(TestConfig.KEY_AUTH, TestConfig.encodeAuth(TestConfig.AUTH_ADMIN));
          Result result = route(request);
          assertRoute(result, "routeCreateUser_admin_suspend", Status.BAD_REQUEST, null, false)
         
          request = new FakeRequest(PUT, "/admin/user/suspend/internal_admin");
View Full Code Here

        public void run()
        {

          FakeRequest request = new FakeRequest(PUT, "/admin/user/suspend/baasbox");
          request = request.withHeader(TestConfig.KEY_APPCODE, TestConfig.VALUE_APPCODE);
          request = request.withHeader(TestConfig.KEY_AUTH, TestConfig.encodeAuth(TestConfig.AUTH_ADMIN));
          Result result = route(request);
          assertRoute(result, "routeCreateUser_admin_suspend", Status.BAD_REQUEST, null, false)
         
          request = new FakeRequest(PUT, "/admin/user/suspend/internal_admin");
          request = request.withHeader(TestConfig.KEY_APPCODE, TestConfig.VALUE_APPCODE);
View Full Code Here

          request = request.withHeader(TestConfig.KEY_AUTH, TestConfig.encodeAuth(TestConfig.AUTH_ADMIN));
          Result result = route(request);
          assertRoute(result, "routeCreateUser_admin_suspend", Status.BAD_REQUEST, null, false)
         
          request = new FakeRequest(PUT, "/admin/user/suspend/internal_admin");
          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.BAD_REQUEST, null, false)
        }
      }
View Full Code Here

          Result result = route(request);
          assertRoute(result, "routeCreateUser_admin_suspend", Status.BAD_REQUEST, null, false)
         
          request = new FakeRequest(PUT, "/admin/user/suspend/internal_admin");
          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.BAD_REQUEST, null, false)
        }
      }
    );
View Full Code Here

      {
        public void run()
        {

          FakeRequest request = new FakeRequest(PUT, "/admin/user/suspend/pippopluto");
          request = request.withHeader(TestConfig.KEY_APPCODE, TestConfig.VALUE_APPCODE);
          request = request.withHeader(TestConfig.KEY_AUTH, TestConfig.encodeAuth(TestConfig.AUTH_ADMIN));
          Result result = route(request);
          assertRoute(result, "routeCreateUser_admin_suspend", Status.BAD_REQUEST, null, false)

        }
View Full Code Here

        public void run()
        {

          FakeRequest request = new FakeRequest(PUT, "/admin/user/suspend/pippopluto");
          request = request.withHeader(TestConfig.KEY_APPCODE, TestConfig.VALUE_APPCODE);
          request = request.withHeader(TestConfig.KEY_AUTH, TestConfig.encodeAuth(TestConfig.AUTH_ADMIN));
          Result result = route(request);
          assertRoute(result, "routeCreateUser_admin_suspend", Status.BAD_REQUEST, null, false)

        }
      }
View Full Code Here

          // Prepare test user
          JsonNode node = updatePayloadFieldValue("/adminUserCreatePayload.json", "username", sFakeUser);

          // Create user
          FakeRequest request = new FakeRequest(getMethod(), getRouteAddress());
          request = request.withHeader(TestConfig.KEY_APPCODE, TestConfig.VALUE_APPCODE);
          request = request.withJsonBody(node, getMethod());
          Result result = routeAndCall(request);
         
          assertRoute(result, "routeCreateUser_2", Status.CREATED, null, false);
          String body = play.test.Helpers.contentAsString(result);
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.