コード例 #1
0
 def test_modelviewset_list_action_breadcrumbs(self):
     url = '/resources/list_action/'
     assert get_breadcrumbs(url) == [
         ('Root', '/'),
         ('Resource List', '/resources/'),
         ('List action', '/resources/list_action/'),
     ]
コード例 #2
0
 def test_nested_resource_breadcrumbs(self):
     url = '/resource/123/'
     assert get_breadcrumbs(url) == [('Root', '/'),
                                     ('Resource Root', '/resource/'),
                                     ('Resource Instance', '/resource/123'),
                                     ('Nested Resource Root',
                                      '/resource/123/')]
コード例 #3
0
 def test_modelviewset_action_suffix_kwarg(self):
     url = '/resources/1/suffixed_action/'
     assert get_breadcrumbs(url) == [
         ('Root', '/'),
         ('Resource List', '/resources/'),
         ('Resource Instance', '/resources/1/'),
         ('Resource Custom Suffix', '/resources/1/suffixed_action/'),
     ]
コード例 #4
0
 def test_modelviewset_action_name_kwarg(self):
     url = '/resources/1/named_action/'
     assert get_breadcrumbs(url) == [
         ('Root', '/'),
         ('Resource List', '/resources/'),
         ('Resource Instance', '/resources/1/'),
         ('Custom Name', '/resources/1/named_action/'),
     ]
コード例 #5
0
 def test_modelviewset_detail_action_breadcrumbs(self):
     url = '/resources/1/detail_action/'
     assert get_breadcrumbs(url) == [
         ('Root', '/'),
         ('Resource List', '/resources/'),
         ('Resource Instance', '/resources/1/'),
         ('Detail action', '/resources/1/detail_action/'),
     ]
コード例 #6
0
 def get_breadcrumbs(self, request):
     return get_breadcrumbs(request.path, request)
コード例 #7
0
 def test_resource_instance_customname_breadcrumbs(self):
     url = '/resource/customname'
     assert get_breadcrumbs(url) == [('Root', '/'),
                                     ('Resource Root', '/resource/'),
                                     ('Foo', '/resource/customname')]
コード例 #8
0
 def test_resource_root_breadcrumbs(self):
     url = '/resource/'
     assert get_breadcrumbs(url) == [('Root', '/'),
                                     ('Resource Root', '/resource/')]
コード例 #9
0
 def test_root_breadcrumbs(self):
     url = '/'
     assert get_breadcrumbs(url) == [('Root', '/')]
コード例 #10
0
 def test_modelviewset_resource_instance_breadcrumbs(self):
     url = '/resources/1/'
     assert get_breadcrumbs(url) == [('Root', '/'),
                                     ('Resource List', '/resources/'),
                                     ('Resource Instance', '/resources/1/')]
コード例 #11
0
 def test_broken_url_breadcrumbs_handled_gracefully(self):
     url = '/foobar'
     assert get_breadcrumbs(url) == [('Root', '/')]