[Zodb-checkins] CVS: ZODB3/ZEO/tests - testAuth.py:1.1.2.4
Jeremy Hylton
jeremy at zope.com
Fri May 23 18:13:51 EDT 2003
Update of /cvs-repository/ZODB3/ZEO/tests
In directory cvs.zope.org:/tmp/cvs-serv10540/ZEO/tests
Modified Files:
Tag: ZODB3-auth-branch
testAuth.py
Log Message:
A little refactoring, still needs work.
Simplify getExtensionMethods() so that it doesn't need __getattr__().
Create ZEO.auth.base module that defines Client and Database. The
Client base class simplifies use of methods defined by the
protocol-specific storage class.
=== ZODB3/ZEO/tests/testAuth.py 1.1.2.3 => 1.1.2.4 ===
--- ZODB3/ZEO/tests/testAuth.py:1.1.2.3 Mon May 19 13:46:07 2003
+++ ZODB3/ZEO/tests/testAuth.py Fri May 23 17:13:20 2003
@@ -13,17 +13,15 @@
##############################################################################
"""Test suite for AuthZEO."""
-import glob
import os
import time
import unittest
from ThreadedAsync import LoopCallback
-from ZEO.auth.database import Database
-from ZEO.auth.auth_digest import DigestDatabase
from ZEO.ClientStorage import ClientStorage
from ZEO.StorageServer import StorageServer
from ZODB.FileStorage import FileStorage
+from ZODB.tests.StorageTestBase import removefs
storage = FileStorage('auth-test.fs')
@@ -32,6 +30,8 @@
class BaseTest(unittest.TestCase):
def createDB(self, name):
+ if os.path.exists(SOCKET):
+ os.remove(SOCKET)
if os.path.exists(name):
os.remove(self.database)
db = self.dbclass(name)
@@ -40,7 +40,8 @@
def setUp(self):
self.createDB(self.database)
- self.pid = os.fork()
+ # XXX needs to be fixed to work on Windows
+ self.pid = os.fork()
if not self.pid:
self.server = StorageServer(SOCKET, STORAGES,
auth_protocol=self.protocol,
@@ -51,11 +52,9 @@
os.kill(self.pid, 9)
os.remove(self.database)
os.remove(SOCKET)
-
- for file in glob.glob('auth-test.fs*'):
- os.remove(file)
+ removefs("auth-test.fs")
- def checkOK(self):
+ def testOK(self):
# Sleep for 0.2 seconds to give the server some time to start up
# seems to be needed before and after creating the storage
time.sleep(self.wait)
@@ -75,7 +74,7 @@
raise AssertionError, \
"authentication for %s failed" % self.protocol
- def checkNOK(self):
+ def testNOK(self):
time.sleep(self.wait)
cs = ClientStorage(SOCKET, wait=0, username='foo', password='noogie')
time.sleep(self.wait)
@@ -96,13 +95,14 @@
import ZEO.auth.auth_plaintext
protocol = 'plaintext'
database = 'authdb.sha'
- dbclass = Database
+ dbclass = ZEO.auth.auth_plaintext.Database
wait = 0.2
class SHAAuth(BaseTest):
+ import ZEO.auth.auth_sha
protocol = 'sha'
database = 'authdb.sha'
- dbclass = Database
+ dbclass = ZEO.auth.auth_sha.Database
wait = 0.5
##class SRPAuth(BaseTest):
@@ -112,9 +112,10 @@
## wait = 1.0
class DigestAuth(BaseTest):
+ import ZEO.auth.auth_digest
protocol = "digest"
database = "authdb.digest"
- dbclass = DigestDatabase
+ dbclass = ZEO.auth.auth_digest.DigestDatabase
wait = 0.5
test_classes = [PlainTextAuth, SHAAuth, DigestAuth]
@@ -122,7 +123,7 @@
def test_suite():
suite = unittest.TestSuite()
for klass in test_classes:
- sub = unittest.makeSuite(klass, 'check')
+ sub = unittest.makeSuite(klass)
suite.addTest(sub)
return suite
More information about the Zodb-checkins
mailing list