Added other three unit tests.

parent abe006a5
...@@ -29,7 +29,16 @@ class NewVisitorTest(unittest.TestCase): ...@@ -29,7 +29,16 @@ class NewVisitorTest(unittest.TestCase):
# While she is in a specific hero's page, she sees a button labeled "Back to Heroes List". # 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. # She clicks this and she is redirected back to the wiki's homepage.
self.browser.get('http://localhost:8000') self.browser.get('http://localhost:8000/heroes')
# She decides to do it again UwU
self.browser.get('http://localhost:8000/hero/sunflowey')
self.assertIn('Detail - Sunflowey', self.browser.title)
self.browser.get('http://localhost:8000/heroes')
self.browser.get('http://localhost:8000/hero/jester')
self.assertIn('Detail - Jester', self.browser.title)
self.browser.get('http://localhost:8000/heroes')
self.fail('Finish the test!') self.fail('Finish the test!')
......
...@@ -5,3 +5,15 @@ class HomePageTest(TestCase): ...@@ -5,3 +5,15 @@ class HomePageTest(TestCase):
def test_heroes_page_returns_correct_html(self): def test_heroes_page_returns_correct_html(self):
response = self.client.get('/heroes/') response = self.client.get('/heroes/')
self.assertTemplateUsed(response, 'heroes.html') self.assertTemplateUsed(response, 'heroes.html')
def test_cloud_page_returns_correct_html(self):
response = self.client.get('/hero/cloud')
self.assertTemplateUsed(response, 'detail_cloud.html')
def test_sunflowey_page_returns_correct_html(self):
response = self.client.get('/hero/sunflowey')
self.assertTemplateUsed(response, 'detail_sunflowey.html')
def test_jester_page_returns_correct_html(self):
response = self.client.get('/hero/jester')
self.assertTemplateUsed(response, 'detail_jester.html')
...@@ -4,10 +4,10 @@ def heroes_page(request): ...@@ -4,10 +4,10 @@ def heroes_page(request):
return render(request, 'heroes.html') return render(request, 'heroes.html')
def cloud_page(request): def cloud_page(request):
pass return render(request, 'detail_cloud.html')
def sunflowey_page(request): def sunflowey_page(request):
pass return render(request, 'detail_sunflowey.html')
def jester_page(request): def jester_page(request):
pass return render(request, 'detail_jester.html')
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