[Zope3-checkins]
SVN: Zope3/branches/srichter-twisted-integration2/src/zope/app/twisted/ftp/tests/test_ftpserver.py
the test suite has being moved to our Twisted / Zope trial
test located in
Michael Kerrin
michael.kerrin at openapp.biz
Sat Oct 8 06:06:11 EDT 2005
Log message for revision 38929:
the test suite has being moved to our Twisted / Zope trial test located in
the 'test' directory.
Changed:
U Zope3/branches/srichter-twisted-integration2/src/zope/app/twisted/ftp/tests/test_ftpserver.py
-=-
Modified: Zope3/branches/srichter-twisted-integration2/src/zope/app/twisted/ftp/tests/test_ftpserver.py
===================================================================
--- Zope3/branches/srichter-twisted-integration2/src/zope/app/twisted/ftp/tests/test_ftpserver.py 2005-10-08 10:04:46 UTC (rev 38928)
+++ Zope3/branches/srichter-twisted-integration2/src/zope/app/twisted/ftp/tests/test_ftpserver.py 2005-10-08 10:06:11 UTC (rev 38929)
@@ -14,80 +14,12 @@
"""Test the FTP server.
"""
-import os
-from unittest import TestCase, TestSuite, main, makeSuite
+from unittest import TestSuite, main
-from twisted.cred import checkers, portal
-from twisted.internet import reactor, protocol
-from twisted.protocols import ftp
-from twisted.trial.util import wait
-
from zope.testing import doctest
-from zope.app.twisted.ftp.server import FTPFactory
-
-from test_publisher import RequestFactory
-import demofs
-
-class TestServerSetup(TestCase):
-
- def setUp(self):
- root = demofs.Directory()
- # the tuple has a user name is used by ZopeSimpleAuthentication to
- # authenticate users.
- root.grant(('root', 'root'), demofs.write)
- rootfs = demofs.DemoFileSystem(root, ('root', 'root'))
-
- self.factory = FTPFactory(request_factory = RequestFactory(rootfs))
- self.port = reactor.listenTCP(0, self.factory, interface="127.0.0.1")
-
- buildProtocol = self.factory.buildProtocol
- def _rememberProtocolInstance(addr):
- protocol = buildProtocol(addr)
- self.serverProtocol = protocol.wrappedProtocol
- return protocol
- self.factory.buildProtocol = _rememberProtocolInstance
-
- # Connect a client to it
- portNum = self.port.getHost().port
- clientCreator = protocol.ClientCreator(reactor, ftp.FTPClientBasic)
- self.client = wait(clientCreator.connectTCP("127.0.0.1", portNum))
-
- def tearDown(self):
- # Clean up sockets
- self.client.transport.loseConnection()
- d = self.port.stopListening()
- if d is not None:
- wait(d)
-
- del self.serverProtocol
-
- ## for some reason the threadpool isn't cleaning up.
- from twisted.internet import reactor
- if getattr(reactor, 'threadpool', None):
- reactor.threadpool.stop()
-
- def test_serverUp(self):
- # test if we can bring the server up and down.
- pass
-
- def _authLogin(self):
- # Reconfigure the server to disallow anonymous access.
- responseLines = wait(self.client.queueStringCommand('USER root'))
- self.assertEqual(['331 Password required for root.'], responseLines)
-
- responseLines = wait(self.client.queueStringCommand('PASS root'))
- self.assertEqual(['230 User logged in, proceed'], responseLines)
-
- def test_MKD(self):
- self._authLogin()
- responseLines = wait(self.client.queueStringCommand('MKD /newdir'))
- self.assertEqual(['257 "/newdir" created'], responseLines)
-
-
def test_suite():
return TestSuite((
- makeSuite(TestServerSetup),
doctest.DocTestSuite('zope.app.twisted.ftp.server'),
doctest.DocTestSuite('zope.app.twisted.ftp.utils'),
doctest.DocTestSuite('zope.app.twisted.ftp.sftpserver'),
More information about the Zope3-Checkins
mailing list