diff options
| author | Tom Christie | 2012-10-02 16:16:49 +0100 | 
|---|---|---|
| committer | Tom Christie | 2012-10-02 16:16:49 +0100 | 
| commit | d1b99f350aded62fe480f7dc4749cd63d52715d2 (patch) | |
| tree | f3dc4c17bd2f307c587ca0691f485c46aeeae589 /rest_framework/tests/generics.py | |
| parent | f010a9553ec7ab1645c2bae4c959a19bb5117a21 (diff) | |
| download | django-rest-framework-d1b99f350aded62fe480f7dc4749cd63d52715d2.tar.bz2 | |
Added model form field -> serializer form field mapping
Diffstat (limited to 'rest_framework/tests/generics.py')
| -rw-r--r-- | rest_framework/tests/generics.py | 18 | 
1 files changed, 12 insertions, 6 deletions
diff --git a/rest_framework/tests/generics.py b/rest_framework/tests/generics.py index 3c241f42..76662373 100644 --- a/rest_framework/tests/generics.py +++ b/rest_framework/tests/generics.py @@ -52,7 +52,8 @@ class TestRootView(TestCase):          POST requests to RootAPIView should create a new object.          """          content = {'text': 'foobar'} -        request = factory.post('/', json.dumps(content), content_type='application/json') +        request = factory.post('/', json.dumps(content), +                               content_type='application/json')          response = self.view(request).render()          self.assertEquals(response.status_code, status.HTTP_201_CREATED)          self.assertEquals(response.data, {'id': 4, 'text': u'foobar'}) @@ -64,7 +65,8 @@ class TestRootView(TestCase):          PUT requests to RootAPIView should not be allowed          """          content = {'text': 'foobar'} -        request = factory.put('/', json.dumps(content), content_type='application/json') +        request = factory.put('/', json.dumps(content), +                              content_type='application/json')          response = self.view(request).render()          self.assertEquals(response.status_code, status.HTTP_405_METHOD_NOT_ALLOWED)          self.assertEquals(response.data, {"detail": "Method 'PUT' not allowed."}) @@ -105,7 +107,8 @@ class TestRootView(TestCase):          POST requests to create a new object should not be able to set the id.          """          content = {'id': 999, 'text': 'foobar'} -        request = factory.post('/', json.dumps(content), content_type='application/json') +        request = factory.post('/', json.dumps(content), +                               content_type='application/json')          response = self.view(request).render()          self.assertEquals(response.status_code, status.HTTP_201_CREATED)          self.assertEquals(response.data, {'id': 4, 'text': u'foobar'}) @@ -142,7 +145,8 @@ class TestInstanceView(TestCase):          POST requests to InstanceAPIView should not be allowed          """          content = {'text': 'foobar'} -        request = factory.post('/', json.dumps(content), content_type='application/json') +        request = factory.post('/', json.dumps(content), +                               content_type='application/json')          response = self.view(request).render()          self.assertEquals(response.status_code, status.HTTP_405_METHOD_NOT_ALLOWED)          self.assertEquals(response.data, {"detail": "Method 'POST' not allowed."}) @@ -152,7 +156,8 @@ class TestInstanceView(TestCase):          PUT requests to InstanceAPIView should update an object.          """          content = {'text': 'foobar'} -        request = factory.put('/1', json.dumps(content), content_type='application/json') +        request = factory.put('/1', json.dumps(content), +                              content_type='application/json')          response = self.view(request, pk=1).render()          self.assertEquals(response.status_code, status.HTTP_200_OK)          self.assertEquals(response.data, {'id': 1, 'text': 'foobar'}) @@ -197,7 +202,8 @@ class TestInstanceView(TestCase):          POST requests to create a new object should not be able to set the id.          """          content = {'id': 999, 'text': 'foobar'} -        request = factory.put('/1', json.dumps(content), content_type='application/json') +        request = factory.put('/1', json.dumps(content), +                              content_type='application/json')          response = self.view(request, pk=1).render()          self.assertEquals(response.status_code, status.HTTP_200_OK)          self.assertEquals(response.data, {'id': 1, 'text': 'foobar'})  | 
