Re: Django Tutorial 5 - First Tests

2014-02-13 Thread Jonathan Baker
Glad you worked it out. Enjoy the rest of the tutorial! JDB On Thu, Feb 13, 2014 at 1:54 PM, Paul Sermon wrote: > OK thanks for your help. > > I've reviewed through the code, and I had a minor indentation typo that > wasn't helping! > > Anyway, I worked it down to the lines self.assertContains.

Re: Django Tutorial 5 - First Tests

2014-02-13 Thread Paul Sermon
OK thanks for your help. I've reviewed through the code, and I had a minor indentation typo that wasn't helping! Anyway, I worked it down to the lines self.assertContains. You see that full-stop/period at the end of the string it was looking for? That wasn't in the no polls message! That'll

Re: Django Tutorial 5 - First Tests

2014-02-13 Thread Jonathan Baker
Cool, so we're making progress and you're using the test database now. Since you have two tests failing, I'd comment out the 2nd of the two for now and focus on getting the first to pass, and then moving on to the second. Don't try to do too much at once, and do try and understand what each functio

Re: Django Tutorial 5 - First Tests

2014-02-13 Thread C. Kirby
The names of both those tests imply that your setup will fail them. (I didn't look at the test internals, so I am assuming the test names do what they say) 1. "test_index_view_with_a_future_poll" - you have future polls 2. "test_index_view_with_no_polls" - you have polls in the database On Thu

Re: Django Tutorial 5 - First Tests

2014-02-13 Thread Paul Sermon
Hmm, you'r right, I think I'm getting confused and attributed the error to something it isn't. Ive just ran the test after changing all the polls to the future, and I still get the errors. The errors are as follows: == FAIL: t

Re: Django Tutorial 5 - First Tests

2014-02-13 Thread Jonathan Baker
"setup_test_environment() installs a template renderer which will allow us to examine some additional attributes on responses such as response.context that otherwise wouldn't be available. Note

Re: Django Tutorial 5 - First Tests

2014-02-13 Thread Paul Sermon
yes I am running through the manage.py shell (although initially I did not). I am doing the section: https://docs.djangoproject.com/en/1.6/intro/tutorial05/#the-django-test-client On the response.content line, I get back a line listing the polls made earlier. And I presume that is why the t

Re: Django Tutorial 5 - First Tests

2014-02-13 Thread Jonathan Baker
Are you running your tests on the command line using: $ python manage.py test polls ...or are you trying to run them from a Python shell? It'd be helpful if you could provide the internal link to the area of the page you linked to that you're experiencing the failure at, as well as the output of

Re: Django Tutorial 5 - First Tests

2014-02-13 Thread Paul Sermon
This is the tutorial: https://docs.djangoproject.com/en/1.6/intro/tutorial05/ I've followed the tutorials pretty much to the letter since tutorial one. Thanks for the help! -Paul On Wednesday, February 12, 2014 10:33:16 PM UTC, jondbaker wrote: > > You're correct in thinking that tests use a t

Re: Django Tutorial 5 - First Tests

2014-02-12 Thread Jonathan Baker
You're correct in thinking that tests use a test database that is independent of your formally defined project database. Without knowing exactly which Django tutorials you are referring to, I can only assume that perhaps you: 1) Have defined initial_data.json fixtures 2) Have defined other fixture

Django Tutorial 5 - First Tests

2014-02-12 Thread Paul Sermon
So I'm working my way through the Django tutorials, and have got as far as the view tests. It seems that when running the test client, rather than returning data from an empty test database (is this what is meant to happen?) it is returning polls from the existing database, which has the polls