def test_removeLines(self): storyteller.wipeDatabase() storyteller.addStory("test") storyteller.addLine("test", "this is a line") storyteller.addLine("test", "bonjour") storyteller.removeLines("test") lines = storyteller.getLines("test") numLines = len(lines) self.assertEqual(numLines, 0)
def page(pageTitle=None): global pageCounter if request.method == "GET": pageCounter = 1 return render_template("weaver_page.html", pageCounter=pageCounter, title=pageTitle, lines=storyteller.getLines(pageTitle)) else: button = request.form['button'] newline = request.form['weave'] #pageCounter = 1 if button == "Weave in the line!": storyteller.addLine(pageTitle, newline) elif button =="Next Page": pageCounter = pageCounter + 1 elif button =="Prev Page": pageCounter = pageCounter - 1 elif button == "Release all lines!": storyteller.removeLines(pageTitle) pageCounter = 1 render_template("weaver_page.html", pageCounter=pageCounter, title=pageTitle, lines=storyteller.getLines(pageTitle)) elif button == "Float me to the home page...": return redirect(url_for('login')) return render_template("weaver_page.html", pageCounter=pageCounter, title=pageTitle, lines=storyteller.getLines(pageTitle))