コード例 #1
0
    def test_get_entity_by_path_dataset(self):
        entity = get_entity_by_path('datasets/dummy.py', 'Dataset', {})
        self.assertEqual(str(type(entity)), "<class 'datasets.dummy.Dataset'>")

        entity = get_entity_by_path('datasets/folder/dummy1.py', 'Dataset')
        self.assertEqual(str(type(entity)),
                         "<class 'datasets.folder.dummy1.Dataset'>")

        entity = get_entity_by_path('datasets/folder/dummy2.py', 'Dataset', {})
        self.assertIsNone(entity)
コード例 #2
0
    def test_get_entity_by_path_dashboard(self):
        entity = get_entity_by_path('dashboards/dummy2.py', 'Dashboard', {})
        self.assertEqual(str(type(entity)),
                         "<class 'dashboards.dummy2.Dashboard'>")

        entity = get_entity_by_path('dashboards/dummy1/dummy3.py', 'Dashboard',
                                    {})
        self.assertEqual(str(type(entity)),
                         "<class 'dashboards.dummy1.dummy3.Dashboard'>")

        entity = get_entity_by_path('dashboards/dummy1.py', 'Dashboard', {})
        self.assertEqual(str(type(entity)),
                         "<class 'dashboards.dummy1.Dashboard'>")
コード例 #3
0
def report_detail_raw(request, report_path):
    report = get_entity_by_path('reports/{}.py'.format(report_path), 'Report',
                                request.GET)
    if not report:
        raise Http404()

    return report.get_data()
コード例 #4
0
def report_detail(request, report_path):
    report = get_entity_by_path('reports/{}.py'.format(report_path), 'Report',
                                request.GET)
    if not report:
        raise Http404()

    return render(request, 'bi/report_detail.html', {'report': report})
コード例 #5
0
def dashboard_detail(request, dashboard_id):
    dashboard = get_entity_by_path('dashboards/{}.py'.format(dashboard_id),
                                   'Dashboard', request.GET)
    if not dashboard:
        raise Http404()

    return render(request, 'bi/dashboard_detail.html',
                  {'dashboard': dashboard})
コード例 #6
0
    def test_get_entity_by_path_report(self):
        entity = get_entity_by_path('reports/dummy1.py', 'Report', {})
        self.assertEqual(str(type(entity)), "<class 'reports.dummy1.Report'>")

        entity = get_entity_by_path('reports/dummy100.py', 'Report', {})
        self.assertIsNone(entity)
コード例 #7
0
 def test_get_parent_dashboard_id(self):
     board = get_entity_by_path('dashboards/dummy1.py', 'Dashboard', {})
     self.assertIsNone(board.get_parent_dashboard_id())
     board = get_entity_by_path('dashboards/dummy1/dummy3.py', 'Dashboard',
                                {})
     self.assertEqual(board.get_parent_dashboard_id(), 'dummy1')
コード例 #8
0
 def test_template(self):
     board = get_entity_by_path('dashboards/dummy1.py', 'Dashboard', {})
     self.assertEqual(board.template, normcase('dashboards/dummy1.html'))
コード例 #9
0
 def test_id(self):
     board = get_entity_by_path('dashboards/dummy1.py', 'Dashboard', {})
     self.assertEqual(board.id, 'dummy1')
コード例 #10
0
def report(report_class: Text, **kwargs):
    rep = get_entity_by_path('reports/{}'.format(report_class), 'Report',
                             kwargs)
    context = {'report': rep}
    template = loader.get_template('bi/dashboard_report.html')
    return template.render(context)