aboutsummaryrefslogtreecommitdiffstats
path: root/djangorestframework/tests/description.py
diff options
context:
space:
mode:
authorTom Christie2012-09-03 16:54:17 +0100
committerTom Christie2012-09-03 16:54:17 +0100
commita092a72844705e3129b8996b81d8424997b5d37f (patch)
tree2f9cf30fc805a4b8cf4e6d60b3f820a3e96347e3 /djangorestframework/tests/description.py
parent1a1ccf94c2c0cadee8b0bd1c8f85c591c650d763 (diff)
downloaddjango-rest-framework-a092a72844705e3129b8996b81d8424997b5d37f.tar.bz2
View -> APIView
Diffstat (limited to 'djangorestframework/tests/description.py')
-rw-r--r--djangorestframework/tests/description.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/djangorestframework/tests/description.py b/djangorestframework/tests/description.py
index 212b4ca4..b88451eb 100644
--- a/djangorestframework/tests/description.py
+++ b/djangorestframework/tests/description.py
@@ -1,5 +1,5 @@
from django.test import TestCase
-from djangorestframework.views import View
+from djangorestframework.views import APIView
from djangorestframework.compat import apply_markdown
# We check that docstrings get nicely un-indented.
@@ -48,21 +48,21 @@ MARKED_DOWN_gte_21 = """<h2 id="an-example-docstring">an example docstring</h2>
class TestViewNamesAndDescriptions(TestCase):
def test_resource_name_uses_classname_by_default(self):
"""Ensure Resource names are based on the classname by default."""
- class MockView(View):
+ class MockView(APIView):
pass
self.assertEquals(MockView().get_name(), 'Mock')
def test_resource_name_can_be_set_explicitly(self):
"""Ensure Resource names can be set using the 'get_name' method."""
example = 'Some Other Name'
- class MockView(View):
+ class MockView(APIView):
def get_name(self):
return example
self.assertEquals(MockView().get_name(), example)
def test_resource_description_uses_docstring_by_default(self):
"""Ensure Resource names are based on the docstring by default."""
- class MockView(View):
+ class MockView(APIView):
"""an example docstring
====================
@@ -83,7 +83,8 @@ class TestViewNamesAndDescriptions(TestCase):
def test_resource_description_can_be_set_explicitly(self):
"""Ensure Resource descriptions can be set using the 'get_description' method."""
example = 'Some other description'
- class MockView(View):
+
+ class MockView(APIView):
"""docstring"""
def get_description(self):
return example
@@ -92,14 +93,15 @@ class TestViewNamesAndDescriptions(TestCase):
def test_resource_description_does_not_require_docstring(self):
"""Ensure that empty docstrings do not affect the Resource's description if it has been set using the 'get_description' method."""
example = 'Some other description'
- class MockView(View):
+
+ class MockView(APIView):
def get_description(self):
return example
self.assertEquals(MockView().get_description(), example)
def test_resource_description_can_be_empty(self):
"""Ensure that if a resource has no doctring or 'description' class attribute, then it's description is the empty string."""
- class MockView(View):
+ class MockView(APIView):
pass
self.assertEquals(MockView().get_description(), '')