Ejemplo n.º 1
0
    def test_widget_adding(self):
        rows = DashboardRowConfigs()

        rows.add_widget(WidgetConfig({
            'name': 'widget1',
            'width': 3
        }))

        rows.add_widget(WidgetConfig({
            'name': 'widget2',
            'width': 8
        }))

        rows.add_widget(WidgetConfig({
            'name': 'widget3',
            'width': 3
        }))

        rows.add_widget(WidgetConfig({
            'name': 'widget4',
            'width': 4
        }))

        self.assertEqual(rows.to_list(), [{
            'widgets': [
                {'name': 'widget1'},
                {'name': 'widget2'}]
        }, {
            'widgets': [
                {'name': 'widget3'},
                {'name': 'widget4'}]
        }])
Ejemplo n.º 2
0
    def test_row_creation(self):
        rows = DashboardRowConfigs()

        rows.add_widget(WidgetConfig({
            'name': 'widget1',
            'width': 3
        }))

        rows.new_row()

        rows.add_widget(WidgetConfig({
            'name': 'widget2',
            'width': 3
        }))

        self.assertEqual(rows.to_list(), [{
            'widgets': [
                {'name': 'widget1'}]
        }, {
            'widgets': [
                {'name': 'widget2'}]
        }])