Exemplo n.º 1
0
 def test_basic_view(self):
     view, decorators = urlviz.extract_view(views.basic_view)
     data = urlviz.inspect_view(view)
     self.assertEqual(data['name'], 'basic_view')
     self.assertEqual(data['doc'], 'This is a basic test view.')
     self.assertTrue(data['file'].endswith('alto/tests/views.py'))
     self.assertTrue('line_number' in data)
     self.assertTrue('source' in data)
     self.assertTrue('sourcelines' in data)
Exemplo n.º 2
0
 def test_extract_view(self):
     view, decorators = urlviz.extract_view(views.instance_decorated_view)
     data = urlviz.inspect_view(view)
     self.assertEqual(data['name'], 'instance_decorated_view')
     self.assertEqual(data['doc'], 'This is a decorated function view.')
     self.assertTrue(data['file'].endswith('alto/tests/views.py'))
Exemplo n.º 3
0
 def test_class_view(self):
     view, decorators = urlviz.extract_view(views.ClassView())
     data = urlviz.inspect_view(view)
     self.assertEqual(data['name'], 'ClassView')
     self.assertEqual(data['doc'], 'This is a basic class view.')
     self.assertTrue(data['file'].endswith('alto/tests/views.py'))
Exemplo n.º 4
0
def view_detail(request, module_path, view_name):
    view = urlviz.load_view(module_path, view_name)
    view, decorators = urlviz.extract_view(view)
    data = urlviz.inspect_view(view)
    return http.HttpResponse(json.dumps(data, sort_keys=True, indent=2))