Package fitnesse.http

Examples of fitnesse.http.SimpleResponse


  public void testResponseWhenNonexistentPageRequestsed() throws Exception {
    request.setResource("NonExistentPage");
    request.addInput("nonExistent", true);

    FitNesseContext context = FitNesseUtil.makeTestContext(root);
    SimpleResponse response = (SimpleResponse) responder.makeResponse(context, request);
    assertEquals(200, response.getStatus());

    String body = response.getContent();
    assertSubString("<html>", body);
    assertSubString("<form", body);
    assertSubString("method=\"post\"", body);
    assertSubString(NewPageResponder.DEFAULT_PAGE_CONTENT, body);
    assertSubString("name=\"responder\"", body);
View Full Code Here


    request.setResource("ChildPage");
    request.addInput("redirectToReferer", true);
    request.addInput("redirectAction", "boom");
    request.addHeader("Referer", "http://fitnesse.org:8080/SomePage");

    SimpleResponse response = (SimpleResponse) responder.makeResponse(FitNesseUtil.makeTestContext(root), request);
    assertEquals(200, response.getStatus());

    String body = response.getContent();
    assertSubString("name=\"redirect\" value=\"http://fitnesse.org:8080/SomePage?boom\"", body);
  }
View Full Code Here

   
    WikiPageUtil.addPage(root, PathParser.parse("TemplateLibrary.TemplateOne"), "template 1");
    WikiPageUtil.addPage(root, PathParser.parse("TemplateLibrary.TemplateTwo"), "template 2");
    WikiPageUtil.addPage(root, PathParser.parse("ChildPage"), "child content with <html>");

    SimpleResponse response = makeResponse();
    assertEquals(200, response.getStatus());

    String body = response.getContent();
    assertSubString("<html>", body);
    assertSubString("<form", body);
    assertSubString("method=\"post\"", body);
    assertSubString("child content with &lt;html&gt;", body);
    assertSubString("name=\"responder\"", body);
View Full Code Here

    assertSubString("textarea", body);
  }

  @Test
  public void testTemplateInserterScriptsExists() throws Exception {
    SimpleResponse response = (SimpleResponse) responder.makeResponse(FitNesseUtil.makeTestContext(root), request);
    String body = response.getContent();
    assertMatches("TemplateInserter.js", body);
  }
View Full Code Here

    assertMatches("TemplateInserter.js", body);
  }

  @Test
  public void testPasteFromExcelExists() throws Exception {
    SimpleResponse response = (SimpleResponse) responder.makeResponse(FitNesseUtil.makeTestContext(root), request);
    String body = response.getContent();
    assertMatches("SpreadsheetTranslator.js", body);
  }
View Full Code Here

    assertMatches("SpreadsheetTranslator.js", body);
  }

  @Test
  public void testFormatterScriptsExist() throws Exception {
    SimpleResponse response = (SimpleResponse) responder.makeResponse(FitNesseUtil.makeTestContext(root), request);
    String body = response.getContent();
    assertMatches("WikiFormatter.js", body);
  }
View Full Code Here

    path = PathParser.parse("TestPage.ChildPage");
  }

  @Test
  public void canGetRedirectResponse() throws Exception {
    final SimpleResponse response = (SimpleResponse) responder.makeResponse(context, request);
    final String body = response.getContent();
    assertEquals("", body);
    assertEquals(response.getStatus(), 303);
  }
View Full Code Here

  @Test
  public void noPageIsMadeIfPageAlreadyExists() throws Exception {
    WikiPageUtil.addPage(root, PathParser.parse("TestPage." + childName), "");

    SimpleResponse response = (SimpleResponse) responder.makeResponse(context, request);
    assertTrue(response.getStatus() == 409);
    assertSubString("Child page already exists", response.getContent());
  }
View Full Code Here

  }

  @Test
  public void givesAInvalidNameErrorForAInvalidName() throws Exception {
    request = makeInvalidRequest("");
    SimpleResponse response = (SimpleResponse) responder.makeResponse(context, request);
    assertEquals(400, response.getStatus());
    assertSubString("Invalid Child Name", response.getContent());

    request = makeInvalidRequest("hello goodbye");
    response = (SimpleResponse) responder.makeResponse(context, request);
    assertSubString("Invalid Child Name", response.getContent());

    request = makeInvalidRequest("1man+1mission");
    response = (SimpleResponse) responder.makeResponse(context, request);
    assertSubString("Invalid Child Name", response.getContent());

    request = makeInvalidRequest("PageOne.PageTwo");
    response = (SimpleResponse) responder.makeResponse(context, request);
    assertSubString("Invalid Child Name", response.getContent());
  }
View Full Code Here

  @Before
  public void setup() throws Exception {
    examiner = new ResponseExaminer();
    FitnesseFixtureContext.sender = new MockResponseSender();
    FitnesseFixtureContext.sender.send("&lt;hello".getBytes());
    FitnesseFixtureContext.response = new SimpleResponse();
    FitnesseFixtureContext.response.setStatus(42);
  }
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.