def test_get_dashboard(self): from wsgi.modules import get_dashboard dashboard = get_dashboard() self.assertEqual(len(dashboard['deactivated']), 1) self.assertEqual(len(dashboard['left']), 0) self.assertEqual(len(dashboard['middle']), 0) self.assertEqual(len(dashboard['right']), 0)
def dashboard_view(): dashboard = get_dashboard() for column in dashboard.values(): for widget in column: if 'html' not in widget.keys(): assert 'template' in widget.keys(), 'You must either provide an "html" or "template" parameter.' template = widget['template'] context = widget.get('context', {}) widget['html'] = jinja2_view(template)(lambda : context)() return { 'dashboard': dashboard }