Package fitnesse.http

Examples of fitnesse.http.SimpleResponse


  public void testMakeReponder() throws Exception {
    MockRequest request = new MockRequest();
    request.setResource("PageOne");

    Responder responder = new VersionSelectionResponder();
    SimpleResponse response = (SimpleResponse) responder.makeResponse(FitNesseUtil.makeTestContext(root), request);

    String content = response.getContent();
    assertSubString("<a", content);
    assertSubString("?responder=viewVersion", content);
    assertNotSubString("$version", content);
    assertSubString("<h5> Page One tags</h5>", content);
  }
View Full Code Here


  @Test
  public void testResponse() throws Exception {
    request.setResource("root");

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

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

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

    request.setResource("ChildPage");

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

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

  @Test
  public void shouldSetPageTemplateIfProvidedAsArgument() {
    WikiPageUtil.addPage(root, PathParser.parse("FancyTemplate"), "template page");
    request.setResource("");
    request.addInput(NewPageResponder.PAGE_TEMPLATE, ".FancyTemplate");
    SimpleResponse response = (SimpleResponse) responder.makeResponse(FitNesseUtil.makeTestContext(root),
            request);
    assertEquals(200, response.getStatus());

    String body = response.getContent();
    assertSubString("<form", body);
    assertSubString("name=\"" + NewPageResponder.PAGE_TEMPLATE + "\"", body);
    assertSubString("value=\".FancyTemplate\"", body);
  }
View Full Code Here

  }

  @Test
  public void testHtml() throws Exception {
    Responder responder = new MergeResponder(request);
    SimpleResponse response = (SimpleResponse) responder.makeResponse(FitNesseUtil.makeTestContext(source), new MockRequest());
    assertHasRegexp("name=\\\"" + EditResponder.CONTENT_INPUT_NAME + "\\\"", response.getContent());
    assertHasRegexp("this is SimplePage", response.getContent());
    assertHasRegexp("name=\\\"oldContent\\\"", response.getContent());
    assertHasRegexp("some new content", response.getContent());
  }
View Full Code Here

  public void testAttributeValues() throws Exception {
    request.addInput("Edit", "On");
    request.addInput("PageType", "Test");
    request.addInput("Search", "On");
    Responder responder = new MergeResponder(request);
    SimpleResponse response = (SimpleResponse) responder.makeResponse(FitNesseUtil.makeTestContext(source), new MockRequest());

    assertHasRegexp("type=\"hidden\"", response.getContent());
    assertHasRegexp("name=\"Edit\"", response.getContent());
    assertHasRegexp("name=\"PageType\" value=\"Test\" checked", response.getContent());
    assertHasRegexp("name=\"Search\"", response.getContent());
  }
View Full Code Here

  @Before
  public void setUp() throws Exception {
    WikiPage root = InMemoryPage.makeRoot("RooT");
    FitNesseContext context = FitNesseUtil.makeTestContext(root);
    SearchFormResponder responder = new SearchFormResponder();
    SimpleResponse response = (SimpleResponse) responder.makeResponse(context, new MockRequest());
    content = response.getContent();
  }
View Full Code Here

    MockRequest request = new MockRequest();
    request.setResource("PageOne");

    Responder responder = new PropertiesResponder();
    SimpleResponse response = (SimpleResponse) responder.makeResponse(context, request);
    assertEquals("max-age=0", response.getHeader("Cache-Control"));

    String content = response.getContent();
    assertSubString("PageOne", content);
    assertDoesntHaveRegexp("textarea name=\"extensionXml\"", content);
    assertHasRegexp("<input.*value=\"Save Properties\".*>", content);

    assertHasRegexp("<input.*value=\"saveProperties\"", content);
View Full Code Here

    MockRequest request = new MockRequest();
    request.setResource("PageOne");
    request.addInput("format", "json");

    Responder responder = new PropertiesResponder();
    SimpleResponse response = (SimpleResponse) responder.makeResponse(context, request);
    assertEquals("text/json", response.getContentType());
    String jsonText = response.getContent();
    JSONObject jsonObject = new JSONObject(jsonText);
    assertTrue(jsonObject.getBoolean("Test"));
    assertTrue(jsonObject.getBoolean("Search"));
    assertTrue(jsonObject.getBoolean("Edit"));
    assertTrue(jsonObject.getBoolean("Properties"));
View Full Code Here

    MockRequest request = new MockRequest();
    request.setResource("PageOne");
    request.addInput("format", "json");

    Responder responder = new PropertiesResponder();
    SimpleResponse response = (SimpleResponse) responder.makeResponse(context, request);
    assertEquals("text/json", response.getContentType());
    String jsonText = response.getContent();
    JSONObject jsonObject = new JSONObject(jsonText);

    assertEquals("help text", jsonObject.getString("Help"));
    JSONArray suites = jsonObject.getJSONArray("Suites");
    assertEquals("foo", suites.getString(0));
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.