summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ipalib/backend.py8
-rw-r--r--tests/test_ipalib/test_backend.py14
2 files changed, 18 insertions, 4 deletions
diff --git a/ipalib/backend.py b/ipalib/backend.py
index 22aa128b3..1902929aa 100644
--- a/ipalib/backend.py
+++ b/ipalib/backend.py
@@ -102,12 +102,12 @@ class Executioner(Backend):
else:
self.Backend.xmlclient.connect()
- def execute(self, name, *args, **options):
+ def execute(self, _name, *args, **options):
error = None
try:
- if name not in self.Command:
- raise CommandError(name=name)
- result = self.Command[name](*args, **options)
+ if _name not in self.Command:
+ raise CommandError(name=_name)
+ result = self.Command[_name](*args, **options)
except PublicError, e:
error = e
except StandardError, e:
diff --git a/tests/test_ipalib/test_backend.py b/tests/test_ipalib/test_backend.py
index 30928532b..798e93de8 100644
--- a/tests/test_ipalib/test_backend.py
+++ b/tests/test_ipalib/test_backend.py
@@ -192,6 +192,15 @@ class test_Executioner(ClassChecker):
raise ValueError('This is private.')
api.register(bad)
+ class with_name(Command):
+ """
+ Test that a kwarg named 'name' can be used.
+ """
+ takes_options=['name']
+ def execute(self, **options):
+ return options['name'].upper()
+ api.register(with_name)
+
api.finalize()
o = self.cls()
o.set_api(api)
@@ -238,3 +247,8 @@ class test_Executioner(ClassChecker):
e = raises(errors2.InternalError, o.execute, 'bad')
assert conn.disconnect.called is True # Make sure destroy_context() was called
assert context.__dict__.keys() == []
+
+ # Test with option 'name':
+ conn = Connection('The connection.', Disconnect())
+ context.someconn = conn
+ assert o.execute('with_name', name=u'test') == u'TEST'