def test_unregister(self): """Testing AdminWidgetHook unitializing""" hook = AdminWidgetHook(extension=self.extension, widget_cls=TestWidget) hook.shutdown() self.assertNotIn(TestWidget, secondary_widgets)
def test_unregister(self): """Testing AdminWidgetHook unitializing""" hook = AdminWidgetHook(extension=self.extension, widget_cls=TestWidget) hook.shutdown() self.assertNotIn(TestWidget, secondary_widgets)
def test_register_with_primary(self): """Testing AdminWidgetHook initializing with primary set""" AdminWidgetHook(extension=self.extension, widget_cls=TestWidget, primary=True) self.assertIn(TestWidget, primary_widgets)
def test_initialize_with_legacy_widget(self): """Testing AdminWidgetHook.initialize with legacy Widget subclass""" message = ( "AdminWidgetHook's support for legacy " "reviewboard.admin.widgets.Widget subclasses is deprecated " "and will be removed in Review Board 5.0. Rewrite %r " "to subclass the modern " "reviewboard.admin.widgets.baseAdminWidget instead. This " "will require a full rewrite of the widget's functionality." % MyLegacyAdminWidget) with self.assertWarns(RemovedInReviewBoard50Warning, message): AdminWidgetHook(self.extension, MyLegacyAdminWidget) self.assertIn(MyLegacyAdminWidget, admin_widgets_registry)
def test_register(self): """Testing AdminWidgetHook initializing""" AdminWidgetHook(extension=self.extension, widget_cls=TestWidget) self.assertIn(TestWidget, secondary_widgets)
def test_shutdown(self): """Testing AdminWidgetHook.shutdown""" hook = AdminWidgetHook(self.extension, MyAdminWidget) hook.disable_hook() self.assertNotIn(MyAdminWidget, admin_widgets_registry)
def test_initialize(self): """Testing AdminWidgetHook.initialize""" AdminWidgetHook(self.extension, MyAdminWidget) self.assertIn(MyAdminWidget, admin_widgets_registry)