aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/tests/generics.py
diff options
context:
space:
mode:
Diffstat (limited to 'rest_framework/tests/generics.py')
-rw-r--r--rest_framework/tests/generics.py74
1 files changed, 39 insertions, 35 deletions
diff --git a/rest_framework/tests/generics.py b/rest_framework/tests/generics.py
index a2f8fb4b..f091d0db 100644
--- a/rest_framework/tests/generics.py
+++ b/rest_framework/tests/generics.py
@@ -122,21 +122,24 @@ class TestRootView(TestCase):
],
'name': 'Root',
'description': 'Example description for OPTIONS.',
- 'actions': {}
- }
- expected['actions']['GET'] = {}
- expected['actions']['POST'] = {
- 'text': {
- 'max_length': 100,
- 'read_only': False,
- 'required': True,
- 'type': 'String',
- },
- 'id': {
- 'read_only': True,
- 'required': False,
- 'type': 'Integer',
- },
+ 'actions': {
+ 'POST': {
+ 'text': {
+ 'max_length': 100,
+ 'read_only': False,
+ 'required': True,
+ 'type': 'string',
+ "label": "Text comes here",
+ "help_text": "Text description."
+ },
+ 'id': {
+ 'read_only': True,
+ 'required': False,
+ 'type': 'integer',
+ 'label': 'ID',
+ },
+ }
+ }
}
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertEqual(response.data, expected)
@@ -239,9 +242,9 @@ class TestInstanceView(TestCase):
"""
OPTIONS requests to RetrieveUpdateDestroyAPIView should return metadata
"""
- request = factory.options('/')
- with self.assertNumQueries(0):
- response = self.view(request).render()
+ request = factory.options('/1')
+ with self.assertNumQueries(1):
+ response = self.view(request, pk=1).render()
expected = {
'parses': [
'application/json',
@@ -254,24 +257,25 @@ class TestInstanceView(TestCase):
],
'name': 'Instance',
'description': 'Example description for OPTIONS.',
- 'actions': {}
- }
- for method in ('GET', 'DELETE'):
- expected['actions'][method] = {}
- for method in ('PATCH', 'PUT'):
- expected['actions'][method] = {
- 'text': {
- 'max_length': 100,
- 'read_only': False,
- 'required': True,
- 'type': 'String',
- },
- 'id': {
- 'read_only': True,
- 'required': False,
- 'type': 'Integer',
- },
+ 'actions': {
+ 'PUT': {
+ 'text': {
+ 'max_length': 100,
+ 'read_only': False,
+ 'required': True,
+ 'type': 'string',
+ 'label': 'Text comes here',
+ 'help_text': 'Text description.'
+ },
+ 'id': {
+ 'read_only': True,
+ 'required': False,
+ 'type': 'integer',
+ 'label': 'ID',
+ },
+ }
}
+ }
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertEqual(response.data, expected)