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
7c0f593b
Commit
7c0f593b
authored
Jul 24, 2010
by
Hanno Schlichting
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Let's not indent with five spaces, please
parent
351988f6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
56 deletions
+48
-56
src/Products/ZCatalog/tests/testCatalog.py
src/Products/ZCatalog/tests/testCatalog.py
+48
-56
No files found.
src/Products/ZCatalog/tests/testCatalog.py
View file @
7c0f593b
...
...
@@ -880,73 +880,65 @@ class TestCatalogReport(unittest.TestCase):
clear_value_indexes
()
def
test_ReportLength
(
self
):
""" tests the report aggregation """
self
.
zcat
.
manage_resetCatalogReport
()
self
.
zcat
.
searchResults
(
title
=
'4 or 5 or 6'
,
sort_on
=
'num'
)
self
.
zcat
.
searchResults
(
title
=
'1 or 6 or 7'
,
sort_on
=
'num'
)
self
.
zcat
.
searchResults
(
title
=
'3 or 8 or 9'
,
sort_on
=
'num'
)
""" tests the report aggregation """
self
.
zcat
.
manage_resetCatalogReport
()
self
.
zcat
.
searchResults
(
big
=
True
,
sort_on
=
'num'
)
self
.
zcat
.
searchResults
(
big
=
True
,
sort_on
=
'num'
)
self
.
zcat
.
searchResults
(
big
=
False
,
sort_on
=
'num'
)
self
.
zcat
.
searchResults
(
title
=
'4 or 5 or 6'
,
sort_on
=
'num'
)
self
.
zcat
.
searchResults
(
title
=
'1 or 6 or 7'
,
sort_on
=
'num'
)
self
.
zcat
.
searchResults
(
title
=
'3 or 8 or 9'
,
sort_on
=
'num'
)
self
.
zcat
.
searchResults
(
big
=
True
,
sort_on
=
'num'
)
self
.
zcat
.
searchResults
(
big
=
True
,
sort_on
=
'num'
)
self
.
zcat
.
searchResults
(
big
=
False
,
sort_on
=
'num'
)
self
.
zcat
.
searchResults
(
num
=
[
5
,
4
,
3
],
sort_on
=
'num'
)
self
.
zcat
.
searchResults
(
num
=
(
3
,
4
,
5
),
sort_on
=
'num'
)
self
.
assertEqual
(
4
,
len
(
self
.
zcat
.
getCatalogReport
()))
self
.
zcat
.
searchResults
(
num
=
[
5
,
4
,
3
],
sort_on
=
'num'
)
self
.
zcat
.
searchResults
(
num
=
(
3
,
4
,
5
),
sort_on
=
'num'
)
def
test_ReportCounter
(
self
):
""" tests the counter of equal queries """
self
.
zcat
.
manage_resetCatalogReport
()
self
.
zcat
.
searchResults
(
title
=
'4 or 5 or 6'
,
sort_on
=
'num'
)
self
.
zcat
.
searchResults
(
title
=
'1 or 6 or 7'
,
sort_on
=
'num'
)
self
.
zcat
.
searchResults
(
title
=
'3 or 8 or 9'
,
sort_on
=
'num'
)
self
.
assertEqual
(
4
,
len
(
self
.
zcat
.
getCatalogReport
()))
r
=
self
.
zcat
.
getCatalogReport
()[
0
]
self
.
assertEqual
(
r
[
'counter'
],
3
)
def
test_ReportCounter
(
self
):
""" tests the counter of equal queries """
def
test_ReportKey
(
self
):
""" tests the query keys for uniqueness """
# query key 1
key
=
(
'sort_on'
,
(
'big'
,
'True'
))
self
.
zcat
.
manage_resetCatalogReport
()
self
.
zcat
.
manage_resetCatalogReport
()
self
.
zcat
.
searchResults
(
big
=
True
,
sort_on
=
'num'
)
self
.
zcat
.
searchResults
(
big
=
True
,
sort_on
=
'num'
)
r
=
self
.
zcat
.
getCatalogReport
()[
0
]
self
.
zcat
.
searchResults
(
title
=
'4 or 5 or 6'
,
sort_on
=
'num'
)
self
.
zcat
.
searchResults
(
title
=
'1 or 6 or 7'
,
sort_on
=
'num'
)
self
.
zcat
.
searchResults
(
title
=
'3 or 8 or 9'
,
sort_on
=
'num'
)
self
.
assertEqual
(
r
[
'query'
],
key
)
self
.
assertEqual
(
r
[
'counter'
],
2
)
r
=
self
.
zcat
.
getCatalogReport
()[
0
]
# query key 2
key
=
(
'sort_on'
,
(
'big'
,
'False'
))
self
.
zcat
.
manage_resetCatalogReport
()
self
.
assertEqual
(
r
[
'counter'
],
3
)
self
.
zcat
.
searchResults
(
big
=
False
,
sort_on
=
'num'
)
r
=
self
.
zcat
.
getCatalogReport
()[
0
]
self
.
assertEqual
(
r
[
'query'
],
key
)
self
.
assertEqual
(
r
[
'counter'
],
1
)
def
test_ReportKey
(
self
):
""" tests the query keys for uniqueness """
# query key 1
key
=
(
'sort_on'
,
(
'big'
,
'True'
))
self
.
zcat
.
manage_resetCatalogReport
()
self
.
zcat
.
searchResults
(
big
=
True
,
sort_on
=
'num'
)
self
.
zcat
.
searchResults
(
big
=
True
,
sort_on
=
'num'
)
r
=
self
.
zcat
.
getCatalogReport
()[
0
]
self
.
assertEqual
(
r
[
'query'
],
key
)
self
.
assertEqual
(
r
[
'counter'
],
2
)
# query key 2
key
=
(
'sort_on'
,
(
'big'
,
'False'
))
self
.
zcat
.
manage_resetCatalogReport
()
self
.
zcat
.
searchResults
(
big
=
False
,
sort_on
=
'num'
)
r
=
self
.
zcat
.
getCatalogReport
()[
0
]
self
.
assertEqual
(
r
[
'query'
],
key
)
self
.
assertEqual
(
r
[
'counter'
],
1
)
# query key 3
key
=
(
'sort_on'
,
(
'num'
,
'[3, 4, 5]'
))
self
.
zcat
.
manage_resetCatalogReport
()
self
.
zcat
.
searchResults
(
num
=
[
5
,
4
,
3
],
sort_on
=
'num'
)
self
.
zcat
.
searchResults
(
num
=
(
3
,
4
,
5
),
sort_on
=
'num'
)
r
=
self
.
zcat
.
getCatalogReport
()[
0
]
self
.
assertEqual
(
r
[
'query'
],
key
)
self
.
assertEqual
(
r
[
'counter'
],
2
)
# query key 3
key
=
(
'sort_on'
,
(
'num'
,
'[3, 4, 5]'
))
self
.
zcat
.
manage_resetCatalogReport
()
self
.
zcat
.
searchResults
(
num
=
[
5
,
4
,
3
],
sort_on
=
'num'
)
self
.
zcat
.
searchResults
(
num
=
(
3
,
4
,
5
),
sort_on
=
'num'
)
r
=
self
.
zcat
.
getCatalogReport
()[
0
]
self
.
assertEqual
(
r
[
'query'
],
key
)
self
.
assertEqual
(
r
[
'counter'
],
2
)
def
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