Skip to content

Instantly share code, notes, and snippets.

@tyndyll
Created February 20, 2020 14:17
Show Gist options
  • Save tyndyll/7461c0032900934250607ff006c67c04 to your computer and use it in GitHub Desktop.
Save tyndyll/7461c0032900934250607ff006c67c04 to your computer and use it in GitHub Desktop.
Test Django URL Resolves to Correct CBV
from django.test import TestCase
from django.urls import resolve
from .views import Home
class TestURLPatterns(TestCase):
def test_home_path_calls_home_view(self):
found = resolve("/")
self.assertEqual(found.func.view_class, Home)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment