def test_returnStories(self): storyteller.wipeDatabase() storyteller.addStory("test") storyteller.addStory("hello") storyteller.addStory("numba3") numTitles = storyteller.returnStories() self.assertEqual(len(numTitles), 3)
def test_wipeDatabase(self): storyteller.addStory("test") storyteller.addStory("hello") storyteller.addStory("numba3") storyteller.wipeDatabase() titles = storyteller.returnStories() numtitles = len(titles) self.assertEqual(numtitles, 0)
def login(): if request.method == "GET": return render_template("weaver_home.html", titles=storyteller.returnStories()) else: button = request.form['button'] newtitle = request.form['weave'] if button == "Weave this story!": storyteller.addStory(newtitle) #titles = storyteller.returnStories() elif button == "Forget all stories!": storyteller.wipeDatabase() elif button == "Enter this story!": storyChoice = request.form.get('storyChoice') for story in storyteller.returnStories(): if storyChoice == story: return redirect(url_for('page', pageTitle = story)) return render_template("weaver_home.html", titles=storyteller.returnStories())