Skip to content

Instantly share code, notes, and snippets.

@aipi
Created May 21, 2017 02:55
Show Gist options
  • Save aipi/00d923926d260a30f70fa0734c7693de to your computer and use it in GitHub Desktop.
Save aipi/00d923926d260a30f70fa0734c7693de to your computer and use it in GitHub Desktop.
Django - Test that index view returns a 200 response and uses the correct template
from django.tesst import TestCase
class IndexViewTestCase(TestCase):
def setUp(self):
self.factory = RequestFactory()
def test_index_view_basic(self):
"""Test that index view returns a
200 response and uses the correct
template"""
request = self.factory.get('/')
with self.assertTemplateUsed('solos/index.html'):
response = index(request)
self.assertEqual(200, response.status_code)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment