Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
7b4c9134
Commit
7b4c9134
authored
Sep 10, 2006
by
Stefan H. Holek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tests to go with
http://www.zope.org/Collectors/Zope/2187
parent
2f37ea19
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
77 additions
and
0 deletions
+77
-0
lib/python/webdav/tests/testPUT_factory.py
lib/python/webdav/tests/testPUT_factory.py
+77
-0
No files found.
lib/python/webdav/tests/testPUT_factory.py
0 → 100644
View file @
7b4c9134
import
unittest
import
Testing
import
Zope2
Zope2
.
startup
()
from
Testing.makerequest
import
makerequest
import
transaction
import
base64
auth_info
=
'Basic %s'
%
base64
.
encodestring
(
'manager:secret'
).
rstrip
()
class
TestPUTFactory
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
app
=
makerequest
(
Zope2
.
app
())
try
:
# Make a manager user
uf
=
self
.
app
.
acl_users
uf
.
_doAddUser
(
'manager'
,
'secret'
,
[
'Manager'
],
[])
# Make a folder to put stuff into
self
.
app
.
manage_addFolder
(
'folder'
,
''
)
self
.
folder
=
self
.
app
.
folder
# Fake a WebDAV PUT request
request
=
self
.
app
.
REQUEST
request
[
'PARENTS'
]
=
[
self
.
app
]
request
[
'BODY'
]
=
'bar'
request
.
environ
[
'CONTENT_TYPE'
]
=
'text/plain'
request
.
environ
[
'REQUEST_METHOD'
]
=
'PUT'
request
.
_auth
=
auth_info
except
:
self
.
tearDown
()
raise
def
tearDown
(
self
):
transaction
.
abort
()
self
.
app
.
REQUEST
.
close
()
self
.
app
.
_p_jar
.
close
()
def
testNoVirtualHosting
(
self
):
request
=
self
.
app
.
REQUEST
put
=
request
.
traverse
(
'/folder/doc'
)
put
(
request
,
request
.
RESPONSE
)
self
.
failUnless
(
'doc'
in
self
.
folder
.
objectIds
())
def
testSimpleVirtualHosting
(
self
):
request
=
self
.
app
.
REQUEST
put
=
request
.
traverse
(
'/VirtualHostBase/http/foo.com:80/VirtualHostRoot/folder/doc'
)
put
(
request
,
request
.
RESPONSE
)
self
.
failUnless
(
'doc'
in
self
.
folder
.
objectIds
())
def
testSubfolderVirtualHosting
(
self
):
request
=
self
.
app
.
REQUEST
put
=
request
.
traverse
(
'/VirtualHostBase/http/foo.com:80/folder/VirtualHostRoot/doc'
)
put
(
request
,
request
.
RESPONSE
)
self
.
failUnless
(
'doc'
in
self
.
folder
.
objectIds
())
def
testInsideOutVirtualHosting
(
self
):
request
=
self
.
app
.
REQUEST
put
=
request
.
traverse
(
'/VirtualHostBase/http/foo.com:80/VirtualHostRoot/_vh_foo/folder/doc'
)
put
(
request
,
request
.
RESPONSE
)
self
.
failUnless
(
'doc'
in
self
.
folder
.
objectIds
())
def
testSubfolderInsideOutVirtualHosting
(
self
):
request
=
self
.
app
.
REQUEST
put
=
request
.
traverse
(
'/VirtualHostBase/http/foo.com:80/folder/VirtualHostRoot/_vh_foo/doc'
)
put
(
request
,
request
.
RESPONSE
)
self
.
failUnless
(
'doc'
in
self
.
folder
.
objectIds
())
def
test_suite
():
return
unittest
.
TestSuite
((
unittest
.
makeSuite
(
TestPUTFactory
),
))
if
__name__
==
'__main__'
:
unittest
.
main
(
defaultTest
=
'test_suite'
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment