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
2e8b12ca
Commit
2e8b12ca
authored
Aug 28, 2002
by
Andy McKay
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add in tests for ZCatalog (as opposed to Catalog) for getMetadataForUID and getIndexForUID...
parent
fbfa7448
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
1 deletion
+35
-1
lib/python/Products/ZCatalog/tests/testCatalog.py
lib/python/Products/ZCatalog/tests/testCatalog.py
+35
-1
No files found.
lib/python/Products/ZCatalog/tests/testCatalog.py
View file @
2e8b12ca
...
...
@@ -7,6 +7,7 @@ import os,sys, unittest
import
ZODB
,
OFS
.
Application
from
ZODB.DemoStorage
import
DemoStorage
from
ZODB.DB
import
DB
from
Products
import
ZCatalog
from
Products.ZCatalog
import
ZCatalog
,
Vocabulary
from
Products.ZCatalog.Catalog
import
Catalog
,
CatalogError
import
ExtensionClass
...
...
@@ -125,6 +126,38 @@ class TestAddDelIndexes(CatalogBase, unittest.TestCase):
# Removed unittests dealing with catalog instantiation and vocabularies
# since catalog no longer creates/manages vocabularies automatically (Casey)
# Test of the ZCatalog object, as opposed to Catalog
class
TestZCatalog
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
_catalog
=
ZCatalog
.
ZCatalog
(
'Catalog'
)
self
.
_catalog
.
addIndex
(
'title'
,
'KeywordIndex'
)
self
.
_catalog
.
addColumn
(
'title'
)
self
.
upper
=
10
class
dummy
(
ExtensionClass
.
Base
):
def
__init__
(
self
,
num
):
self
.
num
=
num
def
title
(
self
):
return
'%d'
%
self
.
num
for
x
in
range
(
0
,
self
.
upper
):
# make uid a string of the number
self
.
_catalog
.
catalog_object
(
dummy
(
x
),
str
(
x
))
def
testGetMetadataForUID
(
self
):
testNum
=
str
(
self
.
upper
-
3
)
# as good as any..
data
=
self
.
_catalog
.
getMetadataForUID
(
testNum
)
assert
data
[
'title'
]
==
testNum
def
testGetIndexDataForUID
(
self
):
testNum
=
str
(
self
.
upper
-
3
)
data
=
self
.
_catalog
.
getIndexDataForUID
(
testNum
)
assert
data
[
'title'
][
0
]
==
testNum
class
TestCatalogObject
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
_vocabulary
=
Vocabulary
.
Vocabulary
(
'Vocabulary'
,
'Vocabulary'
,
...
...
@@ -314,7 +347,6 @@ class TestCatalogObject(unittest.TestCase):
a
=
self
.
_catalog
(
sort_on
=
'att1'
)
self
.
assertEqual
(
len
(
a
),
self
.
upper
)
class
objRS
(
ExtensionClass
.
Base
):
def
__init__
(
self
,
num
):
...
...
@@ -354,9 +386,11 @@ def test_suite():
suite
=
unittest
.
TestSuite
()
suite
.
addTest
(
unittest
.
makeSuite
(
TestAddDelColumn
)
)
suite
.
addTest
(
unittest
.
makeSuite
(
TestAddDelIndexes
)
)
suite
.
addTest
(
unittest
.
makeSuite
(
TestZCatalog
)
)
suite
.
addTest
(
unittest
.
makeSuite
(
TestCatalogObject
)
)
suite
.
addTest
(
unittest
.
makeSuite
(
testRS
)
)
return
suite
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