You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/api-guide/testing.md
+27-1Lines changed: 27 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -292,7 +292,7 @@ similar way as with `RequestsClient`.
292
292
293
293
---
294
294
295
-
# Test cases
295
+
# API Test cases
296
296
297
297
REST framework includes the following test case classes, that mirror the existing Django test case classes, but use `APIClient` instead of Django's default `Client`.
298
298
@@ -324,6 +324,32 @@ You can use any of REST framework's test case classes as you would for the regul
324
324
325
325
---
326
326
327
+
# URLPatternsTestCase
328
+
329
+
REST framework also provides a test case class for isolating `urlpatterns` on a per-class basis. Note that this inherits from Django's `SimpleTestCase`, and will most likely need to be mixed with another test case class.
330
+
331
+
## Example
332
+
333
+
from django.urls import include, path, reverse
334
+
from rest_framework.test import APITestCase, URLPatternsTestCase
335
+
336
+
337
+
class AccountTests(APITestCase, URLPatternsTestCase):
0 commit comments