Suppose I have an unit test which tests a view. That view requires a form to do some processing. My unit test looks like this:
class ViewTests(TestCase):
def setUp(self):
self.factory = RequestFactory()
def test_login_view_post(self):
# require form object to pass it in post function
response = self.client.post(reverse('login'))
self.assertContains(response, "Your username and password didn't match", status_code=200)
Can someone tell me that how can I pass the form object in the post function?
Thanks.