-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
r26454 | srichter | 2004-07-13 12:28:46 -0400 (Tue, 13 Jul 2004) | 2 lines r26455 | srichter | 2004-07-13 12:32:34 -0400 (Tue, 13 Jul 2004) | 3 lines r26456 | srichter | 2004-07-13 12:33:41 -0400 (Tue, 13 Jul 2004) | 3 lines r26457 | srichter | 2004-07-13 12:34:28 -0400 (Tue, 13 Jul 2004) | 2 lines r26458 | srichter | 2004-07-13 12:37:35 -0400 (Tue, 13 Jul 2004) | 2 lines r26459 | srichter | 2004-07-13 12:39:48 -0400 (Tue, 13 Jul 2004) | 2 lines r26460 | srichter | 2004-07-13 12:40:26 -0400 (Tue, 13 Jul 2004) | 4 lines r26461 | srichter | 2004-07-13 12:41:08 -0400 (Tue, 13 Jul 2004) | 2 lines r26462 | srichter | 2004-07-13 12:44:02 -0400 (Tue, 13 Jul 2004) | 2 lines r26463 | srichter | 2004-07-13 12:46:02 -0400 (Tue, 13 Jul 2004) | 2 lines r26464 | srichter | 2004-07-13 12:48:13 -0400 (Tue, 13 Jul 2004) | 2 lines r26465 | srichter | 2004-07-13 12:48:44 -0400 (Tue, 13 Jul 2004) | 4 lines r26466 | srichter | 2004-07-13 12:49:20 -0400 (Tue, 13 Jul 2004) | 2 lines r26467 | srichter | 2004-07-13 12:49:41 -0400 (Tue, 13 Jul 2004) | 2 lines r26468 | srichter | 2004-07-13 12:51:32 -0400 (Tue, 13 Jul 2004) | 2 lines r26469 | srichter | 2004-07-13 12:52:22 -0400 (Tue, 13 Jul 2004) | 2 lines r26470 | srichter | 2004-07-13 12:53:32 -0400 (Tue, 13 Jul 2004) | 2 lines r26471 | srichter | 2004-07-13 12:55:23 -0400 (Tue, 13 Jul 2004) | 2 lines r26472 | srichter | 2004-07-13 12:56:24 -0400 (Tue, 13 Jul 2004) | 2 lines r26473 | srichter | 2004-07-13 12:56:45 -0400 (Tue, 13 Jul 2004) | 2 lines r26474 | srichter | 2004-07-13 12:57:36 -0400 (Tue, 13 Jul 2004) | 2 lines r26475 | srichter | 2004-07-13 12:57:58 -0400 (Tue, 13 Jul 2004) | 2 lines r26476 | srichter | 2004-07-13 12:59:11 -0400 (Tue, 13 Jul 2004) | 2 lines r26477 | srichter | 2004-07-13 13:00:04 -0400 (Tue, 13 Jul 2004) | 4 lines r26478 | srichter | 2004-07-13 13:00:36 -0400 (Tue, 13 Jul 2004) | 2 lines r26479 | srichter | 2004-07-13 13:01:19 -0400 (Tue, 13 Jul 2004) | 2 lines
- Loading branch information
Showing
9 changed files
with
1,021 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
############################################################################## | ||
# | ||
# Copyright (c) 2003 Zope Corporation and Contributors. | ||
# All Rights Reserved. | ||
# | ||
# This software is subject to the provisions of the Zope Public License, | ||
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. | ||
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED | ||
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS | ||
# FOR A PARTICULAR PURPOSE. | ||
# | ||
############################################################################## | ||
"""Test the Demo Filesystem implementation. | ||
$Id$ | ||
""" | ||
import demofs | ||
from unittest import TestCase, TestSuite, main, makeSuite | ||
from fstests import FileSystemTests | ||
from StringIO import StringIO | ||
|
||
class Test(FileSystemTests, TestCase): | ||
|
||
def setUp(self): | ||
root = demofs.Directory() | ||
root.grant('bob', demofs.write) | ||
fs = self.filesystem = demofs.DemoFileSystem(root, 'bob') | ||
fs.mkdir(self.dir_name) | ||
fs.writefile(self.file_name, StringIO(self.file_contents)) | ||
fs.writefile(self.unwritable_filename, StringIO("save this")) | ||
fs.get(self.unwritable_filename).revoke('bob', demofs.write) | ||
|
||
def test_suite(): | ||
return TestSuite(( | ||
makeSuite(Test), | ||
)) | ||
|
||
if __name__=='__main__': | ||
main(defaultTest='test_suite') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
############################################################################## | ||
# | ||
# Copyright (c) 2003 Zope Corporation and Contributors. | ||
# All Rights Reserved. | ||
# | ||
# This software is subject to the provisions of the Zope Public License, | ||
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. | ||
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED | ||
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS | ||
# FOR A PARTICULAR PURPOSE. | ||
# | ||
############################################################################## | ||
"""Test the FTP publisher. | ||
$Id$ | ||
""" | ||
import demofs | ||
from unittest import TestCase, TestSuite, main, makeSuite | ||
from fstests import FileSystemTests | ||
from StringIO import StringIO | ||
from zope.publisher.publish import mapply | ||
from zope.server.ftp.publisher import PublisherFileSystem | ||
|
||
class DemoFileSystem(demofs.DemoFileSystem): | ||
|
||
def rename(self, path, old, new): | ||
return demofs.DemoFileSystem.rename( | ||
self, "%s/%s" % (path, old), "%s/%s" % (path, new)) | ||
|
||
class Publication: | ||
|
||
def __init__(self, root): | ||
self.root = root | ||
|
||
def beforeTraversal(self, request): | ||
pass | ||
|
||
def getApplication(self, request): | ||
return self.root | ||
|
||
def afterTraversal(self, request, ob): | ||
pass | ||
|
||
def callObject(self, request, ob): | ||
command = getattr(ob, request.env['command']) | ||
if 'name' in request.env: | ||
request.env['path'] += "/" + request.env['name'] | ||
return mapply(command, request = request.env) | ||
|
||
def afterCall(self, request, ob): | ||
pass | ||
|
||
def endRequest(self, request, ob): | ||
pass | ||
|
||
def handleException(self, object, request, info, retry_allowed=True): | ||
request.response._exc = info[:2] | ||
|
||
|
||
class Request: | ||
|
||
def __init__(self, input, output, env): | ||
self.env = env | ||
self.response = Response() | ||
self.user = env['credentials'] | ||
del env['credentials'] | ||
|
||
def processInputs(self): | ||
pass | ||
|
||
def traverse(self, root): | ||
root.user = self.user | ||
return root | ||
|
||
def close(self): | ||
pass | ||
|
||
class Response: | ||
|
||
_exc = _body = None | ||
|
||
def setBody(self, result): | ||
self._body = result | ||
|
||
def outputBody(self): | ||
pass | ||
|
||
def getResult(self): | ||
if self._exc: | ||
raise self._exc[0], self._exc[1] | ||
return self._body | ||
|
||
class RequestFactory: | ||
|
||
def __init__(self, root): | ||
self.pub = Publication(root) | ||
|
||
def __call__(self, input, output, env): | ||
r = Request(input, output, env) | ||
r.publication = self.pub | ||
return r | ||
|
||
class TestPublisherFileSystem(FileSystemTests, TestCase): | ||
|
||
def setUp(self): | ||
root = demofs.Directory() | ||
root.grant('bob', demofs.write) | ||
fs = DemoFileSystem(root, 'bob') | ||
fs.mkdir(self.dir_name) | ||
fs.writefile(self.file_name, StringIO(self.file_contents)) | ||
fs.writefile(self.unwritable_filename, StringIO("save this")) | ||
fs.get(self.unwritable_filename).revoke('bob', demofs.write) | ||
|
||
self.filesystem = PublisherFileSystem('bob', RequestFactory(fs)) | ||
|
||
def test_suite(): | ||
return TestSuite(( | ||
makeSuite(TestPublisherFileSystem), | ||
)) | ||
|
||
if __name__=='__main__': | ||
main(defaultTest='test_suite') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.