How to simulate a HTTP Post request from a django view without a template

前端 未结 5 1590
暖寄归人
暖寄归人 2021-02-13 19:11

I am writing views, not so keen to write templates right away.

But I need to test my program by submitting post requests.

How do i simulate HTTP Post from within

5条回答
  •  春和景丽
    2021-02-13 19:45

    If you are looking at this from the context of writing unittests, you could consider creating the Request object yourself and just calling the view function directly. You could even mock it, and any other parameters the view might take.

提交回复
热议问题