def test_ensure_story_is_inserted(self): story = Story(name="Zombies on Campus", visits=1, description='Zombies desciption', picture='testpic') story.save() self.assertEquals((story.visits == 1), True) self.assertEquals((story.name == 'Zombies on Campus'), True) self.assertEquals((story.description == 'Zombies desciption'), True) self.assertEquals((story.picture == 'testpic'), True)
def test_index_view_test_one_story_no_storyPoint(self): story = Story(name="Zombies on Campus", visits=1, description='Zombies desciption', picture='testpic') story.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/sid=1/spid=1/") self.assertEquals(response.status_code, 404)
def test_index_view_test_one_story(self): story = Story(name="Zombies on Campus", visits=1, description='Zombies desciption', picture='testpic') story.save() c = Client() response = c.get("/zombies/") self.assertEquals(response.status_code, 200) self.assertContains(response, "Welcome to the campus, stranger. Where will the night take you?.") self.assertContains(response, "/zombies/story-point/1/1/") self.assertContains(response, "Zombies on Campus") num_stories = len(response.context['stories']) self.assertEquals(num_stories, 1)
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")