diff MoinMoin/_tests/test_user.py @ 2006:1339d6fdc4ff

Changed tests to use py.test. Also changed the semantics a bit - the test wiki directory is only created freshly if it does not exist.
author Alexander Schremmer <alex AT alexanderweb DOT de>
date Fri, 20 Apr 2007 00:12:50 +0200
parents bb2e053067fb
children bd83616af43a
line wrap: on
line diff
--- a/MoinMoin/_tests/test_user.py	Thu Apr 19 12:55:07 2007 +0200
+++ b/MoinMoin/_tests/test_user.py	Fri Apr 20 00:12:50 2007 +0200
@@ -8,11 +8,13 @@
 
 import unittest, os
 
-from MoinMoin._tests import TestConfig, TestSkipped
+import py
+
 from MoinMoin import user, caching
 from MoinMoin.util import filesys
 
-class EncodePasswordTestCase(unittest.TestCase):
+
+class TestEncodePassword(unittest.TestCase):
     """user: encode passwords tests"""
 
     def testAscii(self):
@@ -35,7 +37,7 @@
                          'Expected "%(expected)s" but got "%(result)s"' % locals())
 
 
-class LoginWithPasswordTestCase(unittest.TestCase):
+class TestLoginWithPassword(unittest.TestCase):
     """user: login tests"""
 
     def setUp(self):
@@ -153,8 +155,7 @@
         # Validate that we are not modifying existing user data file!
         if self.user.exists():
             self.user = None
-            raise TestSkipped("Test user exists, will not override existing"
-                              " user data file!")
+            py.test.skip("Test user exists, will not override existing user data file!")
 
         # Save test user
         self.user.save()
@@ -162,14 +163,13 @@
         # Validate user creation
         if not self.user.exists():
             self.user = None
-            raise TestSkipped("Can't create test user")
+            py.test.skip("Can't create test user")
 
 
-class GroupNameTestCase(unittest.TestCase):
+class TestGroupName(unittest.TestCase):
 
     def setUp(self):
-        self.config = TestConfig(self.request,
-                                 page_group_regex=r'.+Group')
+        self.config = self.TestConfig(page_group_regex=r'.+Group')
 
     def tearDown(self):
         del self.config
@@ -187,7 +187,7 @@
                         'Expected "%(expected)s" but got "%(result)s"' % locals())
 
 
-class IsValidNameTestCase(unittest.TestCase):
+class TestIsValidName(unittest.TestCase):
 
     def testNonAlnumCharacters(self):
         """ user: isValidName: reject unicode non alpha numeric characters