Commit b358d1e5 authored by Ryan Carlo Bautista's avatar Ryan Carlo Bautista

fixed heroes app tests. implemented views for jester, cloud, sunflowey, and...

fixed heroes app tests. implemented views for jester, cloud, sunflowey, and heroes pages. added urls for jester, cloud, sunflowey and heroes pages. test failed because heroes.html doesn't exist.
parent 9a7be0fd
<!DOCTYPE html>
<html>
<head>
<title>Detail - Cloud</title>
</head>
<body>
<img src="./cloud.png" style="width: 10vw;" />
<h1>Detail - Cloud</h1>
<dl>
<dt>Health Points</dt><dd>600</dd>
<dt>Base Attack Damage</dt><dd>57</dd>
<dt>Skills</dt><dd>Nimbus, Rain Cloud, Thunderbolt</dd>
<dt>Lore</dt><dd>I am a cloud. When I pee you call it 'rain'.</dd>
</dl>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<title>Detail - Jester</title>
</head>
<body>
<img src="./jester.png" style="width: 10vw;"/>
<h1>Detail - Jester</h1>
<dl>
<dt>Health Points</dt><dd>660</dd>
<dt>Base Attack Damage</dt><dd>64</dd>
<dt>Skills</dt><dd>Laugh, Dance, Smile</dd>
<dt>Lore</dt><dd>I do it for the LOLs.</dd>
</dl>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<title>Detail - Sunflowey</title>
</head>
<body>
<img src="./sunflowey.png" style="width: 10vw;" />
<h1>Detail - Sunflowey</h1>
<dl>
<dt>Health Points</dt><dd>650</dd>
<dt>Base Attack Damage</dt><dd>43</dd>
<dt>Skills</dt><dd>Power Pellet, Sunshine, Pollen Punch</dd>
<dt>Lore</dt><dd>I am Sunflowey. Sometimes a sun, sometimes a flower.</dd>
</dl>
</body>
</html>
\ No newline at end of file
from django.urls import resolve from django.urls import resolve
from django.test import TestCase from django.test import TestCase
from .views import cloud_page, jester_page, sunflowey_page, heroes_page from .views import CloudView, JesterView, SunfloweyView, HeroesView
# Create your tests here. # Create your tests here.
class CloudPageTest(TestCase):
def test_cloud_page_returns_correct_html(self):
response = self.client.get('/hero/cloud')
self.assertTemplateUsed(response, 'detail_cloud.html')
class JesterPageTest(TestCase):
def test_jester_page_returns_correct_html(self):
response = self.client.get('/hero/jester')
self.assertTemplateUsed(response, 'detail_jester.html')
class SunfloweyPageTest(TestCase):
def test_sunflowey_page_returns_correct_html(self):
response = self.client.get('/hero/sunflowey')
self.assertTemplateUsed(response, 'detail_sunflowey.html')
class HomePageTest(TestCase):
def test_home_page_returns_correct_html(self):
response = self.client.get('/heroes')
self.assertTemplateUsed(response, 'heroes.html')
\ No newline at end of file
from django.conf.urls import url
from .views import CloudView, JesterView, SunfloweyView, HeroesView
urlpatterns = [
url(r'^hero/cloud$', CloudView.as_view(), name = 'cloud'),
url(r'^hero/jester$', JesterView.as_view(), name = 'jester'),
url(r'^hero/sunflowey$', SunfloweyView.as_view(), name = 'sunflowey'),
url(r'^heroes$', HeroesView.as_view(), name = 'heroes'),
]
\ No newline at end of file
from django.shortcuts import render from django.shortcuts import render
from django.views.generic.base import TemplateView
# Create your views here. # Create your views here.
class CloudView(TemplateView):
template_name = 'detail_cloud.html'
class JesterView(TemplateView):
template_name = 'detail_jester.html'
class SunfloweyView(TemplateView):
template_name = 'detail_sunflowey.html'
class HeroesView(TemplateView):
template_name = 'heroes.html'
\ No newline at end of file
...@@ -13,9 +13,10 @@ Including another URLconf ...@@ -13,9 +13,10 @@ Including another URLconf
1. Import the include() function: from django.conf.urls import url, include 1. Import the include() function: from django.conf.urls import url, include
2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls'))
""" """
from django.conf.urls import url from django.conf.urls import include, url
from django.contrib import admin from django.contrib import admin
urlpatterns = [ urlpatterns = [
url(r'^admin/', admin.site.urls), url(r'^admin/', admin.site.urls),
url(r'',include('heroes.urls'))
] ]
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