Package fitnesse.http

Examples of fitnesse.http.SimpleResponse


  public void canNotRenameToFileOutsideFilesSection() throws Exception {
    RenameFileResponder responder = new RenameFileResponder();
    request.addInput("filename", "oldname");
    request.addInput("newName", "../../newname");
    request.setResource("files/");
    SimpleResponse response = (SimpleResponse) responder.makeResponse(context, request);
    assertTrue(response.getContent(), response.getContent().contains("Invalid path: ../../newname"));
  }
View Full Code Here


  public void canNotRenameFilesOutsideFilesSection() throws Exception {
    RenameFileResponder responder = new RenameFileResponder();
    request.addInput("filename", "../../oldname");
    request.addInput("newName", "newname");
    request.setResource("files/");
    SimpleResponse response = (SimpleResponse) responder.makeResponse(context, request);
    assertTrue(response.getContent(), response.getContent().contains("Invalid path: ../../oldname"));
  }
View Full Code Here

  private void getContentForSimpleRename() throws Exception {
    request.setResource("files");
    request.addInput("filename", "MyFile.txt");
    Responder responder = new RenameFileConfirmationResponder();
    SimpleResponse response = (SimpleResponse) responder.makeResponse(context, request);
    content = response.getContent();
  }
View Full Code Here

  }

  @Test
  public void testFitnesseLook() throws Exception {
    Responder responder = new RenameFileConfirmationResponder();
    SimpleResponse response = (SimpleResponse) responder.makeResponse(context, request);
    String content = response.getContent();
    assertSubString("<link rel=\"stylesheet\" type=\"text/css\" href=\"/files/fitnesse/css/fitnesse_wiki.css\"", content);
  }
View Full Code Here

  public void canNotCreateDirectoryOutsideFilesSection() throws Exception {
    CreateDirectoryResponder responder = new CreateDirectoryResponder();
    MockRequest request = new MockRequest();
    request.addInput("dirname", "../../dir");
    request.setResource("files/");
    SimpleResponse response = (SimpleResponse) responder.makeResponse(context, request);
    assertTrue(response.getContent(), response.getContent().contains("Invalid path: dir"));
  }
View Full Code Here

  public void canNotCreateDirectoryOutsideFilesSectionWithInvalidResource() throws Exception {
    CreateDirectoryResponder responder = new CreateDirectoryResponder();
    MockRequest request = new MockRequest();
    request.addInput("dirname", "dir");
    request.setResource("files/../../");
    SimpleResponse response = (SimpleResponse) responder.makeResponse(context, request);
    assertTrue(response.getContent(), response.getContent().contains("Invalid path: dir"));
  }
View Full Code Here

  @Override
  public Response makeResponse(FitNesseContext context, Request request) throws Exception {
    this.context = context;
    loadPage(request.getResource(), context);

    SimpleResponse response = new SimpleResponse();
    HtmlPage html = context.pageFactory.newPage();
    html.setMainTemplate("render.vm");
    html.put("content", new SlimRenderer());
    response.setContent(html.html());
    return response;
  }
View Full Code Here

  @Test
  public void canNotUploadFileOutsideFilesSectionWithInvalidResource() throws Exception {
    UploadResponder responder = new UploadResponder();
    request.addInput("file", new UploadedFile("name", "text/plain", new File("file")));
    request.setResource("files/../../");
    SimpleResponse response = (SimpleResponse) responder.makeResponse(context, request);
    assertTrue(response.getContent(), response.getContent().contains("Invalid path: name"));
  }
View Full Code Here

  }

  @Test
  public void testResponse() throws Exception {
    Responder responder = new DisabledResponder();
    SimpleResponse response = (SimpleResponse) responder.makeResponse(context, new MockRequest());

    assertEquals(200, response.getStatus());

    String body = response.getContent();

    assertHasRegexp("<html>", body);
    assertHasRegexp("<body", body);
    assertHasRegexp("that this action should be disabled.", body);
  }
View Full Code Here

  @Test
  public void shouldDeleteHistoryFromRequestAndRedirect() throws Exception {
    StubbedPurgeHistoryResponder responder = new StubbedPurgeHistoryResponder();
    request.addInput("days", "30");
    SimpleResponse response = (SimpleResponse) responder.makeResponse(context, request);
    assertEquals(30, responder.daysDeleted);
    assertEquals(303, response.getStatus());
    assertEquals("?testHistory", response.getHeader("Location"));
  }
View Full Code Here

TOP

Related Classes of fitnesse.http.SimpleResponse

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.