API Testing with APIClient
APIClient drives the full stack — routing, authentication, permissions, serializers — with client.get/post(path, data, format='json'), and force_authenticate() bypasses credential plumbing to test as a given user. Assert on response.status_code and response.data (parsed, not raw bytes), and use assertNumQueries to pin query counts against N+1 regressions.
This Concept is waiting for its first lesson!
APIClient drives the full stack — routing, authentication, permissions, serializers — with client.get/post(path, data, format='json'), and force_authenticate() bypasses credential plumbing to test as a given user. Assert on response.status_code and response.data (parsed, not raw bytes), and use assertNumQueries to pin query counts against N+1 regressions.
Are you a teacher? Sign in to start contributing.
Sign In