Se7enSquared
10/14/2019 - 9:08 PM

Django Sample TestCase

Test case sample which tests resolution of home page view

from django.urls import resolve
from django.test import TestCase
from lists.views import home_page


class HomePageTest(TestCase):
    
    def test_root_url_resolves_to_home_page_view(self):
        found = resolve('/')
        self.assertEqual(found.func, home_page)