Created
May 21, 2017 02:55
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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