mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-02-03 05:04:31 +03:00
draft for fields' metadata via OPTIONS - needs review and decision
This commit is contained in:
parent
b4dbfa9832
commit
a42afa04c3
|
@ -121,7 +121,26 @@ class TestRootView(TestCase):
|
||||||
'text/html'
|
'text/html'
|
||||||
],
|
],
|
||||||
'name': 'Root',
|
'name': 'Root',
|
||||||
'description': 'Example description for OPTIONS.'
|
'description': 'Example description for OPTIONS.',
|
||||||
|
'actions': {}
|
||||||
|
}
|
||||||
|
# TODO: this is just a draft for fields' metadata - needs review and decision
|
||||||
|
for method in ('HEAD', 'GET', 'POST', 'OPTIONS'):
|
||||||
|
expected['actions'][method] = {
|
||||||
|
'text': {
|
||||||
|
'description': '',
|
||||||
|
'label': '',
|
||||||
|
'readonly': False,
|
||||||
|
'required': True,
|
||||||
|
'type': 'CharField',
|
||||||
|
},
|
||||||
|
'id': {
|
||||||
|
'description': '',
|
||||||
|
'label': '',
|
||||||
|
'readonly': True,
|
||||||
|
'required': True,
|
||||||
|
'type': 'IntegerField',
|
||||||
|
},
|
||||||
}
|
}
|
||||||
self.assertEqual(response.status_code, status.HTTP_200_OK)
|
self.assertEqual(response.status_code, status.HTTP_200_OK)
|
||||||
self.assertEqual(response.data, expected)
|
self.assertEqual(response.data, expected)
|
||||||
|
@ -238,7 +257,26 @@ class TestInstanceView(TestCase):
|
||||||
'text/html'
|
'text/html'
|
||||||
],
|
],
|
||||||
'name': 'Instance',
|
'name': 'Instance',
|
||||||
'description': 'Example description for OPTIONS.'
|
'description': 'Example description for OPTIONS.',
|
||||||
|
'actions': {}
|
||||||
|
}
|
||||||
|
# TODO: this is just a draft idea for fields' metadata - needs review and decision
|
||||||
|
for method in ('HEAD', 'GET', 'PATCH', 'PUT', 'OPTIONS', 'DELETE'):
|
||||||
|
expected['actions'][method] = {
|
||||||
|
'text': {
|
||||||
|
'description': '',
|
||||||
|
'label': '',
|
||||||
|
'readonly': False,
|
||||||
|
'required': True,
|
||||||
|
'type': 'CharField',
|
||||||
|
},
|
||||||
|
'id': {
|
||||||
|
'description': '',
|
||||||
|
'label': '',
|
||||||
|
'readonly': True,
|
||||||
|
'required': True,
|
||||||
|
'type': 'IntegerField',
|
||||||
|
},
|
||||||
}
|
}
|
||||||
self.assertEqual(response.status_code, status.HTTP_200_OK)
|
self.assertEqual(response.status_code, status.HTTP_200_OK)
|
||||||
self.assertEqual(response.data, expected)
|
self.assertEqual(response.data, expected)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user