From the course: Test-Driven Development in Django

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Testing a POST request

Testing a POST request

From the course: Test-Driven Development in Django

Start my 1-month free trial

Testing a POST request

- [Tutor] The next test that we want to look for, is the ability to view a particular hash. We want to have a URL where a user can go entering a specific hash and see the text associated with that hash. So, let's go ahead and create a new test. We're going to write def and the name for this one should be test underscore viewing, underscore hash. We'll go ahead and will pass in self there. Now, inside of this, we need to make sure that we have a hash function that we can go test and see what the response is and so we're going to use a lot of the same code that we have above, where we create a hash object and we save it, so I'm just going to go ahead and copy and paste that down below. Then, the next thing that we want to do, is we want to go get a response from our clients. So we're going to say response, is equal to self dot client dot get and the particular URL that we're looking for is, and we haven't implemented this yet, but what we want to create a something where we can say, our…

Contents