Commit 14acfb72 authored by Alysha Columbres's avatar Alysha Columbres

created CBVs for each url in heroes and created an html file for heroes

parent b77815fb
<!DOCTYPE html>
<html>
<head>
<title>Heroes</title>
</head>
<body>
</body>
</html>
\ No newline at end of file
from selenium import webdriver
import unittest
class NewVisitorTest(unittest.TestCase):
def setUp(self):
self.browser = webdriver.Firefox()
def tearDown(self):
self.browser.quit()
def test_can_display_a_heroes_list_and_more_information_per_hero(self):
# Widget has heard about a new wiki app for the game called The Will of the Wisps.
# She goes to check out its homepage
browser.get('http://localhost:8000')
# She notices the page title and header mention
# 'The Will of the Wisps Wiki'
self.assertIn('The Will of the Wisps Wiki', self.browser.title)
# She sees a list containing three heroes with their corresponding
# names, health points, and damage
# When she selects one of the heroes, she is sent to another page
# containing more information about the hero (additional stats, lore, image).
# She spots the page title and header mentions the name of the hero she selected.
# While she is in a specific hero's page, she sees a button labeled "Back to Heroes List".
# She clicks this and she is redirected back to the wiki's homepage.
self.fail('Finish the test!')
\ No newline at end of file
from django.test import TestCase
# Create your tests here.
class TaskListPageTest(TestCase):
def test_uses_list_template(self):
response = self.client.get('/heroes')
self.assertTemplateUsed(response, 'heroes.html')
response = self.client.get('/hero/cloud')
self.assertTemplateUsed(response, 'detail_cloud.html')
response = self.client.get('/hero/sunflowey')
self.assertTemplateUsed(response, 'detail_sunflowey.html')
response = self.client.get('/hero/jester')
self.assertTemplateUsed(response, 'detail_jester.html')
\ No newline at end of file
......@@ -16,6 +16,9 @@ Including another URLconf
from django.conf.urls import url
from .views import Heroes
from .views import Cloud
from .views import Sunflowey
from .views import Jester
urlpatterns = [
url(r'^/heroes$', Heroes.as_view(), name='Heroes'),
......
from django.shortcuts import render
from django.views.generic.base import TemplateView
# Create your views here.
class Heroes(TemplateView):
template_name = "heroes.html"
class Cloud(TemplateView):
template_name = "detail_cloud.html"
class Sunflowey(TemplateView):
template_name = "detail_sunflowey.html"
class Jester(TemplateView):
template_name = "detail_jester.html"
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment