From bb9691099b7b025fc491279314d8803f4fa3b571 Mon Sep 17 00:00:00 2001 From: Jason Gerard DeRose Date: Mon, 27 Oct 2008 15:36:41 -0600 Subject: [PATCH] API.bootstrap() now calls Env._finalize_core(); updated unit tests --- ipalib/plugable.py | 1 + tests/test_ipalib/test_cli.py | 2 ++ tests/test_ipalib/test_plugable.py | 14 ++++++++++++-- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/ipalib/plugable.py b/ipalib/plugable.py index f704077a2..6fe224299 100644 --- a/ipalib/plugable.py +++ b/ipalib/plugable.py @@ -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): """ diff --git a/tests/test_ipalib/test_cli.py b/tests/test_ipalib/test_cli.py index 293371b79..399592704 100644 --- a/tests/test_ipalib/test_cli.py +++ b/tests/test_ipalib/test_cli.py @@ -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) diff --git a/tests/test_ipalib/test_plugable.py b/tests/test_ipalib/test_plugable.py index ba98e752a..50cab9301 100644 --- a/tests/test_ipalib/test_plugable.py +++ b/tests/test_ipalib/test_plugable.py @@ -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'