diff MoinMoin/_tests/test_user.py @ 6028:1893da1d5213

userid lookup caches: use 1 on-disk cache file, update cache rather than rebuild Before this, we maintained one cache file per attribute (e.g. name2id, openid2id, ...) - the related code did multiple passes over all user profiles to rebuild these cache files. Now doing a one-pass rebuild, writing all attribute -> userid mappings into one on-disk cache file called "lookup". Additionally to "name" and "openids", support fast lookup for "email" and "jid" also. On profile save, we use to just kill the cache and let it rebuild. Now the cache is read, updated and written back (which is much less expensive for wikis with more than a few users). Did some refactoring also, reducing duplication, breaking down the code into smaller functions / methods.
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Wed, 12 Feb 2014 18:22:10 +0100
parents 05a6897ee496
children
line wrap: on
line diff
--- a/MoinMoin/_tests/test_user.py	Wed Feb 12 12:53:41 2014 +0100
+++ b/MoinMoin/_tests/test_user.py	Wed Feb 12 18:22:10 2014 +0100
@@ -78,7 +78,7 @@
         self.request.user = self.saved_user
 
         # Remove user lookup caches, or next test will fail
-        user.clearUserIdLookupCaches(self.request)
+        user.clearLookupCaches(self.request)
 
     def testAsciiPassword(self):
         """ user: login with ascii password """
@@ -241,8 +241,8 @@
         assert not theUser.isSubscribedTo([testPagename]) # list(!) of pages to check
 
     def testRenameUser(self):
-        """ create user and then rename user and check
-        if the old username is removed from the cache name2id
+        """ create user and then rename user and check whether
+        the old username is removed (and the lookup cache behaves well)
         """
         # Create test user
         name = u'__Some Name__'