Examples of withJsonBody()


Examples of play.test.FakeRequest.withJsonBody()

            Logger.debug("Route: " + request);
            Logger.debug("Users: " + sFakeUser);
            request = request.withHeader(TestConfig.KEY_APPCODE, TestConfig.VALUE_APPCODE);
            request = request.withHeader(TestConfig.KEY_AUTH, sAuthEnc);
            request = request.withHeader(HTTP.CONTENT_TYPE, MediaType.APPLICATION_JSON);
            request = request.withJsonBody(getPayload("/pushPayloadTooManyProfiles.json"), play.test.Helpers.POST);
            result = routeAndCall(request);
            if (Logger.isDebugEnabled()) Logger.debug("sendPushWithTooManyProfiles request: " + request.getWrappedRequest().headers());
            if (Logger.isDebugEnabled()) Logger.debug("sendPushWithTooManyProfiles result: " + contentAsString(result));
            assertRoute(result, "error with send, too many profiles", Status.BAD_REQUEST, CustomHttpCode.PUSH_PROFILE_FORMAT_INVALID.getDescription(), true);
View Full Code Here

Examples of play.test.FakeRequest.withJsonBody()

    // Create user
    FakeRequest request = new FakeRequest(POST, "/user");
    request = request.withHeader(TestConfig.KEY_APPCODE, TestConfig.VALUE_APPCODE);
    request = request.withHeader(TestConfig.KEY_AUTH, TestConfig.AUTH_ADMIN_ENC);
    request = request.withJsonBody(node, POST);
    Result result = routeAndCall(request);
    assertRoute(result, "Create user.", Status.CREATED, null, false);
    return sFakeUser;
  }
 
View Full Code Here

Examples of play.test.FakeRequest.withJsonBody()

            // Profile not supported
            request = request.withHeader(TestConfig.KEY_APPCODE, TestConfig.VALUE_APPCODE);
            request = request.withHeader(TestConfig.KEY_AUTH, sAuthEnc);
            request = request.withHeader(HTTP.CONTENT_TYPE, MediaType.APPLICATION_JSON);
            request = request.withJsonBody(getPayload("/pushPayloadWithProfileNotSupported.json"), play.test.Helpers.POST);
            result = routeAndCall(request);
            if (Logger.isDebugEnabled()) Logger.debug("sendPushWithProfileNotSupported request: " + request.getWrappedRequest().headers());
            if (Logger.isDebugEnabled()) Logger.debug("sendPushWithProfileNotSupported result: " + contentAsString(result));
            assertRoute(result, "error with send, push profile not supported", Status.BAD_REQUEST, CustomHttpCode.PUSH_PROFILE_FORMAT_INVALID.getDescription(), true);
View Full Code Here

Examples of play.test.FakeRequest.withJsonBody()

            // Profile NOT Array of String
            request = request.withHeader(TestConfig.KEY_APPCODE, TestConfig.VALUE_APPCODE);
            request = request.withHeader(TestConfig.KEY_AUTH, sAuthEnc);
            request = request.withHeader(HTTP.CONTENT_TYPE, MediaType.APPLICATION_JSON);
            request = request.withJsonBody(getPayload("/pushPayloadWithProfileNotSupported.json"), play.test.Helpers.POST);
            result = routeAndCall(request);
            if (Logger.isDebugEnabled()) Logger.debug("sendPushWithProfileNotArrayString request: " + request.getWrappedRequest().headers());
            if (Logger.isDebugEnabled()) Logger.debug("sendPushWithProfileNotArrayString result: " + contentAsString(result));
            assertRoute(result, "error with send, push profile are not an Array of String", Status.BAD_REQUEST, CustomHttpCode.PUSH_PROFILE_FORMAT_INVALID.getDescription(), true);
View Full Code Here

Examples of play.test.FakeRequest.withJsonBody()

            //Push with key message different from String

            request = request.withHeader(TestConfig.KEY_APPCODE, TestConfig.VALUE_APPCODE);
            request = request.withHeader(TestConfig.KEY_AUTH, sAuthEnc);
            request = request.withHeader(HTTP.CONTENT_TYPE, MediaType.APPLICATION_JSON);
            request = request.withJsonBody(getPayload("/pushPayloadWithMessageDifferentFromString.json"), play.test.Helpers.POST);
            result = routeAndCall(request);
            if (Logger.isDebugEnabled()) Logger.debug("sendPushWithMessageDifferentFromString request: " + request.getWrappedRequest().headers());
            if (Logger.isDebugEnabled()) Logger.debug("sendPushWithMessageDifferentFromString result: " + contentAsString(result));
            assertRoute(result, "error with send, value message is not a String", Status.BAD_REQUEST, CustomHttpCode.PUSH_MESSAGE_INVALID.getDescription(), true);
