Package play.test

Examples of play.test.FakeRequest.withHeader()


                                        
                                                                            
                                    //checks the role
                                         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.check_with_new_desc", Status.OK, "\"description\":\"this is new test\"", true);
                                      

                                    //
View Full Code Here


                                      

                                    //
                                    //finally... drop it, again
                                    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_final", Status.OK, null, false);
                                    
                                   
View Full Code Here

                                    //
                                    //finally... drop it, again
                                    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_final", Status.OK, null, false);
                                    
                                   
                                    }catch (Exception e) {
View Full Code Here

          FakeRequest request = new FakeRequest(getMethod(), getRouteAddress());
          Result result = routeAndCall(request);
          assertRoute(result, "No AppCode No Authorization", BAD_REQUEST, TestConfig.MSG_NO_APP_CODE_NO_AUTH, true);
 
          // No Authorization
          request = request.withHeader(TestConfig.KEY_APPCODE, TestConfig.VALUE_APPCODE);
          result = routeAndCall(request);
          assertRoute(result, "No Authorization", UNAUTHORIZED, null, false);
         
          // Invalid AppCode
          request = request.withHeader(TestConfig.KEY_APPCODE, "12345890");
View Full Code Here

          request = request.withHeader(TestConfig.KEY_APPCODE, TestConfig.VALUE_APPCODE);
          result = routeAndCall(request);
          assertRoute(result, "No Authorization", UNAUTHORIZED, null, false);
         
          // Invalid AppCode
          request = request.withHeader(TestConfig.KEY_APPCODE, "12345890");
          request = request.withHeader(TestConfig.KEY_AUTH, TestConfig.AUTH_ADMIN_ENC);
          result = routeAndCall(request);
          assertRoute(result, "Invalid AppCode", UNAUTHORIZED, TestConfig.MSG_INVALID_APP_CODE, true);
 
          // Invalid Authorization
View Full Code Here

          result = routeAndCall(request);
          assertRoute(result, "No Authorization", UNAUTHORIZED, null, false);
         
          // Invalid AppCode
          request = request.withHeader(TestConfig.KEY_APPCODE, "12345890");
          request = request.withHeader(TestConfig.KEY_AUTH, TestConfig.AUTH_ADMIN_ENC);
          result = routeAndCall(request);
          assertRoute(result, "Invalid AppCode", UNAUTHORIZED, TestConfig.MSG_INVALID_APP_CODE, true);
 
          // Invalid Authorization
          request = request.withHeader(TestConfig.KEY_APPCODE, TestConfig.VALUE_APPCODE);
View Full Code Here

          request = request.withHeader(TestConfig.KEY_AUTH, TestConfig.AUTH_ADMIN_ENC);
          result = routeAndCall(request);
          assertRoute(result, "Invalid AppCode", UNAUTHORIZED, TestConfig.MSG_INVALID_APP_CODE, true);
 
          // Invalid Authorization
          request = request.withHeader(TestConfig.KEY_APPCODE, TestConfig.VALUE_APPCODE);
          request = request.withHeader(TestConfig.KEY_AUTH, "Basic dXNlcjE6cGFzc3c=");
          result = routeAndCall(request);
          assertRoute(result, "Invalid Authorization", UNAUTHORIZED, null, false);
         
          // No AppCode
View Full Code Here

          result = routeAndCall(request);
          assertRoute(result, "Invalid AppCode", UNAUTHORIZED, TestConfig.MSG_INVALID_APP_CODE, true);
 
          // Invalid Authorization
          request = request.withHeader(TestConfig.KEY_APPCODE, TestConfig.VALUE_APPCODE);
          request = request.withHeader(TestConfig.KEY_AUTH, "Basic dXNlcjE6cGFzc3c=");
          result = routeAndCall(request);
          assertRoute(result, "Invalid Authorization", UNAUTHORIZED, null, false);
         
          // No AppCode
          request = new FakeRequest(getMethod(), getRouteAddress());
View Full Code Here

          result = routeAndCall(request);
          assertRoute(result, "Invalid Authorization", UNAUTHORIZED, null, false);
         
          // No AppCode
          request = new FakeRequest(getMethod(), getRouteAddress());
          request = request.withHeader(TestConfig.KEY_AUTH, TestConfig.AUTH_ADMIN_ENC);
          result = routeAndCall(request);
          assertRoute(result, "No AppCode", BAD_REQUEST, TestConfig.MSG_NO_APP_CODE, true);
        }
      }
    );   
View Full Code Here

        {
          String sFakeCollection = new AdminCollectionFunctionalTest().routeCreateCollection();
       
          // Test list documents in empty collection
          FakeRequest request = new FakeRequest(getMethod(), getRouteAddress(sFakeCollection));
          request = request.withHeader(TestConfig.KEY_APPCODE, TestConfig.VALUE_APPCODE);
          request = request.withHeader(TestConfig.KEY_AUTH, TestConfig.AUTH_ADMIN_ENC);
          request = request.withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_FORM_URLENCODED);
          Result result = routeAndCall(request);
          assertRoute(result, "testRouteListDocuments empty collection", 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.