Package fitnesse.http

Examples of fitnesse.http.SimpleResponse


    request.setResource(simplePageName);
    request.addInput(EditResponder.CONTENT_INPUT_NAME, "some new content");
    request.addInput(EditResponder.TIME_STAMP, "" + (SaveRecorder.timeStamp() - 10000));
    request.addInput(EditResponder.TICKET_ID, "" + SaveRecorder.newTicket());

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

    assertHasRegexp("Merge", response.getContent());
  }
View Full Code Here


    responder = new RefactorPageResponder();
  }

  @Test
  public void testHtml() throws Exception {
    SimpleResponse response = (SimpleResponse) responder.makeResponse(FitNesseUtil.makeTestContext(root), request);
    assertEquals(200, response.getStatus());

    String content = response.getContent();
    assertSubString("Replace", content);
    assertSubString("Delete Page", content);
    assertSubString("Rename Page", content);
    assertSubString("Move Page", content);
  }
View Full Code Here

    WikiPageUtil.addPage(level1, this.level2Path, "");
    MockRequest request = new MockRequest();
    request.setResource(this.qualifiedLevel2Name);
    request.addInput("deletePage", "");

    SimpleResponse response = (SimpleResponse) this.responder.makeResponse(FitNesseUtil.makeTestContext(this.root), request);
    String content = response.getContent();
    assertSubString("Are you sure you want to delete " + this.qualifiedLevel2Name, content);
  }
View Full Code Here

    assertTrue(this.root.getPageCrawler().pageExists(this.level1Path));
    MockRequest request = new MockRequest();
    request.setResource(this.level1Name);
    request.addInput("confirmed", "yes");

    SimpleResponse response = (SimpleResponse) this.responder.makeResponse(FitNesseUtil.makeTestContext(this.root), request);
    String page = response.getContent();
    assertNotSubString("Are you sure you want to delete", page);
    assertEquals(303, response.getStatus());
    assertEquals("/root", response.getHeader("Location"));
    assertFalse(this.root.getPageCrawler().pageExists(PathParser.parse(this.level1Name)));

    List<?> children = this.root.getChildren();
    assertEquals(0, children.size());
  }
View Full Code Here

  @Test
  public void testCantMoveToSelf() throws Exception {
    pageA.getData().setAttribute("someAttribute", "someValue");
    assertTrue(crawler.pageExists(PathParser.parse("PageOne.PageA")));
    SimpleResponse response = movePage("PageOne.PageA", "PageOne", true);
    assertSubString("Cannot move", response.getContent());
    assertTrue(crawler.pageExists(PathParser.parse("PageOne.PageA")));
  }
View Full Code Here

    WikiPageUtil.addPage(pageTwo, PathParser.parse("PageA"), "someContent");
    pageA.getData().setAttribute("someAttribute", "someValue");
    assertTrue(crawler.pageExists(PathParser.parse("PageTwo.PageA")));
    assertTrue(crawler.pageExists(PathParser.parse("PageOne.PageA")));

    SimpleResponse response = movePage("PageOne.PageA", "PageTwo", true);
    assertSubString("Cannot move", response.getContent());
    assertEquals("someContent", pageTwo.getChildPage("PageA").getData().getContent());
    assertEquals("content", pageA.getData().getContent());
    assertTrue(crawler.pageExists(PathParser.parse("PageTwo.PageA")));
    assertTrue(crawler.pageExists(PathParser.parse("PageOne.PageA")));
  }
View Full Code Here

    assertTrue(crawler.pageExists(destinationGrandChildPath));
  }

  @Test
  public void testCantMovePageBelowChild() throws Exception {
    SimpleResponse response = movePage("PageOne", "PageOne.PageA", true);
    assertSubString("Cannot move", response.getContent());
    assertTrue(crawler.pageExists(PathParser.parse("PageOne.PageA")));
  }
View Full Code Here

  }

  @Test
  public void testBadMoveLocationName() throws Exception {
    assertTrue(crawler.pageExists(PathParser.parse("PageOne.PageA")));
    SimpleResponse response = movePage("PageOne.PageA", "NoSuchPage", true);
    assertSubString("Cannot move", response.getContent());
    assertTrue(crawler.pageExists(PathParser.parse("PageOne.PageA")));
  }
View Full Code Here

  }

  @Test
  public void testMovePageIntoItselfIsNotAllowed() throws Exception {
    WikiPageUtil.addPage(root, PathParser.parse("TestPage"), "");
    SimpleResponse response = movePage("TestPage", "TestPage", true);

    assertFalse(crawler.pageExists(PathParser.parse("TestPage.TestPage")));
    assertEquals(400, response.getStatus());
    assertSubString("Cannot move", response.getContent());
  }
View Full Code Here

  public void canNotRenameFileFromLocationOutsideFilesSection() 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: files/../../"));
  }
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.