diff MoinMoin/_tests/test_user.py @ 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 ff428fa12e3c
children 01f05e74aa9c
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'):