Esempio n. 1
0
    def test_box_widgets_type(self):
        """Test raising of errors when items type are wrong."""
        with pytest.raises(AttributeError) as e:
            Box(widgets=1)
        assert 'Box widgets attribute must be a list or tuple' in str(e.value)

        with pytest.raises(ValueError) as e:
            Box(widgets=[Widget(template='_.html'), 0])
        assert 'All elements of Box must be Widget instances' in str(e.value)
Esempio n. 2
0
 def test_box_kwargs(self):
     """Test box correctly setting up kwargs as attributes."""
     box = Box(arg1=1, arg2=2, arg3=3)
     assert hasattr(box, 'arg1')
     assert getattr(box, 'arg1') == 1
     assert hasattr(box, 'arg2')
     assert getattr(box, 'arg2') == 2
     assert hasattr(box, 'arg3')
     assert getattr(box, 'arg3') == 3
Esempio n. 3
0
    def test_main(self):
        """Main test method."""
        box = Box(widgets=[Widget(template='_.html')])
        grid = Grid(Row(Column(width=12)))
        view = DashboardView.as_view()

        assert box
        assert grid
        assert view