Skip to content

Commit

Permalink
Added test for custom_detail
Browse files Browse the repository at this point in the history
  • Loading branch information
honzakral committed May 19, 2009
1 parent 8e78bc0 commit 74dc614
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tests/unit_project/test_core/test_custom_urls.py
Expand Up @@ -13,7 +13,7 @@ def second_view(request, bits, context):
return request, bits, context return request, bits, context


def custom_view(request, context): def custom_view(request, context):
return request, context return u"OK"


class CustomUrlDispatcherTestCase(UnitTestCase): class CustomUrlDispatcherTestCase(UnitTestCase):
def setUp(self): def setUp(self):
Expand Down Expand Up @@ -66,6 +66,10 @@ class TestViewCalling(CustomUrlDispatcherTestCase):
def test_nonexisting_view_raises_404(self): def test_nonexisting_view_raises_404(self):
self.assert_raises(Http404, self.dispatcher.call_view, request=object(), bits=['start'], context=self.context) self.assert_raises(Http404, self.dispatcher.call_view, request=object(), bits=['start'], context=self.context)


def test_call_custom_detail_simple_success(self):
self.dispatcher.register_custom_detail(self.__class__, custom_view)
self.assert_equals(u"OK", self.dispatcher.call_custom_detail(request=object(), context=self.context))

def test_call_view_simple_success(self): def test_call_view_simple_success(self):
self.dispatcher.register('start', view) self.dispatcher.register('start', view)
self.assert_equals(u"OK", self.dispatcher.call_view(request=object(), bits=['start'], context=self.context)) self.assert_equals(u"OK", self.dispatcher.call_view(request=object(), bits=['start'], context=self.context))

0 comments on commit 74dc614

Please sign in to comment.