View Full Code Here

Examples of play.test.FakeRequest.withJsonBody()

            // Value profiles different from array

            request = request.withHeader(TestConfig.KEY_APPCODE, TestConfig.VALUE_APPCODE);
            request = request.withHeader(TestConfig.KEY_AUTH, sAuthEnc);
            request = request.withHeader(HTTP.CONTENT_TYPE, MediaType.APPLICATION_JSON);
            request = request.withJsonBody(getPayload("/pushPayloadWithValueProfilesDifferentFromArray.json"), play.test.Helpers.POST);
            result = routeAndCall(request);
            if (Logger.isDebugEnabled()) Logger.debug("sendPushWithValueProfilesDifferentFromArray request: " + request.getWrappedRequest().headers());
            if (Logger.isDebugEnabled()) Logger.debug("sendPushWithValueProfilesDifferentFromArray result: " + contentAsString(result));
            assertRoute(result, "error with send, value profiles is not an array", Status.BAD_REQUEST, CustomHttpCode.PUSH_PROFILE_FORMAT_INVALID.getDescription(), true);
          }
View Full Code Here

Examples of play.test.FakeRequest.withJsonBody()

            // Users key empty
            request = new FakeRequest("POST", "/push/message");
            request = request.withHeader(TestConfig.KEY_APPCODE, TestConfig.VALUE_APPCODE);
            request = request.withHeader(TestConfig.KEY_AUTH, sAuthEnc);
            request = request.withHeader(HTTP.CONTENT_TYPE, MediaType.APPLICATION_JSON);
            request = request.withJsonBody(getPayload("/pushPayloadWithProfileSpecifiedWithoutUsers.json"), play.test.Helpers.POST);
            result = routeAndCall(request);
            if (Logger.isDebugEnabled()) Logger.debug("sendPushWithUsersValueEmpty request: " + request.getWrappedRequest().headers());
            if (Logger.isDebugEnabled()) Logger.debug("sendPushWithUsersValueEmpty result: " + contentAsString(result));
            assertRoute(result, "error with send, key users empty", Status.BAD_REQUEST, CustomHttpCode.PUSH_NOTFOUND_KEY_USERS.getDescription(), true);
View Full Code Here

Examples of play.test.FakeRequest.withJsonBody()

              JsonNode node = updatePayloadFieldValue("/socialSignup.json", "oauth_token", o_token);
 
              // 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, "testSocial - check user no rid", 200, "\"user\":{\"name\":", true);
             
              String body = play.test.Helpers.contentAsString(result);
              JsonNode jsonRes = Json.parse(body);
View Full Code Here

Examples of play.test.FakeRequest.withJsonBody()

              node = updatePayloadFieldValue("/adminUserCreatePayload.json", "username", sFakeUser);
 
              // Create user
              request = new FakeRequest("POST", "/user");
              request = request.withHeader(TestConfig.KEY_APPCODE, TestConfig.VALUE_APPCODE);
              request = request.withJsonBody(node, "POST");
              result = routeAndCall(request);
              assertRoute(result, "routeCreateUser check username", Status.CREATED, "name\":\""+sFakeUser+"\"", true);

              url="/users?fields=system%20as%20s&where=user.name%3D%22"+username+"%22";
              Logger.debug("URL to check signupdate in system: " + url);
View Full Code Here

Examples of play.test.FakeRequest.withJsonBody()

            //the social user logins again using the same social token and .... it has to be the same user
            //this test tests the login using social network
              node = updatePayloadFieldValue("/socialSignup.json", "oauth_token", o_token);
              request = new FakeRequest(getMethod(), getRouteAddress());
              request = request.withHeader(TestConfig.KEY_APPCODE, TestConfig.VALUE_APPCODE);
              request = request.withJsonBody(node, getMethod());
              result = routeAndCall(request);           
              assertRoute(result, "testSocial - check user no rid", 200, "\"user\":{\"name\":", true);
             
              body = play.test.Helpers.contentAsString(result);
              JsonNode jsonResCheck = Json.parse(body);
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.