Commit faecbea6 authored by Santino Campos's avatar Santino Campos

Add test for validating redirecting view on empty url

parent fc8afb2a
from django.test import TestCase from django.test import TestCase
from .views import redirect_view
class HomePageTest(TestCase): class HomePageTest(TestCase):
...@@ -15,10 +17,13 @@ class HomePageTest(TestCase): ...@@ -15,10 +17,13 @@ class HomePageTest(TestCase):
jester_detail_response = self.client.get("/hero/jester") jester_detail_response = self.client.get("/hero/jester")
self.assertTemplateUsed(jester_detail_response, 'detail_jester.html') self.assertTemplateUsed(jester_detail_response, 'detail_jester.html')
def test_cloud_url_returns_valid_template(self): def test_cloud_url_returns_valid_template(self):
cloud_detail_response = self.client.get("/hero/cloud") cloud_detail_response = self.client.get("/hero/cloud")
self.assertTemplateUsed(cloud_detail_response, 'detail_cloud.html') self.assertTemplateUsed(cloud_detail_response, 'detail_cloud.html')
def test_blank_url_redirects(self):
redirect_response = self.client.get("/")
self.assertEqual(redirect_response.url, '/heroes')
......
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