def test_run_action_runs_action_for_rule_class(self):
     rule_class = mock.Mock()
     site.register(rule_class)
     args = [mock.Mock()]
     kwargs = {'my_mock': mock.Mock()}
     validation_object = mock.Mock()
     try:
         rule = models.Rule(key=rule_class.key)
         rule.run_action(validation_object, *args, **kwargs)
         rule_class.assert_called_once_with(rule, validation_object)
         rule_class.return_value.run.assert_called_once_with(*args, **kwargs)
     finally:
         site.unregister(rule_class)
 def setUp(self):
     self._original_registry = site._registry.copy()
     site._registry = {}
     site.register(RuleOne)
     site.register(RuleTwo)