unit testing - What are the advantage of using RequestsClient() over APIClient()? -


i writing unittest django-rest-framework api endpoints. in version 3.5, have added requestsclient(). documentation says -

rather sending http requests network, interface coerce outgoing requests wsgi, , call application directly.

from understanding, think requestsclient() useful network request different servers. not sure if has advantage in same server? there advantage of using requestsclient() on apiclient() ?

if you're not sure, use standard apiclient.

requestsclient useful if either:

  1. you intend interacting api python service , want tests work @ same level.
  2. you want write tests in way allows run them against live or staging environment.

Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

Laravel mail error `Swift_TransportException in StreamBuffer.php line 269: Connection could not be established with host smtp.gmail.com [ #0]` -

c# SetCompatibleTextRenderingDefault must be called before the first -