From 759734864e72c209d62c970d2e325e96ae02fcb7 Mon Sep 17 00:00:00 2001 From: Jason Gerard DeRose Date: Fri, 24 Oct 2008 20:21:27 -0600 Subject: Finished Env._finalize() and corresponding unit tests --- tests/test_ipalib/test_config.py | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/test_ipalib/test_config.py b/tests/test_ipalib/test_config.py index b4c86319f..6136bdf0b 100644 --- a/tests/test_ipalib/test_config.py +++ b/tests/test_ipalib/test_config.py @@ -170,8 +170,8 @@ key3 = var3 config_good = """ [global] -yes = TRUE -no = False +yes = tRUE +no = fALse number = 42 """ @@ -357,6 +357,25 @@ class test_Env(ClassChecker): e = raises(StandardError, o._finalize) assert str(e) == 'Env._finalize() already called' + # Check that _finalize() calls __lock__() + (o, home) = self.new() + assert o.__islocked__() is False + o._finalize() + assert o.__islocked__() is True + e = raises(StandardError, o.__lock__) + assert str(e) == 'Env.__lock__() already called' + + # Check that **lastchance works + (o, home) = self.finalize_core() + key = 'just_one_more_key' + value = 'with one more value' + lastchance = {key: value} + assert key not in o + assert o._isdone('_finalize') is False + o._finalize(**lastchance) + assert key in o + assert o[key] is value + def test_merge_config(self): """ Test the `ipalib.config.Env._merge_config` method. -- cgit