Dne 13.10.2011 17:36, Rob Crittenden napsal(a):
Jan Cholasta wrote:
Also fixes a few issues in the unit tests. All of them now run
successfully.
https://fedorahosted.org/freeipa/ticket/1959
Honza
I think it would be better to use:
object.__setattr__(self, 'ca_host', self._select_ca())
This will cache the value of a known CA host.
rob
That's ugly!
Here you are anyway.
Honza
--
Jan Cholasta
>From 5b05071f82f2fac4ad1f6996cfba8622fc5ba873 Mon Sep 17 00:00:00 2001
From: Jan Cholasta <jchol...@redhat.com>
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 | 8 ++++----
tests/test_ipaserver/test_ldap.py | 10 +++++++++-
tests/test_xmlrpc/test_group_plugin.py | 4 ++++
4 files changed, 18 insertions(+), 6 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..5b1a210 100644
--- a/ipaserver/plugins/dogtag.py
+++ b/ipaserver/plugins/dogtag.py
@@ -1293,8 +1293,8 @@ class ra(rabase.rabase):
Perform an HTTP request.
"""
- if self.ca_host == None:
- self.ca_host = self._select_ca()
+ if self.ca_host is None:
+ object.__setattr__(self, 'ca_host', self._select_ca())
return dogtag.http_request(self.ca_host, port, url, **kw)
def _sslget(self, url, port, **kw):
@@ -1307,8 +1307,8 @@ class ra(rabase.rabase):
Perform an HTTPS request
"""
- if self.ca_host == None:
- self.ca_host = self._select_ca()
+ if self.ca_host is None:
+ object.__setattr__(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)
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.7
_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel