Package fitnesse.http

Examples of fitnesse.http.Response


  @Test
  public void shouldNotDealWithDirectoryOutsideFilesFolder() throws Exception {
    request.setResource("/files/../../");
    Responder responder = FileResponder.makeResponder(request, context.getRootPagePath());
    Response response = responder.makeResponse(context, request);
    assertTrue(responder instanceof ErrorResponder);
    assertEquals(400, response.getStatus());
  }
View Full Code Here


  @Test
  public void shouldNotDealWithEscapedDirectoryOutsideFilesFolder() throws Exception {
    request.setResource("/files/..%2f/");
    Responder responder = FileResponder.makeResponder(request, context.getRootPagePath());
    Response response = responder.makeResponse(context, request);
    assertTrue(responder instanceof ErrorResponder);
    assertEquals(400, response.getStatus());
  }
View Full Code Here

  @Test
  public void canAddFiltersForAResponder() throws Exception {
    Responder responder = factory.makeResponder(request);
    expectedFilterResponse = new SimpleResponse();
    Response response = responder.makeResponse(context, request);

    assertSame(expectedFilterResponse, response);
  }
View Full Code Here

  @Test
  public void shouldCallResponderIfFilterReturnsNull() throws Exception {
    Responder responder = factory.makeResponder(request);
    expectedResponderResponse = new SimpleResponse();
    Response response = responder.makeResponse(context, request);

    assertSame(expectedResponderResponse, response);
  }
View Full Code Here

  @Test
  public void shouldExecuteMultipleFilters() throws Exception {
    factory.addFilter("mock", new AnotherMockFilter());
    Responder responder = factory.makeResponder(request);
    expectedAnotherFilterResponse = new SimpleResponse();
    Response response = responder.makeResponse(context, request);

    assertSame(expectedAnotherFilterResponse, response);
  }
View Full Code Here

  }

  private String getResultsUsing(String content) throws Exception {
    WikiPageUtil.addPage(root, PathParser.parse("SimplePage"), content);
    request.setResource("SimplePage");
    Response response = responder.makeResponse(context, request);
    MockResponseSender sender = new MockResponseSender();
    sender.doSending(response);
    String result = sender.sentData();
    return result;
  }
View Full Code Here

    assertSubString("Stopped 1 test", response);
  }


  private String runResponder(StopTestResponder responder) throws Exception {
    Response response = responder.makeResponse(context, request);
    MockResponseSender sender = new MockResponseSender();
    sender.doSending(response);
    String results = sender.sentData();
    return results;
  }
View Full Code Here

    FitNesseUtil.stopFitnesse();
  }

  @Test
  public void testRedirect() throws Exception {
    Response response = getResponse();

    assertEquals(303, response.getStatus());
    assertEquals("/PageTwo", response.getHeader("Location"));
  }
View Full Code Here

  private String doRunAndGetErrorLog(String content) throws Exception {
    WikiPage testPage = WikiPageUtil.addPage(root, PathParser.parse("TestPage"), content);
    request.setResource(testPage.getName());

    Response response = responder.makeResponse(context, request);
    MockResponseSender sender = new MockResponseSender();
    sender.doSending(response);
    String results = sender.sentData();

    assertHasRegexp("ErrorLog", results);
View Full Code Here

  @Test
  public void testHasExitValueHeader() throws Exception {
    WikiPage testPage = WikiPageUtil.addPage(root, PathParser.parse("TestPage"), classpathWidgets() + passFixtureTable());
    request.setResource(testPage.getName());

    Response response = responder.makeResponse(context, request);
    MockResponseSender sender = new MockResponseSender();
    sender.doSending(response);
    String results = sender.sentData();

    assertSubString("Exit-Code: 0", results);
View Full Code Here

TOP

Related Classes of fitnesse.http.Response

Copyright © 2018 www.massapicom. 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.