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:
- you intend interacting api python service , want tests work @ same level.
- you want write tests in way allows run them against live or staging environment.
Comments
Post a Comment