Package play.test

Examples of play.test.FakeRequest.withHeader()


                            public void run()       {
                                    try {
                                       String sFakeRole = getRouteAddress();
                                         FakeRequest requestCreation = new FakeRequest(POST, sFakeRole);
                                         requestCreation = requestCreation.withHeader(TestConfig.KEY_APPCODE, TestConfig.VALUE_APPCODE);
                                         requestCreation = requestCreation.withHeader(TestConfig.KEY_AUTH, TestConfig.AUTH_ADMIN_ENC);
                                         Result result = route(requestCreation);
                                         assertRoute(result, "testRoleCreate.create", Status.CREATED, null, true);
                                        
                                        //creates one user in this Role
                                        String sFakeCreateUser = getFakeUserCreationAddress();
View Full Code Here


                                         assertRoute(result, "testRoleCreate.create", Status.CREATED, null, true);
                                        
                                        //creates one user in this Role
                                        String sFakeCreateUser = getFakeUserCreationAddress();
                                        requestCreation = new FakeRequest(POST, sFakeCreateUser);
                                        requestCreation = requestCreation.withHeader(TestConfig.KEY_APPCODE, TestConfig.VALUE_APPCODE);
                                        requestCreation = requestCreation.withHeader(TestConfig.KEY_AUTH, TestConfig.AUTH_ADMIN_ENC);
                                        ObjectMapper mapper = new ObjectMapper();
                                        JsonNode actualObj = mapper.readTree("{\"username\":\""+userName+"\","
                                            + "\"password\":\"test\"," 
                                            + "\"role\":\""+ roleName +"\"}");
View Full Code Here

                                        
                                        //creates one user in this Role
                                        String sFakeCreateUser = getFakeUserCreationAddress();
                                        requestCreation = new FakeRequest(POST, sFakeCreateUser);
                                        requestCreation = requestCreation.withHeader(TestConfig.KEY_APPCODE, TestConfig.VALUE_APPCODE);
                                        requestCreation = requestCreation.withHeader(TestConfig.KEY_AUTH, TestConfig.AUTH_ADMIN_ENC);
                                        ObjectMapper mapper = new ObjectMapper();
                                        JsonNode actualObj = mapper.readTree("{\"username\":\""+userName+"\","
                                            + "\"password\":\"test\"," 
                                            + "\"role\":\""+ roleName +"\"}");
                                        requestCreation = requestCreation.withJsonBody(actualObj);
View Full Code Here

                                        ObjectMapper mapper = new ObjectMapper();
                                        JsonNode actualObj = mapper.readTree("{\"username\":\""+userName+"\","
                                            + "\"password\":\"test\"," 
                                            + "\"role\":\""+ roleName +"\"}");
                                        requestCreation = requestCreation.withJsonBody(actualObj);
                                        requestCreation = requestCreation.withHeader("Content-Type", "application/json");
                                        result = route(requestCreation);
                                        assertRoute(result, "testRoleCreate.createUser", Status.CREATED, null, true);
                                      

                                     //checks the user
View Full Code Here

                                      

                                     //checks the user
                                     String sFakeCheckUser = getFakeUserAddress();
                                    requestCreation = new FakeRequest(GET, sFakeCheckUser);
                                    requestCreation = requestCreation.withHeader(TestConfig.KEY_APPCODE, TestConfig.VALUE_APPCODE);
                                    requestCreation = requestCreation.withHeader(TestConfig.KEY_AUTH, TestConfig.AUTH_ADMIN_ENC);
                                    result = route(requestCreation);
                                    assertRoute(result, "testRoleCreate.checkUser", Status.OK, "\"name\":\""+roleName+"\"", true);
                                       
                                                                          
View Full Code Here

                                     //checks the user
                                     String sFakeCheckUser = getFakeUserAddress();
                                    requestCreation = new FakeRequest(GET, sFakeCheckUser);
                                    requestCreation = requestCreation.withHeader(TestConfig.KEY_APPCODE, TestConfig.VALUE_APPCODE);
                                    requestCreation = requestCreation.withHeader(TestConfig.KEY_AUTH, TestConfig.AUTH_ADMIN_ENC);
                                    result = route(requestCreation);
                                    assertRoute(result, "testRoleCreate.checkUser", Status.OK, "\"name\":\""+roleName+"\"", true);
                                       
                                                                          
                                    //drops the role
View Full Code Here

                                    assertRoute(result, "testRoleCreate.checkUser", Status.OK, "\"name\":\""+roleName+"\"", true);
                                       
                                                                          
                                    //drops the role
                                    requestCreation = new FakeRequest(DELETE, sFakeRole);
                                    requestCreation = requestCreation.withHeader(TestConfig.KEY_APPCODE, TestConfig.VALUE_APPCODE);
                                    requestCreation = requestCreation.withHeader(TestConfig.KEY_AUTH, TestConfig.AUTH_ADMIN_ENC);
                                    result = route(requestCreation);
                                    assertRoute(result, "testRoleCreate.drop", Status.OK, null, false);
                                   
                                    //checks that the role does not exist
View Full Code Here

                                       
                                                                          
                                    //drops the role
                                    requestCreation = new FakeRequest(DELETE, sFakeRole);
                                    requestCreation = requestCreation.withHeader(TestConfig.KEY_APPCODE, TestConfig.VALUE_APPCODE);
                                    requestCreation = requestCreation.withHeader(TestConfig.KEY_AUTH, TestConfig.AUTH_ADMIN_ENC);
                                    result = route(requestCreation);
                                    assertRoute(result, "testRoleCreate.drop", Status.OK, null, false);
                                   
                                    //checks that the role does not exist
                                    requestCreation = new FakeRequest(GET, sFakeRole);
View Full Code Here

                                    result = route(requestCreation);
                                    assertRoute(result, "testRoleCreate.drop", Status.OK, null, false);
                                   
                                    //checks that the role does not exist
                                    requestCreation = new FakeRequest(GET, sFakeRole);
                                    requestCreation = requestCreation.withHeader(TestConfig.KEY_APPCODE, TestConfig.VALUE_APPCODE);
                                    requestCreation = requestCreation.withHeader(TestConfig.KEY_AUTH, TestConfig.AUTH_ADMIN_ENC);
                                    result = route(requestCreation);
                                    assertRoute(result, "testRoleCreate.role_not_found", Status.NOT_FOUND, null, false);
                                        
                                    //checks that the fake user belongs to the registered role
View Full Code Here

                                    assertRoute(result, "testRoleCreate.drop", Status.OK, null, false);
                                   
                                    //checks that the role does not exist
                                    requestCreation = new FakeRequest(GET, sFakeRole);
                                    requestCreation = requestCreation.withHeader(TestConfig.KEY_APPCODE, TestConfig.VALUE_APPCODE);
                                    requestCreation = requestCreation.withHeader(TestConfig.KEY_AUTH, TestConfig.AUTH_ADMIN_ENC);
                                    result = route(requestCreation);
                                    assertRoute(result, "testRoleCreate.role_not_found", Status.NOT_FOUND, null, false);
                                        
                                    //checks that the fake user belongs to the registered role
                                     sFakeCheckUser = getFakeUserAddress();
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.