mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
API.load_plugins() no longer takes dry_run=False kwarg and instead checks in env.mode == 'unit_test' to decide whether to load the plugins; it also only loads ipa_server.plugins in env.in_server is True
This commit is contained in:
@@ -245,7 +245,7 @@ class CLI(object):
|
|||||||
"""
|
"""
|
||||||
self.__doing('run')
|
self.__doing('run')
|
||||||
self.finalize()
|
self.finalize()
|
||||||
if self.api.env.mode == 'unit-test':
|
if self.api.env.mode == 'unit_test':
|
||||||
return
|
return
|
||||||
if len(self.cmd_argv) < 1:
|
if len(self.cmd_argv) < 1:
|
||||||
self.print_commands()
|
self.print_commands()
|
||||||
|
|||||||
@@ -739,7 +739,7 @@ class API(DictProxy):
|
|||||||
self.env._bootstrap(**overrides)
|
self.env._bootstrap(**overrides)
|
||||||
self.env._finalize_core(**dict(constants.DEFAULT_CONFIG))
|
self.env._finalize_core(**dict(constants.DEFAULT_CONFIG))
|
||||||
|
|
||||||
def load_plugins(self, dry_run=False):
|
def load_plugins(self):
|
||||||
"""
|
"""
|
||||||
Load plugins from all standard locations.
|
Load plugins from all standard locations.
|
||||||
|
|
||||||
@@ -748,10 +748,11 @@ class API(DictProxy):
|
|||||||
"""
|
"""
|
||||||
self.__doing('load_plugins')
|
self.__doing('load_plugins')
|
||||||
self.__do_if_not_done('bootstrap')
|
self.__do_if_not_done('bootstrap')
|
||||||
if dry_run:
|
if self.env.mode == 'unit_test':
|
||||||
return
|
return
|
||||||
util.import_plugins_subpackage('ipalib')
|
util.import_plugins_subpackage('ipalib')
|
||||||
util.import_plugins_subpackage('ipa_server')
|
if self.env.in_server:
|
||||||
|
util.import_plugins_subpackage('ipa_server')
|
||||||
|
|
||||||
def finalize(self):
|
def finalize(self):
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ class test_CLI(ClassChecker):
|
|||||||
frontend.Application,
|
frontend.Application,
|
||||||
backend.Backend,
|
backend.Backend,
|
||||||
)
|
)
|
||||||
api.env.mode = 'unit-test'
|
api.env.mode = 'unit_test'
|
||||||
api.env.in_tree = True
|
api.env.in_tree = True
|
||||||
o = self.cls(api, argv)
|
o = self.cls(api, argv)
|
||||||
assert o.api is api
|
assert o.api is api
|
||||||
|
|||||||
@@ -774,6 +774,7 @@ class test_API(ClassChecker):
|
|||||||
def new(self, *bases):
|
def new(self, *bases):
|
||||||
home = TempHome()
|
home = TempHome()
|
||||||
api = self.cls(*bases)
|
api = self.cls(*bases)
|
||||||
|
api.env.mode = 'unit_test'
|
||||||
api.env.in_tree = True
|
api.env.in_tree = True
|
||||||
return (api, home)
|
return (api, home)
|
||||||
|
|
||||||
@@ -899,10 +900,10 @@ class test_API(ClassChecker):
|
|||||||
"""
|
"""
|
||||||
Test the `ipalib.plugable.API.load_plugins` method.
|
Test the `ipalib.plugable.API.load_plugins` method.
|
||||||
"""
|
"""
|
||||||
o = self.cls()
|
(o, home) = self.new()
|
||||||
assert o.isdone('bootstrap') is False
|
assert o.isdone('bootstrap') is False
|
||||||
assert o.isdone('load_plugins') is False
|
assert o.isdone('load_plugins') is False
|
||||||
o.load_plugins(dry_run=True)
|
o.load_plugins()
|
||||||
assert o.isdone('bootstrap') is True
|
assert o.isdone('bootstrap') is True
|
||||||
assert o.isdone('load_plugins') is True
|
assert o.isdone('load_plugins') is True
|
||||||
e = raises(StandardError, o.load_plugins)
|
e = raises(StandardError, o.load_plugins)
|
||||||
|
|||||||
Reference in New Issue
Block a user