I am new to Testing Driven Development as well as to Django and will appreciate some help please.
I have just worked through the tutorials of the official documentation for 1.11 and am trying to get going with TDD and Django. The app is wos_2017_2 and I get this in the shell (which is run in the project root) in the app's urls.py I have >>> from django.test import Client >>> client = Client() >>> response = client.get('/') Not Found: / >>> response = client.get('/wos_2017_2/') >>> response .status_code 200 from . import views from django.conf.urls import url urlpatterns = [ url(r'^$', views.index, name='index'), ] and the in "wos_2017_2/test.py" import unittest from django.test import TestCase from django.test import Client # Create your tests here. from .models import * from .views import * class SimpleTest(unittest.TestCase): def test_index(self): client = Client() response = client.get('/') self.assertEqual(response.status_code, 200) And the test fails with FAIL: test_index (wos_2017_2.tests.SimpleTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/js/django/wos/wos_2017_2/tests.py", line 16, in test_index self.assertEqual(response.status_code, 200) AssertionError: 404 != 200 ---------------------------------------------------------------------- Ran 1 test in 0.006s Using the url http://localhost:8000/wos_2017_2/ in a browser works as expected. Johann -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/5aaaf15d-db66-4fca-b44e-39b8159d38be%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.