def test_unregister_actions_with_child_action(self): """Testing unregister_actions with child action""" menu_action = TopLevelMenuAction([FooAction()]) self.assertEqual(len(menu_action.child_actions), 1) unregister_actions([FooAction.action_id]) self.assertEqual(len(menu_action.child_actions), 0)
def test_unregister_actions_with_max_depth(self): """Testing unregister_actions with max_depth""" actions = self.make_nested_actions(MAX_DEPTH_LIMIT + 1) unregister_actions([actions[0].action_id]) extra_action = BarAction(str(len(actions)), [actions[-1]]) extra_action.register() self.assertEquals(extra_action.max_depth, MAX_DEPTH_LIMIT)
def test_unregister_actions_with_child_action(self): """Testing unregister_actions with child action""" menu_action = TopLevelMenuAction([ FooAction() ]) self.assertEqual(len(menu_action.child_actions), 1) unregister_actions([FooAction.action_id]) self.assertEqual(len(menu_action.child_actions), 0)
def test_unregister_actions_with_unregistered_action(self): """Testing unregister_actions with unregistered action""" foo_action = FooAction() error_message = ( '%s does not correspond to a registered review request action' % foo_action.action_id) with self.assertRaisesMessage(KeyError, error_message): unregister_actions([foo_action.action_id])
def test_unregister_actions_with_unregistered_action(self): """Testing unregister_actions with unregistered action""" foo_action = FooAction() error_message = ( '%s does not correspond to a registered review request action' % foo_action.action_id ) with self.assertRaisesMessage(KeyError, error_message): unregister_actions([foo_action.action_id])
def test_unregister_actions(self): """Testing unregister_actions""" orig_action_ids = { action.action_id for action in get_top_level_actions() } self.assertIn('update-review-request-action', orig_action_ids) self.assertIn('review-action', orig_action_ids) unregister_actions(['update-review-request-action', 'review-action']) new_action_ids = { action.action_id for action in get_top_level_actions() } self.assertEqual(len(orig_action_ids), len(new_action_ids) + 2) self.assertNotIn('update-review-request-action', new_action_ids) self.assertNotIn('review-action', new_action_ids)