URL: https://github.com/freeipa/freeipa/pull/512 Author: tomaskrizek Title: #512: test_config: fix fips_mode key in Env Action: opened
PR body: """ Setting fips_mode to object would fail if ipaplatform.tasks module wasn't present. https://fedorahosted.org/freeipa/ticket/5695 """ To pull the PR as Git branch: git remote add ghfreeipa https://github.com/freeipa/freeipa git fetch ghfreeipa pull/512/head:pr512 git checkout pr512
From 061abe15344d91de35545d7df60d9cdcccec8915 Mon Sep 17 00:00:00 2001 From: Tomas Krizek <tkri...@redhat.com> Date: Mon, 27 Feb 2017 13:08:36 +0100 Subject: [PATCH 1/2] Env __setitem__: replace assert with exception Use exception to make debugging issues easier. --- ipalib/config.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ipalib/config.py b/ipalib/config.py index 388ffe8..1e31c85 100644 --- a/ipalib/config.py +++ b/ipalib/config.py @@ -268,7 +268,8 @@ def __setitem__(self, key, value): value = int(value) elif key == 'basedn': value = DN(value) - assert type(value) in (unicode, int, float, bool, type(None), DN) + if type(value) not in (unicode, int, float, bool, type(None), DN): + raise TypeError(key, value) object.__setattr__(self, key, value) self.__d[key] = value From a02d1567ec9d2777fd96632f5c354b0819b59212 Mon Sep 17 00:00:00 2001 From: Tomas Krizek <tkri...@redhat.com> Date: Mon, 27 Feb 2017 13:17:17 +0100 Subject: [PATCH 2/2] test_config: fix fips_mode key in Env Setting fips_mode to object would fail if ipaplatform.tasks module wasn't present. https://fedorahosted.org/freeipa/ticket/5695 --- ipatests/test_ipalib/test_config.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ipatests/test_ipalib/test_config.py b/ipatests/test_ipalib/test_config.py index 53b60ef..00ab1d5 100644 --- a/ipatests/test_ipalib/test_config.py +++ b/ipatests/test_ipalib/test_config.py @@ -562,9 +562,9 @@ def test_finalize_core(self): # Test using DEFAULT_CONFIG: defaults = dict(constants.DEFAULT_CONFIG) - defaults['fips_mode'] = object (o, home) = self.finalize_core(None, **defaults) - assert list(o) == sorted(defaults) + list_o = [(key, value) for key, value in o if key != 'fips_mode'] + assert list_o == sorted(defaults) for (key, value) in defaults.items(): if value is object: continue
-- Manage your subscription for the Freeipa-devel mailing list: https://www.redhat.com/mailman/listinfo/freeipa-devel Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code