changeset 2165:eed1c7da25eb

test_user: fix wrong subscription tests and a few other problems
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Tue, 19 Jun 2007 01:31:26 +0200
parents 7fed5edaa2a5
children a3a19bdc0b9a
files MoinMoin/_tests/test_user.py MoinMoin/user.py
diffstat 2 files changed, 11 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/_tests/test_user.py	Mon Jun 18 22:31:50 2007 +0200
+++ b/MoinMoin/_tests/test_user.py	Tue Jun 19 01:31:26 2007 +0200
@@ -51,6 +51,7 @@
 
         # Prevent user list caching - we create and delete users too fast for that.
         filesys.dcdisable()
+        self.user = None
 
     def tearDown(self):
         """ Run after each test
@@ -72,7 +73,10 @@
 
         # Remove user name to id cache, or next test will fail
         caching.CacheEntry(self.request, 'user', 'name2id', scope='wiki').remove()
-        del self.request.cfg.cache.name2id
+        try:
+            del self.request.cfg.cache.name2id
+        except:
+            pass
 
         # Prevent user list caching - we create and delete users too fast for that.
         filesys.dcdisable()
@@ -136,7 +140,7 @@
         theUser = user.User(self.request, name=name, password=password)
         self.assertEqual(theUser.enc_password, expected,
                          "User password was not replaced with new")
-        
+
     def testSubscriptionSubscribedPage(self):
         """ user: tests isSubscribedTo  """
         pagename = u'HelpMiscellaneous'
@@ -147,7 +151,7 @@
         theUser = user.User(self.request, name=name, password=password)
         theUser.subscribe(pagename)
         expected = True
-        result = theUser.isSubscribedTo(pagename)
+        result = theUser.isSubscribedTo([pagename]) # list(!) of pages to check
         self.assertEqual(result, expected,
                  'Expected "%(expected)s" but got "%(result)s"' % locals())
 
@@ -162,10 +166,10 @@
         theUser = user.User(self.request, name=name, password=password)
         theUser.subscribe(pagename)
         expected = False
-        result = theUser.isSubscribedTo(testPagename)
+        result = theUser.isSubscribedTo([testPagename]) # list(!) of pages to check
         self.assertEqual(result, expected,
                  'Expected "%(expected)s" but got "%(result)s"' % locals())
-        
+
     # Helpers ---------------------------------------------------------
 
     def createUser(self, name, password, charset='utf-8'):
--- a/MoinMoin/user.py	Mon Jun 18 22:31:50 2007 +0200
+++ b/MoinMoin/user.py	Tue Jun 19 01:31:26 2007 +0200
@@ -695,8 +695,8 @@
         The subscription list may contain page names or interwiki page
         names. e.g 'Page Name' or 'WikiName:Page_Name'
         
-        TODO: check if its fast enough when calling with many users
-        from page.getSubscribersList()
+        TODO: check if it's fast enough when getting called for many
+              users from page.getSubscribersList()
         
         @param pagelist: list of pages to check for subscription
         @rtype: bool