Python horizon.Dashboard() Examples
The following are 1
code examples of horizon.Dashboard().
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_registry(self): """Verify registration and autodiscovery work correctly. Please note that this implicitly tests that autodiscovery works by virtue of the fact that the dashboards listed in ``settings.INSTALLED_APPS`` are loaded from the start. """ # Registration self.assertEqual(2, len(base.Horizon._registry)) horizon.register(MyDash) self.assertEqual(3, len(base.Horizon._registry)) with self.assertRaises(ValueError): horizon.register(MyPanel) with self.assertRaises(ValueError): horizon.register("MyPanel") # Retrieval my_dash_instance_by_name = horizon.get_dashboard("mydash") self.assertIsInstance(my_dash_instance_by_name, MyDash) my_dash_instance_by_class = horizon.get_dashboard(MyDash) self.assertEqual(my_dash_instance_by_name, my_dash_instance_by_class) with self.assertRaises(base.NotRegistered): horizon.get_dashboard("fake") self.assertQuerysetEqual(horizon.get_dashboards(), ['<Dashboard: cats>', '<Dashboard: dogs>', '<Dashboard: mydash>']) # Removal self.assertEqual(3, len(base.Horizon._registry)) horizon.unregister(MyDash) self.assertEqual(2, len(base.Horizon._registry)) with self.assertRaises(base.NotRegistered): horizon.get_dashboard(MyDash)