aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework
diff options
context:
space:
mode:
authorNikolaus Schlemm2013-05-18 17:13:23 +0200
committerNikolaus Schlemm2013-05-18 17:13:23 +0200
commita42afa04c38afe25c9032b8ce37b572678b02cf1 (patch)
tree22f86ac2c9b7e0ea7339a360eff4ae00080eb2ba /rest_framework
parentb4dbfa9832e2a29a5908ddf27f8746971a8e3c56 (diff)
downloaddjango-rest-framework-a42afa04c38afe25c9032b8ce37b572678b02cf1.tar.bz2
draft for fields' metadata via OPTIONS - needs review and decision
Diffstat (limited to 'rest_framework')
-rw-r--r--rest_framework/tests/generics.py42
1 files changed, 40 insertions, 2 deletions
diff --git a/rest_framework/tests/generics.py b/rest_framework/tests/generics.py
index 15d87e86..014195ae 100644
--- a/rest_framework/tests/generics.py
+++ b/rest_framework/tests/generics.py
@@ -121,8 +121,27 @@ class TestRootView(TestCase):
'text/html'
],
'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.data, expected)
@@ -238,8 +257,27 @@ class TestInstanceView(TestCase):
'text/html'
],
'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.data, expected)