Commit 9d8506c0 authored by martin0726's avatar martin0726

Updated Tests and Urls

There were minor corrections that I made to further link urls and view files in the app
parent 7eb764b0
...@@ -11,19 +11,19 @@ class heroesTest(TestCase): ...@@ -11,19 +11,19 @@ class heroesTest(TestCase):
class heroCloudTest(TestCase): class heroCloudTest(TestCase):
def test_hero_cloud_page_returns_correct_html(self): def test_hero_cloud_page_returns_correct_html(self):
response = self.client.get('/heroes/cloud') response = self.client.get('/hero/cloud')
self.assertTemplateUsed(response, 'detail_cloud.html') self.assertTemplateUsed(response, 'detail_cloud.html')
class heroSunfloweyTest(TestCase): class heroSunfloweyTest(TestCase):
def test_hero_sunflowey_page_returns_correct_html(self): def test_hero_sunflowey_page_returns_correct_html(self):
response = self.client.get('/heroes/sunflowey') response = self.client.get('/hero/sunflowey')
self.assertTemplateUsed(response, 'detail_sunflowey.html') self.assertTemplateUsed(response, 'detail_sunflowey.html')
class heroJesterTest(TestCase): class heroJesterTest(TestCase):
def test_hero_jester_page_returns_correct_html(self): def test_hero_jester_page_returns_correct_html(self):
response = self.client.get('/heroes/jester') response = self.client.get('/hero/jester')
self.assertTemplateUsed(response, 'detail_jester.html')# Create your tests here. self.assertTemplateUsed(response, 'detail_jester.html')# Create your tests here.
from django.conf.urls import url from django.conf.urls import url
from .views import heroesView, cloudView, sunfloweyView, jesterView from .views import HeroesView, CloudView, SunfloweyView, JesterView
urlpatterns = [ urlpatterns = [
url(r'^heroes/$', heroesView.as_view(), name='heroes_show'), url(r'^heroes/$', HeroesView.as_view(), name='heroes_show'),
url(r'^heroes/cloud$', cloudView.as_view(), name='cloud_show'), url(r'^hero/cloud$', CloudView.as_view(), name='cloud_show'),
url(r'^heroes/sunflowey$', sunfloweyView.as_view(), name='sunflowey_show') url(r'^hero/sunflowey$', SunfloweyView.as_view(), name='sunflowey_show')
url(r'^heroes/jester$', jesterView.as_view(), name='jester_show') url(r'^heroes/jester$', JesterView.as_view(), name='jester_show')
] ]
\ No newline at end of file
from django.shortcuts import render from django.views.generic.base import TemplateView
# Create your views here.
class HeroesView(TemplateView):
template_name = 'heroes.html'
class CloudView(TemplateView):
template_name = 'detail_cloud.html'
class SunfloweyView(TemplateView):
template_name = 'detail_sunflowey.html'
class JesterView(TemplateView):
template_name = 'detail_jester.html'
\ No newline at end of file
"""willowisp URL Configuration from django.conf.urls import include, url
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.conf.urls import url, include
2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls'))
"""
from django.conf.urls import 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