Also fixes a few issues in the unit tests. All of them now run successfully.
https://fedorahosted.org/freeipa/ticket/1959 Honza -- Jan Cholasta
>From 00b9d0c2ecf1246a4021112e8b2451c3bd1ce595 Mon Sep 17 00:00:00 2001 From: Jan Cholasta <[email protected]> Date: Thu, 13 Oct 2011 04:47:43 -0400 Subject: [PATCH] Fix attempted write to attribute of read-only object. Also fix few issues in the unit tests to enable them all to succeed. ticket 1959 --- ipalib/dn.py | 2 +- ipaserver/plugins/dogtag.py | 11 +++-------- tests/test_ipaserver/test_ldap.py | 10 +++++++++- tests/test_xmlrpc/test_group_plugin.py | 4 ++++ 4 files changed, 17 insertions(+), 10 deletions(-) diff --git a/ipalib/dn.py b/ipalib/dn.py index dc3119d..6f2f7de 100644 --- a/ipalib/dn.py +++ b/ipalib/dn.py @@ -1092,7 +1092,7 @@ class DN(object): return rdns elif isinstance(value, (tuple, list)): if len(value) != 2: - raise ValueError("tuple or list must be 2-valued, not \"%s\"" % (rdn)) + raise ValueError("tuple or list must be 2-valued, not \"%s\"" % (value)) rdn = RDN(value, first_key_match=self.first_key_match) return rdn else: diff --git a/ipaserver/plugins/dogtag.py b/ipaserver/plugins/dogtag.py index 23d06ab..8702955 100644 --- a/ipaserver/plugins/dogtag.py +++ b/ipaserver/plugins/dogtag.py @@ -1218,7 +1218,7 @@ class ra(rabase.rabase): self.ipa_key_size = "2048" self.ipa_certificate_nickname = "ipaCert" self.ca_certificate_nickname = "caCert" - self.ca_host = None + self.ca_host = self._select_ca() try: f = open(self.pwd_file, "r") self.password = f.readline().strip() @@ -1293,9 +1293,7 @@ class ra(rabase.rabase): Perform an HTTP request. """ - if self.ca_host == None: - self.ca_host = self._select_ca() - return dogtag.http_request(self.ca_host, port, url, **kw) + return dogtag.http_request(self.ca_host or self._select_ca(), port, url, **kw) def _sslget(self, url, port, **kw): """ @@ -1306,10 +1304,7 @@ class ra(rabase.rabase): Perform an HTTPS request """ - - if self.ca_host == None: - self.ca_host = self._select_ca() - return dogtag.https_request(self.ca_host, port, url, self.sec_dir, self.password, self.ipa_certificate_nickname, **kw) + return dogtag.https_request(self.ca_host or self._select_ca(), port, url, self.sec_dir, self.password, self.ipa_certificate_nickname, **kw) def get_parse_result_xml(self, xml_text, parse_func): ''' diff --git a/tests/test_ipaserver/test_ldap.py b/tests/test_ipaserver/test_ldap.py index b3f8009..7f63b94 100644 --- a/tests/test_ipaserver/test_ldap.py +++ b/tests/test_ipaserver/test_ldap.py @@ -112,7 +112,15 @@ class test_ldap(object): myapi.register(service) myapi.register(service_show) myapi.finalize() - myapi.Backend.ldap2.connect(bind_dn="cn=Directory Manager", bind_pw='password') + + pwfile = api.env.dot_ipa + os.sep + ".dmpw" + if ipautil.file_exists(pwfile): + fp = open(pwfile, "r") + dm_password = fp.read().rstrip() + fp.close() + else: + raise nose.SkipTest("No directory manager password in %s" % pwfile) + myapi.Backend.ldap2.connect(bind_dn="cn=Directory Manager", bind_pw=dm_password) result = myapi.Command['service_show']('ldap/%s@%s' % (api.env.host, api.env.realm,)) entry_attrs = result['result'] diff --git a/tests/test_xmlrpc/test_group_plugin.py b/tests/test_xmlrpc/test_group_plugin.py index 6403251..86c0d90 100644 --- a/tests/test_xmlrpc/test_group_plugin.py +++ b/tests/test_xmlrpc/test_group_plugin.py @@ -755,6 +755,10 @@ class test_group(Declarative): dn=lambda x: DN(x) == \ DN(('uid','tuser1'),('cn','users'),('cn','accounts'), api.env.basedn), + krbpwdpolicyreference=lambda x: [DN(i) for i in x] == \ + [DN(('cn','global_policy'),('cn',api.env.realm), + ('cn','kerberos'),api.env.basedn)], + memberof_group=[u'ipausers'], has_keytab=False, has_password=False, ), -- 1.7.6.4
_______________________________________________ Freeipa-devel mailing list [email protected] https://www.redhat.com/mailman/listinfo/freeipa-devel
