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
85691f65
Commit
85691f65
authored
Aug 01, 2010
by
Hanno Schlichting
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reorder zcatalog tests and note methods without test coverage
parent
b8b99bcc
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
96 additions
and
49 deletions
+96
-49
src/Products/ZCatalog/tests/test_zcatalog.py
src/Products/ZCatalog/tests/test_zcatalog.py
+96
-49
No files found.
src/Products/ZCatalog/tests/test_zcatalog.py
View file @
85691f65
...
...
@@ -155,56 +155,11 @@ class TestZCatalog(ZCatalogBase, unittest.TestCase):
verifyClass
(
IZCatalog
,
ZCatalog
)
def
testGetMetadataForUID
(
self
):
testNum
=
str
(
self
.
upper
-
3
)
# as good as any..
data
=
self
.
_catalog
.
getMetadataForUID
(
testNum
)
self
.
assertEqual
(
data
[
'title'
],
testNum
)
def
testGetIndexDataForUID
(
self
):
testNum
=
str
(
self
.
upper
-
3
)
data
=
self
.
_catalog
.
getIndexDataForUID
(
testNum
)
self
.
assertEqual
(
data
[
'title'
][
0
],
testNum
)
def
testSearch
(
self
):
query
=
{
'title'
:
[
'5'
,
'6'
,
'7'
]}
sr
=
self
.
_catalog
.
searchResults
(
query
)
self
.
assertEqual
(
len
(
sr
),
3
)
sr
=
self
.
_catalog
.
search
(
query
)
self
.
assertEqual
(
len
(
sr
),
3
)
def
testUpdateMetadata
(
self
):
self
.
_catalog
.
catalog_object
(
zdummy
(
1
),
'1'
)
data
=
self
.
_catalog
.
getMetadataForUID
(
'1'
)
self
.
assertEqual
(
data
[
'title'
],
'1'
)
self
.
_catalog
.
catalog_object
(
zdummy
(
2
),
'1'
,
update_metadata
=
0
)
data
=
self
.
_catalog
.
getMetadataForUID
(
'1'
)
self
.
assertEqual
(
data
[
'title'
],
'1'
)
self
.
_catalog
.
catalog_object
(
zdummy
(
2
),
'1'
,
update_metadata
=
1
)
data
=
self
.
_catalog
.
getMetadataForUID
(
'1'
)
self
.
assertEqual
(
data
[
'title'
],
'2'
)
# update_metadata defaults to true, test that here
self
.
_catalog
.
catalog_object
(
zdummy
(
1
),
'1'
)
data
=
self
.
_catalog
.
getMetadataForUID
(
'1'
)
self
.
assertEqual
(
data
[
'title'
],
'1'
)
def
testReindexIndexDoesntDoMetadata
(
self
):
self
.
d
[
'0'
].
num
=
9999
self
.
_catalog
.
reindexIndex
(
'title'
,
{})
data
=
self
.
_catalog
.
getMetadataForUID
(
'0'
)
self
.
assertEqual
(
data
[
'title'
],
'0'
)
def
test_len
(
self
):
self
.
assertEquals
(
len
(
self
.
_catalog
),
self
.
upper
)
def
testReindexIndexesFalse
(
self
):
# setup
false_id
=
self
.
upper
+
1
ob
=
zdummyFalse
(
false_id
)
self
.
d
[
str
(
false_id
)]
=
ob
self
.
_catalog
.
catalog_object
(
ob
,
str
(
false_id
))
# test, object evaluates to false; there was bug which caused the
# object to be removed from index
ob
.
num
=
9999
self
.
_catalog
.
reindexIndex
(
'title'
,
{})
result
=
self
.
_catalog
(
title
=
'9999'
)
self
.
assertEquals
(
1
,
len
(
result
))
# manage_edit
# manage_subbingToggle
def
testBooleanEvalOn_manage_catalogObject
(
self
):
self
.
d
[
'11'
]
=
dummyLenFail
(
11
,
self
.
fail
)
...
...
@@ -217,6 +172,9 @@ class TestZCatalog(ZCatalogBase, unittest.TestCase):
self
.
_catalog
.
manage_catalogObject
(
None
,
myresponse
(),
'URL1'
,
urls
=
(
'11'
,
'12'
))
# manage_uncatalogObject
# manage_catalogReindex
def
testBooleanEvalOn_refreshCatalog_getobject
(
self
):
# wrap catalog under the fake parent providing unrestrictedTraverse()
catalog
=
self
.
_catalog
.
__of__
(
fakeparent
(
self
.
d
))
...
...
@@ -231,6 +189,40 @@ class TestZCatalog(ZCatalogBase, unittest.TestCase):
# neither should these
catalog
.
getobject
(
rid
)
# manage_catalogClear
# manage_catalogFoundItems
# manage_addColumn
# manage_delColumn
# manage_addIndex
# manage_delIndex
# manage_clearIndex
def
testReindexIndexDoesntDoMetadata
(
self
):
self
.
d
[
'0'
].
num
=
9999
self
.
_catalog
.
reindexIndex
(
'title'
,
{})
data
=
self
.
_catalog
.
getMetadataForUID
(
'0'
)
self
.
assertEqual
(
data
[
'title'
],
'0'
)
def
testReindexIndexesFalse
(
self
):
# setup
false_id
=
self
.
upper
+
1
ob
=
zdummyFalse
(
false_id
)
self
.
d
[
str
(
false_id
)]
=
ob
self
.
_catalog
.
catalog_object
(
ob
,
str
(
false_id
))
# test, object evaluates to false; there was bug which caused the
# object to be removed from index
ob
.
num
=
9999
self
.
_catalog
.
reindexIndex
(
'title'
,
{})
result
=
self
.
_catalog
(
title
=
'9999'
)
self
.
assertEquals
(
1
,
len
(
result
))
# manage_reindexIndex
# catalog_object
# uncatalog_object
# uniqueValuesFor
# getpath
# getrid
def
test_getobject_traversal
(
self
):
# getobject doesn't mask TraversalErrors and doesn't delegate to
# resolve_url
...
...
@@ -252,6 +244,61 @@ class TestZCatalog(ZCatalogBase, unittest.TestCase):
self
.
d
[
'0'
]
=
None
self
.
assertEquals
(
catalog
.
getobject
(
rid0
),
None
)
def
testGetMetadataForUID
(
self
):
testNum
=
str
(
self
.
upper
-
3
)
# as good as any..
data
=
self
.
_catalog
.
getMetadataForUID
(
testNum
)
self
.
assertEqual
(
data
[
'title'
],
testNum
)
def
testGetIndexDataForUID
(
self
):
testNum
=
str
(
self
.
upper
-
3
)
data
=
self
.
_catalog
.
getIndexDataForUID
(
testNum
)
self
.
assertEqual
(
data
[
'title'
][
0
],
testNum
)
def
testUpdateMetadata
(
self
):
self
.
_catalog
.
catalog_object
(
zdummy
(
1
),
'1'
)
data
=
self
.
_catalog
.
getMetadataForUID
(
'1'
)
self
.
assertEqual
(
data
[
'title'
],
'1'
)
self
.
_catalog
.
catalog_object
(
zdummy
(
2
),
'1'
,
update_metadata
=
0
)
data
=
self
.
_catalog
.
getMetadataForUID
(
'1'
)
self
.
assertEqual
(
data
[
'title'
],
'1'
)
self
.
_catalog
.
catalog_object
(
zdummy
(
2
),
'1'
,
update_metadata
=
1
)
data
=
self
.
_catalog
.
getMetadataForUID
(
'1'
)
self
.
assertEqual
(
data
[
'title'
],
'2'
)
# update_metadata defaults to true, test that here
self
.
_catalog
.
catalog_object
(
zdummy
(
1
),
'1'
)
data
=
self
.
_catalog
.
getMetadataForUID
(
'1'
)
self
.
assertEqual
(
data
[
'title'
],
'1'
)
# getMetadataForRID
# getIndexDataForRID
# schema
# indexes
# index_objects
# getIndexObjects
# _searchable_arguments
# _searchable_result_columns
def
testSearchResults
(
self
):
query
=
{
'title'
:
[
'5'
,
'6'
,
'7'
]}
sr
=
self
.
_catalog
.
searchResults
(
query
)
self
.
assertEqual
(
len
(
sr
),
3
)
def
testCall
(
self
):
query
=
{
'title'
:
[
'5'
,
'6'
,
'7'
]}
sr
=
self
.
_catalog
(
query
)
self
.
assertEqual
(
len
(
sr
),
3
)
def
testSearch
(
self
):
query
=
{
'title'
:
[
'5'
,
'6'
,
'7'
]}
sr
=
self
.
_catalog
.
search
(
query
)
self
.
assertEqual
(
len
(
sr
),
3
)
# resolve_url
# resolve_path
# manage_normalize_paths
# manage_setProgress
# _getProgressThreshold
class
TestAddDelColumnIndex
(
ZCatalogBase
,
unittest
.
TestCase
):
...
...
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