def test_ensure_storyPoints_is_inserted(self): storyPoint = StoryPoint(description='You are in the library', choiceText='yes', experience=10, story_type='start', main_story_id_id=5, visits=1, story_point_id=1, picture='testpic2') storyPoint.save() self.assertEquals((storyPoint.description == 'You are in the library'), True) self.assertEquals((storyPoint.choiceText == 'yes'), True) self.assertEquals((storyPoint.experience == 10), True) self.assertEquals((storyPoint.story_type == "start"), True) self.assertEquals((storyPoint.story_point_id == 1), True) self.assertEquals((storyPoint.picture == 'testpic2'), True) self.assertEquals((storyPoint.visits == 1), True) self.assertEquals((storyPoint.main_story_id_id == 5), True)
def test_index_view_test_one_story_one_storyPoint(self): story = Story(name="Zombies on Campus", visits=1, description='Zombies desciption', picture='testpic') story.save() storyPoint = StoryPoint(description='You are in the library', choiceText='yes', experience=10, story_type='start', main_story_id_id=1, visits=1, story_point_id=1, picture='testpic2') storyPoint.save() c = Client() response = c.get("/zombies/") self.assertEquals(response.status_code, 200) self.assertContains(response, "/zombies/story-point/1/1/") num_stories = len(response.context['stories']) self.assertEquals(num_stories, 1) response = c.get("/zombies/story-point/1/1/") self.assertEquals(response.status_code, 200) self.assertContains(response, "You are in the library") self.assertContains(response, "You have reached the end. Congratulations!") self.assertContains(response, "Play the story again") self.assertContains(response, "Play another story")