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
be28664e
Commit
be28664e
authored
May 15, 2005
by
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added some basic conformance tests
parent
139e1102
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
152 additions
and
38 deletions
+152
-38
lib/python/OFS/tests/testFileAndImage.py
lib/python/OFS/tests/testFileAndImage.py
+33
-14
lib/python/OFS/tests/testFolder.py
lib/python/OFS/tests/testFolder.py
+20
-0
lib/python/OFS/tests/testOrderSupport.py
lib/python/OFS/tests/testOrderSupport.py
+17
-12
lib/python/OFS/tests/testOrderedFolder.py
lib/python/OFS/tests/testOrderedFolder.py
+9
-12
lib/python/webdav/tests/__init__.py
lib/python/webdav/tests/__init__.py
+2
-0
lib/python/webdav/tests/testEtagSupport.py
lib/python/webdav/tests/testEtagSupport.py
+20
-0
lib/python/webdav/tests/testLockItem.py
lib/python/webdav/tests/testLockItem.py
+20
-0
lib/python/webdav/tests/testNullResource.py
lib/python/webdav/tests/testNullResource.py
+31
-0
No files found.
lib/python/OFS/tests/testFileAndImage.py
View file @
be28664e
import
unittest
import
Testing
import
Zope2
Zope2
.
startup
()
import
os
,
sys
import
unittest
import
time
from
cStringIO
import
StringIO
...
...
@@ -47,11 +48,11 @@ def aputrequest(file, content_type):
class
DummyCache
:
def
__init__
(
self
):
self
.
clear
()
def
ZCache_set
(
self
,
ob
,
data
,
view_name
=
''
,
keywords
=
None
,
mtime_func
=
None
):
self
.
set
=
(
ob
,
data
)
def
ZCache_get
(
self
,
ob
,
data
,
view_name
=
''
,
keywords
=
None
,
mtime_func
=
None
):
self
.
get
=
ob
...
...
@@ -69,14 +70,14 @@ class DummyCache:
def
setStreamIterator
(
self
,
si
):
self
.
si
=
si
ADummyCache
=
DummyCache
()
class
DummyCacheManager
(
SimpleItem
):
def
ZCacheManager_getCache
(
self
):
return
ADummyCache
class
FileTests
(
unittest
.
TestCase
):
data
=
open
(
filedata
,
'rb'
).
read
()
content_type
=
'application/octet-stream'
...
...
@@ -152,7 +153,7 @@ class FileTests(unittest.TestCase):
self
.
assertEqual
(
self
.
file
.
content_type
,
'text/plain'
)
self
.
failUnless
(
ADummyCache
.
invalidated
)
self
.
failUnless
(
ADummyCache
.
set
)
def
testManageEditWithoutFileData
(
self
):
self
.
file
.
manage_edit
(
'foobar'
,
'text/plain'
)
self
.
assertEqual
(
self
.
file
.
title
,
'foobar'
)
...
...
@@ -242,6 +243,16 @@ class FileTests(unittest.TestCase):
self
.
assertEqual
(
len
(
results
),
1
)
self
.
assertEqual
(
results
[
0
][
1
],
self
.
file
)
def
test_z2interfaces
(
self
):
from
Interface.Verify
import
verifyClass
from
OFS.Image
import
File
from
webdav.WriteLockInterface
import
WriteLockInterface
from
ZPublisher.HTTPRangeSupport
import
HTTPRangeInterface
verifyClass
(
HTTPRangeInterface
,
File
)
verifyClass
(
WriteLockInterface
,
File
)
class
ImageTests
(
FileTests
):
data
=
open
(
filedata
,
'rb'
).
read
()
content_type
=
'image/gif'
...
...
@@ -255,7 +266,7 @@ class ImageTests(FileTests):
self
.
assertEqual
(
self
.
file
.
height
,
16
)
self
.
failUnless
(
ADummyCache
.
invalidated
)
self
.
failUnless
(
ADummyCache
.
set
)
def
testStr
(
self
):
self
.
assertEqual
(
str
(
self
.
file
),
(
'<img src="http://foo/file" alt="" title="" height="16" width="16" />'
))
...
...
@@ -266,12 +277,20 @@ class ImageTests(FileTests):
def
testViewImageOrFile
(
self
):
pass
# dtml method,screw it
def
test_z2interfaces
(
self
):
from
Interface.Verify
import
verifyClass
from
OFS.Image
import
Image
from
webdav.WriteLockInterface
import
WriteLockInterface
verifyClass
(
WriteLockInterface
,
Image
)
def
test_suite
():
suite
=
unittest
.
TestSuite
()
suite
.
addTest
(
unittest
.
makeSuite
(
FileTests
)
)
suite
.
addTest
(
unittest
.
makeSuite
(
ImageTests
))
return
suite
return
unittest
.
TestSuite
((
unittest
.
makeSuite
(
FileTests
),
unittest
.
makeSuite
(
ImageTests
),
))
if
__name__
==
"__main__"
:
unittest
.
main
()
if
__name__
==
'__main__'
:
unittest
.
main
(
defaultTest
=
'test_suite'
)
lib/python/OFS/tests/testFolder.py
0 → 100644
View file @
be28664e
import
unittest
class
TestFolder
(
unittest
.
TestCase
):
def
test_z2interfaces
(
self
):
from
Interface.Verify
import
verifyClass
from
OFS.Folder
import
Folder
from
webdav.WriteLockInterface
import
WriteLockInterface
verifyClass
(
WriteLockInterface
,
Folder
)
def
test_suite
():
return
unittest
.
TestSuite
((
unittest
.
makeSuite
(
TestFolder
),
))
if
__name__
==
'__main__'
:
unittest
.
main
(
defaultTest
=
'test_suite'
)
lib/python/OFS/tests/testOrderSupport.py
View file @
be28664e
from
unittest
import
TestCase
,
TestSuite
,
makeSuite
,
main
import
unittest
import
Testing
import
Zope2
Zope2
.
startup
()
from
Interface.Verify
import
verifyClass
from
OFS.CopySupport
import
CopySource
from
OFS.ObjectManager
import
ObjectManager
from
OFS.OrderSupport
import
OrderSupport
class
DummyObject
(
CopySource
):
def
__init__
(
self
,
id
,
meta_type
):
...
...
@@ -22,15 +21,17 @@ class DummyObject(CopySource):
def
wl_isLocked
(
self
):
return
0
class
OrderedObjectManager
(
OrderSupport
,
ObjectManager
):
# disable permission verification
def
_verifyObjectPaste
(
self
,
object
,
validate_src
=
1
):
return
class
TestOrderSupport
(
TestCase
):
class
TestOrderSupport
(
unittest
.
TestCase
):
def
_makeOne
(
self
):
from
OFS.OrderSupport
import
OrderSupport
class
OrderedObjectManager
(
OrderSupport
,
ObjectManager
):
# disable permission verification
def
_verifyObjectPaste
(
self
,
object
,
validate_src
=
1
):
return
f
=
OrderedObjectManager
()
f
.
_objects
=
(
{
'id'
:
'o1'
,
'meta_type'
:
'mt1'
}
,
{
'id'
:
'o2'
,
'meta_type'
:
'mt2'
}
...
...
@@ -159,14 +160,18 @@ class TestOrderSupport(TestCase):
f
.
setDefaultSorting
(
'position'
,
True
)
self
.
failUnlessEqual
(
f
.
tpValues
(),
[
f
.
o4
,
f
.
o3
,
f
.
o2
]
)
def
test_interface
(
self
):
def
test_z2interfaces
(
self
):
from
Interface.Verify
import
verifyClass
from
OFS.IOrderSupport
import
IOrderedContainer
from
OFS.OrderSupport
import
OrderSupport
verifyClass
(
IOrderedContainer
,
OrderSupport
)
def
test_suite
():
return
TestSuite
(
(
makeSuite
(
TestOrderSupport
),
)
)
return
unittest
.
TestSuite
((
unittest
.
makeSuite
(
TestOrderSupport
),
))
if
__name__
==
'__main__'
:
main
(
defaultTest
=
'test_suite'
)
unittest
.
main
(
defaultTest
=
'test_suite'
)
lib/python/OFS/tests/testOrderedFolder.py
View file @
be28664e
from
unittest
import
TestCase
,
TestSuite
,
makeSuite
,
main
import
unittest
import
Testing
import
Zope2
Zope2
.
startup
()
from
Interface.Verify
import
verifyClass
from
OFS.OrderedFolder
import
OrderedFolder
class
TestOrderedFolder
(
unittest
.
TestCase
):
class
TestOrderedFolder
(
TestCase
):
def
test_interface
(
self
):
def
test_z2interfaces
(
self
):
from
Interface.Verify
import
verifyClass
from
OFS.IOrderSupport
import
IOrderedContainer
from
OFS.OrderedFolder
import
OrderedFolder
from
webdav.WriteLockInterface
import
WriteLockInterface
verifyClass
(
IOrderedContainer
,
OrderedFolder
)
...
...
@@ -19,7 +14,9 @@ class TestOrderedFolder(TestCase):
def
test_suite
():
return
TestSuite
(
(
makeSuite
(
TestOrderedFolder
),
)
)
return
unittest
.
TestSuite
((
unittest
.
makeSuite
(
TestOrderedFolder
),
))
if
__name__
==
'__main__'
:
main
(
defaultTest
=
'test_suite'
)
unittest
.
main
(
defaultTest
=
'test_suite'
)
lib/python/webdav/tests/__init__.py
0 → 100644
View file @
be28664e
#
# This file is necessary to make this directory a package.
lib/python/webdav/tests/testEtagSupport.py
0 → 100644
View file @
be28664e
import
unittest
class
TestEtagSupport
(
unittest
.
TestCase
):
def
test_z2interfaces
(
self
):
from
Interface.Verify
import
verifyClass
from
webdav.EtagSupport
import
EtagBaseInterface
from
webdav.EtagSupport
import
EtagSupport
verifyClass
(
EtagBaseInterface
,
EtagSupport
)
def
test_suite
():
return
unittest
.
TestSuite
((
unittest
.
makeSuite
(
TestEtagSupport
),
))
if
__name__
==
'__main__'
:
unittest
.
main
(
defaultTest
=
'test_suite'
)
lib/python/webdav/tests/testLockItem.py
0 → 100644
View file @
be28664e
import
unittest
class
TestLockItem
(
unittest
.
TestCase
):
def
test_z2interfaces
(
self
):
from
Interface.Verify
import
verifyClass
from
webdav.LockItem
import
LockItem
from
webdav.WriteLockInterface
import
LockItemInterface
verifyClass
(
LockItemInterface
,
LockItem
)
def
test_suite
():
return
unittest
.
TestSuite
((
unittest
.
makeSuite
(
TestLockItem
),
))
if
__name__
==
'__main__'
:
unittest
.
main
(
defaultTest
=
'test_suite'
)
lib/python/webdav/tests/testNullResource.py
0 → 100644
View file @
be28664e
import
unittest
class
TestLockNullResource
(
unittest
.
TestCase
):
def
test_z2interfaces
(
self
):
from
Interface.Verify
import
verifyClass
from
webdav.NullResource
import
LockNullResource
from
webdav.WriteLockInterface
import
WriteLockInterface
verifyClass
(
WriteLockInterface
,
LockNullResource
)
class
TestNullResource
(
unittest
.
TestCase
):
def
test_z2interfaces
(
self
):
from
Interface.Verify
import
verifyClass
from
webdav.NullResource
import
NullResource
from
webdav.WriteLockInterface
import
WriteLockInterface
verifyClass
(
WriteLockInterface
,
NullResource
)
def
test_suite
():
return
unittest
.
TestSuite
((
unittest
.
makeSuite
(
TestLockNullResource
),
unittest
.
makeSuite
(
TestNullResource
),
))
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