changeset 2038:bd83616af43a

test_user: tests for subscription of pages and subpages
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Sun, 20 May 2007 20:01:26 +0200
parents a63c473a100d
children ca376b20b122
files MoinMoin/_tests/test_user.py
diffstat 1 files changed, 29 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/_tests/test_user.py	Sat May 05 15:26:15 2007 +0200
+++ b/MoinMoin/_tests/test_user.py	Sun May 20 20:01:26 2007 +0200
@@ -136,7 +136,36 @@
         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'
+        name = u'__Jürgen Herman__'
+        password = name
+        self.createUser(name, password, charset='iso-8859-1')
+        # Login - this should replace the old password in the user file
+        theUser = user.User(self.request, name=name, password=password)
+        theUser.subscribe(pagename)
+        expected = True
+        result = theUser.isSubscribedTo(pagename)
+        self.assertEqual(result, expected,
+                 'Expected "%(expected)s" but got "%(result)s"' % locals())
 
+    def testSubscriptionSubPage(self):
+        """ user: tests isSubscribedTo on a subpage """
+        pagename = u'HelpMiscellaneous'
+        testPagename = u'HelpMiscellaneous/FrequentlyAskedQuestions'
+        name = u'__Jürgen Herman__'
+        password = name
+        self.createUser(name, password, charset='iso-8859-1')
+        # Login - this should replace the old password in the user file
+        theUser = user.User(self.request, name=name, password=password)
+        theUser.subscribe(pagename)
+        expected = False
+        result = theUser.isSubscribedTo(testPagename)
+        self.assertEqual(result, expected,
+                 'Expected "%(expected)s" but got "%(result)s"' % locals())
+        
     # Helpers ---------------------------------------------------------
 
     def createUser(self, name, password, charset='utf-8'):