I want to send back the form data as a post that I get from a get request. My view have a queryset to fill up the initial data, and I want to see if the operation of get the prefilled form, change a single value, post it works as I’m envisioning. This seems very unintuitive to test with TestCase. Is this pushing me to use LiveServerTestCase
instead?
You might want to make you’re you’re really clear on exactly what it is you’re looking to test here.
Are you testing a form? a view? Your code or Django’s code? Is this a Unit Test you’re trying to create or something that would possibly be described as a round-trip test?
From the way you’ve worded this:
This actually sounds like two different tests to me - if you’re talking about unit testing. Test 1 is whether the “get” request returns the proper form with the desired defaults. Test 2 is to test whether that view properly handles the submission of that form.
Since these are separate operations from Django’s perspective, it reads to me like you are more looking at a complete round-trip test and not, strictly speaking, a unit test.
Now, either way is fine - and both have their purposes. Neither one is “right” or “wrong”, and both are better than no test at all. However, being clear on this may help you make the decision as to how you want (or need) to test this.
the primary purpose is to automate the web browser interactions for testing purposes including form submissions such as post requests. However selenium is primarly designed for browser automation rather than server side testing. therefore, the selenium can simulate a user submitting a form with post data it does not provide capability for testing server responses or verifying the actual post request on the server side.