Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
alecs_myu
erp5
Commits
7e187cf0
Commit
7e187cf0
authored
Dec 21, 2016
by
Vincent Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
testCMFCategory: Extend test_09_GetCategoryParentUidList
parent
0480dd10
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
83 additions
and
0 deletions
+83
-0
product/CMFCategory/tests/testCMFCategory.py
product/CMFCategory/tests/testCMFCategory.py
+83
-0
No files found.
product/CMFCategory/tests/testCMFCategory.py
View file @
7e187cf0
...
@@ -317,9 +317,15 @@ class TestCMFCategory(ERP5TypeTestCase):
...
@@ -317,9 +317,15 @@ class TestCMFCategory(ERP5TypeTestCase):
portal_categories
=
self
.
getCategoriesTool
()
portal_categories
=
self
.
getCategoriesTool
()
getCategoryParentUidList
=
portal_categories
.
getCategoryParentUidList
getCategoryParentUidList
=
portal_categories
.
getCategoryParentUidList
basecat
=
portal_categories
.
newContent
(
portal_type
=
'Base Category'
,
id
=
'basecat'
)
basecat
=
portal_categories
.
newContent
(
portal_type
=
'Base Category'
,
id
=
'basecat'
)
basecat2
=
portal_categories
.
newContent
(
portal_type
=
'Base Category'
,
id
=
'basecat2'
)
cat1
=
basecat
.
newContent
(
portal_type
=
'Category'
,
id
=
'cat1'
)
cat1
=
basecat
.
newContent
(
portal_type
=
'Category'
,
id
=
'cat1'
)
cat2
=
cat1
.
newContent
(
portal_type
=
'Category'
,
id
=
'cat2'
)
cat2
=
cat1
.
newContent
(
portal_type
=
'Category'
,
id
=
'cat2'
)
cat22
=
cat2
.
newContent
(
portal_type
=
'Category'
,
id
=
'cat2'
)
cat22
=
cat2
.
newContent
(
portal_type
=
'Category'
,
id
=
'cat2'
)
cat3
=
cat1
.
newContent
(
portal_type
=
'Category'
,
id
=
'cat3'
)
module
=
self
.
getPersonModule
()
person
=
module
.
newContent
(
portal_type
=
'Person'
)
address
=
person
.
newContent
(
portal_type
=
'Address'
)
# Non-strict, implicit base category
self
.
assertItemsEqual
(
self
.
assertItemsEqual
(
getCategoryParentUidList
(
getCategoryParentUidList
(
relative_url
=
cat2
.
getRelativeUrl
(),
relative_url
=
cat2
.
getRelativeUrl
(),
...
@@ -330,6 +336,83 @@ class TestCMFCategory(ERP5TypeTestCase):
...
@@ -330,6 +336,83 @@ class TestCMFCategory(ERP5TypeTestCase):
(
basecat
.
getUid
(),
basecat
.
getUid
(),
0
),
(
basecat
.
getUid
(),
basecat
.
getUid
(),
0
),
],
],
)
)
self
.
assertItemsEqual
(
getCategoryParentUidList
(
relative_url
=
cat22
.
getRelativeUrl
(),
),
[
(
cat22
.
getUid
(),
basecat
.
getUid
(),
1
),
(
cat2
.
getUid
(),
basecat
.
getUid
(),
0
),
(
cat1
.
getUid
(),
basecat
.
getUid
(),
0
),
(
basecat
.
getUid
(),
basecat
.
getUid
(),
0
),
],
)
# Non-canonical path
self
.
assertItemsEqual
(
getCategoryParentUidList
(
relative_url
=
cat2
.
getRelativeUrl
()
+
'/'
+
cat3
.
getId
(),
),
[
(
cat3
.
getUid
(),
basecat
.
getUid
(),
1
),
(
cat2
.
getUid
(),
basecat
.
getUid
(),
0
),
(
cat1
.
getUid
(),
basecat
.
getUid
(),
0
),
(
basecat
.
getUid
(),
basecat
.
getUid
(),
0
),
],
)
# Strict, implicit base category
self
.
assertItemsEqual
(
getCategoryParentUidList
(
relative_url
=
cat2
.
getRelativeUrl
(),
strict
=
True
,
),
[
(
cat2
.
getUid
(),
basecat
.
getUid
(),
1
),
],
)
# Non-strict, explicit base category
self
.
assertItemsEqual
(
getCategoryParentUidList
(
relative_url
=
cat2
.
getRelativeUrl
(),
base_category
=
basecat2
.
getId
(),
),
[
(
cat2
.
getUid
(),
basecat2
.
getUid
(),
1
),
(
cat1
.
getUid
(),
basecat2
.
getUid
(),
0
),
(
basecat
.
getUid
(),
basecat2
.
getUid
(),
0
),
],
)
# Strict, explicit base category
self
.
assertItemsEqual
(
getCategoryParentUidList
(
relative_url
=
cat2
.
getRelativeUrl
(),
base_category
=
basecat2
.
getId
(),
strict
=
True
,
),
[
(
cat2
.
getUid
(),
basecat2
.
getUid
(),
1
),
],
)
# Non-strict with a non-category relation: only strict relation uid.
# Note: not providing base_category is undefined behaviour.
self
.
assertItemsEqual
(
getCategoryParentUidList
(
relative_url
=
person
.
getRelativeUrl
(),
base_category
=
basecat
.
getId
(),
),
[
(
person
.
getUid
(),
basecat
.
getUid
(),
1
),
],
)
# ... even on a subobject
self
.
assertItemsEqual
(
getCategoryParentUidList
(
relative_url
=
address
.
getRelativeUrl
(),
base_category
=
basecat
.
getId
(),
),
[
(
address
.
getUid
(),
basecat
.
getUid
(),
1
),
],
)
def
test_10_FallBackBaseCategory
(
self
):
def
test_10_FallBackBaseCategory
(
self
):
# Test if we can use an alternative base category
# Test if we can use an alternative base category
...
...
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