Commit e380fb21 authored by martin0726's avatar martin0726

Finished Unit Tests

Revised the test.py and added a urls.py
parent eebaba16
...@@ -5,25 +5,25 @@ class heroesTest(TestCase): ...@@ -5,25 +5,25 @@ class heroesTest(TestCase):
def test_heroes_link_returns_correct_html(self): def test_heroes_link_returns_correct_html(self):
response = self.client.get('/heroes') response = self.client.get('/heroes')
self.assertTemplateUsed(response, 'home.html') self.assertTemplateUsed(response, 'heroes.html')
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('/heroes/cloud')
self.assertTemplateUsed(response, 'task_list.html') self.assertTemplateUsed(response, 'detail_cloud.html')
class heroSunflowey(TestCase): class heroSunflowey(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('/heroes/sunflowey')
self.assertTemplateUsed(response, 'task_create_form.html') self.assertTemplateUsed(response, 'detail_sunflowey.html')
class heroJester(TestCase): class heroJester(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('/heroes/jester')
self.assertTemplateUsed(response, 'task_create_form.html')# Create your tests here. self.assertTemplateUsed(response, 'detail_jester.html')# Create your tests here.
from django.conf.urls import url
from .views import HomeView, TaskListView, TaskCreateView
urlpatterns = [
url(r'^$', HomeView.as_view(), name='home'),
url(r'^tasks$', TaskListView.as_view(), name='task-list'),
url(r'^tasks/new$', TaskCreateView.as_view(), name='task_create')
]
\ 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