API.bootstrap() now calls Env._finalize_core(); updated unit tests

This commit is contained in:
Jason Gerard DeRose 2008-10-27 15:36:41 -06:00
parent e6254026fe
commit bb9691099b
3 changed files with 15 additions and 2 deletions

View File

@ -737,6 +737,7 @@ class API(DictProxy):
"""
self.__doing('bootstrap')
self.env._bootstrap(**overrides)
self.env._finalize_core(**dict(constants.DEFAULT_CONFIG))
def load_plugins(self, dry_run=False):
"""

View File

@ -149,9 +149,11 @@ class test_CLI(ClassChecker):
"""
(o, api, home) = self.new()
keys = tuple(api.env)
assert api.isdone('bootstrap') is False
assert o.isdone('parse_globals') is False
assert o.isdone('bootstrap') is False
o.bootstrap()
assert api.isdone('bootstrap') is True
assert o.isdone('parse_globals') is True
assert o.isdone('bootstrap') is True
e = raises(StandardError, o.bootstrap)

View File

@ -23,7 +23,7 @@ Test the `ipalib.plugable` module.
from tests.util import raises, no_set, no_del, read_only
from tests.util import getitem, setitem, delitem
from tests.util import ClassChecker
from tests.util import ClassChecker, TempHome
from ipalib import plugable, errors
@ -771,6 +771,12 @@ class test_API(ClassChecker):
_cls = plugable.API
def new(self, *bases):
home = TempHome()
api = self.cls(*bases)
api.env.in_tree = True
return (api, home)
def test_API(self):
"""
Test the `ipalib.plugable.API` class.
@ -877,10 +883,14 @@ class test_API(ClassChecker):
"""
Test the `ipalib.plugable.API.bootstrap` method.
"""
o = self.cls()
(o, home) = self.new()
assert o.env._isdone('_bootstrap') is False
assert o.env._isdone('_finalize_core') is False
assert o.isdone('bootstrap') is False
o.bootstrap()
assert o.isdone('bootstrap') is True
assert o.env._isdone('_bootstrap') is True
assert o.env._isdone('_finalize_core') is True
e = raises(StandardError, o.bootstrap)
assert str(e) == 'API.bootstrap() already called'