Package play.test

Examples of play.test.FakeRequest.withHeader()


         
          //Admin creates a collection         
          String sFakeCollection = new AdminCollectionFunctionalTest().routeCreateCollection();   
          //Anonymous user looking for its documents
          request = new FakeRequest(GET, getRouteAddress(sFakeCollection));
          request = request.withHeader(TestConfig.KEY_APPCODE, TestConfig.VALUE_APPCODE);
          request = request.withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_FORM_URLENCODED);
          result = routeAndCall(request);
          assertRoute(result, "testAccessDocumentsWithoutAuth.get_all", Status.OK, "\"result\":\"ok\",\"data\":[]", true);
         
          //Admin creates a document
View Full Code Here


          //Admin creates a collection         
          String sFakeCollection = new AdminCollectionFunctionalTest().routeCreateCollection();   
          //Anonymous user looking for its documents
          request = new FakeRequest(GET, getRouteAddress(sFakeCollection));
          request = request.withHeader(TestConfig.KEY_APPCODE, TestConfig.VALUE_APPCODE);
          request = request.withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_FORM_URLENCODED);
          result = routeAndCall(request);
          assertRoute(result, "testAccessDocumentsWithoutAuth.get_all", Status.OK, "\"result\":\"ok\",\"data\":[]", true);
         
          //Admin creates a document
           result = routeCreateDocument(getRouteAddress(sFakeCollection));
View Full Code Here

          assertRoute(result, "testAccessDocumentsWithoutAuth,create", Status.OK, null, true);
          String sUUID = getUuid();
         
          //Anonymous user looking for it and grab jus an error 404
          request = new FakeRequest(GET, getRouteAddress(sFakeCollection) + "/" + sUUID);
          request = request.withHeader(TestConfig.KEY_APPCODE, TestConfig.VALUE_APPCODE);
          request = request.withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_FORM_URLENCODED);
          result = routeAndCall(request);
          assertRoute(result, "testAccessDocumentsWithoutAuth.not_exists", Status.NOT_FOUND, null, false);
         
          //Admin changes the grant to the document
View Full Code Here

          String sUUID = getUuid();
         
          //Anonymous user looking for it and grab jus an error 404
          request = new FakeRequest(GET, getRouteAddress(sFakeCollection) + "/" + sUUID);
          request = request.withHeader(TestConfig.KEY_APPCODE, TestConfig.VALUE_APPCODE);
          request = request.withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_FORM_URLENCODED);
          result = routeAndCall(request);
          assertRoute(result, "testAccessDocumentsWithoutAuth.not_exists", Status.NOT_FOUND, null, false);
         
          //Admin changes the grant to the document
         
View Full Code Here

          assertRoute(result, "testAccessDocumentsWithoutAuth.not_exists", Status.NOT_FOUND, null, false);
         
          //Admin changes the grant to the document
         
          request = new FakeRequest(PUT, getRouteAddress(sFakeCollection) + "/" + sUUID + "/read/role/anonymous");
          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 = routeAndCall(request);
          assertRoute(result, "testAccessDocumentsWithoutAuth.grant", Status.OK, null, false);
         
View Full Code Here

         
          //Admin changes the grant to the document
         
          request = new FakeRequest(PUT, getRouteAddress(sFakeCollection) + "/" + sUUID + "/read/role/anonymous");
          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 = routeAndCall(request);
          assertRoute(result, "testAccessDocumentsWithoutAuth.grant", Status.OK, null, false);
         
          //Anonymous user looking for it and obtains it
View Full Code Here

          //Admin changes the grant to the document
         
          request = new FakeRequest(PUT, getRouteAddress(sFakeCollection) + "/" + sUUID + "/read/role/anonymous");
          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 = routeAndCall(request);
          assertRoute(result, "testAccessDocumentsWithoutAuth.grant", Status.OK, null, false);
         
          //Anonymous user looking for it and obtains it
          request = new FakeRequest(GET, getRouteAddress(sFakeCollection) + "/" + sUUID);
View Full Code Here

          result = routeAndCall(request);
          assertRoute(result, "testAccessDocumentsWithoutAuth.grant", Status.OK, null, false);
         
          //Anonymous user looking for it and obtains it
          request = new FakeRequest(GET, getRouteAddress(sFakeCollection) + "/" + sUUID);
          request = request.withHeader(TestConfig.KEY_APPCODE, TestConfig.VALUE_APPCODE);
          request = request.withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_FORM_URLENCODED);
          result = routeAndCall(request);
          assertRoute(result, "testAccessDocumentsWithoutAuth.get_after_grant", Status.OK, null, false)
         
          //Anonymous user looking for the collection and obtain a list with one record
View Full Code Here

          assertRoute(result, "testAccessDocumentsWithoutAuth.grant", Status.OK, null, false);
         
          //Anonymous user looking for it and obtains it
          request = new FakeRequest(GET, getRouteAddress(sFakeCollection) + "/" + sUUID);
          request = request.withHeader(TestConfig.KEY_APPCODE, TestConfig.VALUE_APPCODE);
          request = request.withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_FORM_URLENCODED);
          result = routeAndCall(request);
          assertRoute(result, "testAccessDocumentsWithoutAuth.get_after_grant", Status.OK, null, false)
         
          //Anonymous user looking for the collection and obtain a list with one record
          request = new FakeRequest(GET, getRouteAddress(sFakeCollection));
View Full Code Here

          result = routeAndCall(request);
          assertRoute(result, "testAccessDocumentsWithoutAuth.get_after_grant", Status.OK, null, false)
         
          //Anonymous user looking for the collection and obtain a list with one record
          request = new FakeRequest(GET, getRouteAddress(sFakeCollection));
          request = request.withHeader(TestConfig.KEY_APPCODE, TestConfig.VALUE_APPCODE);
          request = request.withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_FORM_URLENCODED);
          result = routeAndCall(request);
          assertRoute(result, "testAccessDocumentsWithoutAuth.get_all", Status.OK, "\"result\":\"ok\",\"data\":[{\"", true);

          //since the resource is now available to anonymous users, it should be visible to registered users too issue #195
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.