Among the last few failures in our in-tree tests is the last test case of test_install/test_updates.py method:
test_install/test_updates.py
===================================================== FAILURES ===================================================== ____________________________________________ test_update.test_from_dict ____________________________________________ self = <ipatests.test_install.test_updates.test_update testMethod=test_from_dict> def test_from_dict(self): """ Test updating from a dict. This replicates what was done in test 1. """ # First make sure we're clean with self.assertRaises(errors.NotFound): entries = self.ld.get_entries( self.container_dn, self.ld.SCOPE_BASE, 'objectclass=*', ['*']) with self.assertRaises(errors.NotFound): entries = self.ld.get_entries( self.user_dn, self.ld.SCOPE_BASE, 'objectclass=*', ['*']) update = { self.container_dn: {'dn': self.container_dn, 'updates': ['add:objectClass: top', 'add:objectClass: nsContainer', 'add:cn: test' ], }, self.user_dn: {'dn': self.user_dn, 'updates': ['add:objectclass: top', 'add:objectclass: person', 'add:objectclass: posixaccount', 'add:objectclass: krbprincipalaux', 'add:objectclass: inetuser', 'add:homedirectory: /home/tuser', 'add:loginshell: /bin/bash', 'add:sn: User', 'add:uid: tuser', 'add:uidnumber: 999', 'add:gidnumber: 999', 'add:cn: Test User', ], }, } > modified = self.updater.update_from_dict(update) test_install/test_updates.py:300: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../ipaserver/install/ldapupdate.py:932: in update_from_dict self._run_updates(updates) ../ipaserver/install/ldapupdate.py:886: in _run_updates if 'deleteentry' in update: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = ipapython.dn.DN('uid=tuser,cn=test,cn=accounts,dc=ipa,dc=test'), other = 'deleteentry' def __contains__(self, other): 'Return the outcome of the test other in self. Note the reversed operands.' if isinstance(other, RDN): other = DN(other) if isinstance(other, DN): other_len = len(other) end = len(self) - other_len i = 0 while i <= end: result = self._cmp_sequence(other, i, other_len) if result == 0: return True i += 1 return False else: > raise TypeError("expected DN or RDN but got %s" % (other.__class__.__name__)) E TypeError: expected DN or RDN but got str ../ipapython/dn.py:1324: TypeError ======================================= 1 failed, 11 passed in 13.60 seconds =======================================
This error arises from the flawed logic of update_from_dict method, which passes the dictionary to the internal _run_updates method which, however expects a list of dicts and blows up.
update_from_dict
_run_updates
However, upon grepping the usage of this method it became apparent that it is not used in any production code, only in tests:
$ git grep -ni update_from_dict ipaserver/install/ldapupdate.py:924: def update_from_dict(self, updates): ipatests/test_install/test_updates.py:300: modified = self.updater.update_from_dict(update) ipatests/test_install/test_updates.py:341: modified = self.updater.update_from_dict(update)
Given this fact it would be probably more efficient to just remove it and associated tests unless there is some special need for it.
ipa-4-4:
ipa-4-3:
Metadata Update from @mbabinsk: - Issue assigned to stlaz - Issue set to the milestone: FreeIPA 4.3.3
Log in to comment on this ticket.