Python horizon.Panel() Examples
The following are 4
code examples of horizon.Panel().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
horizon
, or try the search function
.
Example #1
Source File: base.py From avos with Apache License 2.0 | 5 votes |
def test_dashboard(self): cats = horizon.get_dashboard("cats") self.assertEqual(base.Horizon, cats._registered_with) self.assertQuerysetEqual(cats.get_panels(), ['<Panel: kittens>', '<Panel: tigers>']) self.assertEqual("/cats/", cats.get_absolute_url()) self.assertEqual("Cats", cats.name) # Test registering a module with a dashboard that defines panels # as a panel group. cats.register(MyPanel) self.assertQuerysetEqual(cats.get_panel_groups()['other'], ['<Panel: myslug>']) # Test that panels defined as a tuple still return a PanelGroup dogs = horizon.get_dashboard("dogs") self.assertQuerysetEqual(dogs.get_panel_groups().values(), ['<PanelGroup: default>']) # Test registering a module with a dashboard that defines panels # as a tuple. dogs = horizon.get_dashboard("dogs") dogs.register(MyPanel) self.assertQuerysetEqual(dogs.get_panels(), ['<Panel: puppies>', '<Panel: myslug>'])
Example #2
Source File: base.py From avos with Apache License 2.0 | 5 votes |
def test_panel_without_slug_fails(self): class InvalidPanel(horizon.Panel): name = 'Invalid' self.assertRaises(ImproperlyConfigured, InvalidPanel)
Example #3
Source File: base.py From avos with Apache License 2.0 | 5 votes |
def test_customize_dashboard(self): cats = horizon.get_dashboard("cats") self.assertEqual("WildCats", cats.name) self.assertQuerysetEqual(cats.get_panels(), ['<Panel: kittens>']) with self.assertRaises(base.NotRegistered): horizon.get_dashboard("dogs")
Example #4
Source File: base.py From avos with Apache License 2.0 | 5 votes |
def test_rbac_panels(self): context = {'request': self.request} cats = horizon.get_dashboard("cats") self.assertEqual(cats._registered_with, base.Horizon) self.assertQuerysetEqual(cats.get_panels(), ['<Panel: rbac_panel_no>']) self.assertFalse(cats.can_access(context)) dogs = horizon.get_dashboard("dogs") self.assertEqual(dogs._registered_with, base.Horizon) self.assertQuerysetEqual(dogs.get_panels(), ['<Panel: rbac_panel_yes>']) self.assertTrue(dogs.can_access(context))