Package play.test

Examples of play.test.FakeRequest.withHeader()


          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


          //since the resource is now available to anonymous users, it should be visible to registered users too issue #195
         
          String fakeUsername=createNewUser("registeredUser");
          request = new FakeRequest(GET, getRouteAddress(sFakeCollection) + "/" + sUUID);
          request = request.withHeader(TestConfig.KEY_APPCODE, TestConfig.VALUE_APPCODE);
          request = request.withHeader(TestConfig.KEY_AUTH, TestConfig.encodeAuth(fakeUsername+":passw1"));
          result = routeAndCall(request);
          assertRoute(result, "testAccessDocumentsFromRegisteredUser", Status.OK, "\"result\":\"ok\",\"data\":{\"", true);
         
          //Admin revokes  the grant to the document
View Full Code Here

          //since the resource is now available to anonymous users, it should be visible to registered users too issue #195
         
          String fakeUsername=createNewUser("registeredUser");
          request = new FakeRequest(GET, getRouteAddress(sFakeCollection) + "/" + sUUID);
          request = request.withHeader(TestConfig.KEY_APPCODE, TestConfig.VALUE_APPCODE);
          request = request.withHeader(TestConfig.KEY_AUTH, TestConfig.encodeAuth(fakeUsername+":passw1"));
          result = routeAndCall(request);
          assertRoute(result, "testAccessDocumentsFromRegisteredUser", Status.OK, "\"result\":\"ok\",\"data\":{\"", true);
         
          //Admin revokes  the grant to the document
          request = new FakeRequest(DELETE, getRouteAddress(sFakeCollection) + "/" + sUUID + "/read/role/anonymous");
View Full Code Here

          result = routeAndCall(request);
          assertRoute(result, "testAccessDocumentsFromRegisteredUser", Status.OK, "\"result\":\"ok\",\"data\":{\"", true);
         
          //Admin revokes  the grant to the document
          request = new FakeRequest(DELETE, 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.revoke", Status.OK, null, false);
         
View Full Code Here

          assertRoute(result, "testAccessDocumentsFromRegisteredUser", Status.OK, "\"result\":\"ok\",\"data\":{\"", true);
         
          //Admin revokes  the grant to the document
          request = new FakeRequest(DELETE, 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.revoke", Status.OK, null, false);
         
          //Anonymous user looking for it and obtains nothing
View Full Code Here

         
          //Admin revokes  the grant to the document
          request = new FakeRequest(DELETE, 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.revoke", Status.OK, null, false);
         
          //Anonymous user looking for it and obtains nothing
          request = new FakeRequest(GET, getRouteAddress(sFakeCollection) + "/" + sUUID);
View Full Code Here

          result = routeAndCall(request);
          assertRoute(result, "testAccessDocumentsWithoutAuth.revoke", Status.OK, null, false);
         
          //Anonymous user looking for it and obtains nothing
          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_found_2", Status.NOT_FOUND, null, false)
         
        }
View Full Code Here

          assertRoute(result, "testAccessDocumentsWithoutAuth.revoke", Status.OK, null, false);
         
          //Anonymous user looking for it and obtains nothing
          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_found_2", Status.NOT_FOUND, null, false)
         
        }
      }
View Full Code Here

  {
    Result result = null;
    try
    {
      FakeRequest request = new FakeRequest(DELETE, getRouteAddress(sCollectionName) + "/" + URLEncoder.encode(sRid, "ISO-8859-1"));
      request = request.withHeader(TestConfig.KEY_APPCODE, TestConfig.VALUE_APPCODE);
      request = request.withHeader(TestConfig.KEY_AUTH, TestConfig.AUTH_ADMIN_ENC);
      result = routeAndCall(request);
    }
    catch (Exception ex)
    {
View Full Code Here

    Result result = null;
    try
    {
      FakeRequest request = new FakeRequest(DELETE, getRouteAddress(sCollectionName) + "/" + URLEncoder.encode(sRid, "ISO-8859-1"));
      request = request.withHeader(TestConfig.KEY_APPCODE, TestConfig.VALUE_APPCODE);
      request = request.withHeader(TestConfig.KEY_AUTH, TestConfig.AUTH_ADMIN_ENC);
      result = routeAndCall(request);
    }
    catch (Exception ex)
    {
      Assert.fail("Unexcpeted exception. " + ex.getMessage());
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.