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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gabriel Monnerat
erp5
Commits
09988a9a
Commit
09988a9a
authored
Apr 26, 2013
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
testDomainTool: remove some logs
parent
d9fb5f69
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
33 deletions
+7
-33
product/ERP5/tests/testDomainTool.py
product/ERP5/tests/testDomainTool.py
+7
-33
No files found.
product/ERP5/tests/testDomainTool.py
View file @
09988a9a
...
@@ -32,7 +32,6 @@ import unittest
...
@@ -32,7 +32,6 @@ import unittest
from
Products.ERP5.tests.testPredicate
import
TestPredicateMixIn
,
\
from
Products.ERP5.tests.testPredicate
import
TestPredicateMixIn
,
\
REGION_FRANCE_PATH
,
REGION_GERMANY_PATH
,
GROUP_STOREVER_PATH
REGION_FRANCE_PATH
,
REGION_GERMANY_PATH
,
GROUP_STOREVER_PATH
from
DateTime
import
DateTime
from
DateTime
import
DateTime
from
zLOG
import
LOG
from
Products.ZSQLCatalog.SQLCatalog
import
Query
from
Products.ZSQLCatalog.SQLCatalog
import
Query
class
TestDomainTool
(
TestPredicateMixIn
):
class
TestDomainTool
(
TestPredicateMixIn
):
...
@@ -277,24 +276,15 @@ class TestDomainTool(TestPredicateMixIn):
...
@@ -277,24 +276,15 @@ class TestDomainTool(TestPredicateMixIn):
predicate_list
=
domain_tool
.
searchPredicateList
(
order_line
,
test
=
test
,
**
kw
)
predicate_list
=
domain_tool
.
searchPredicateList
(
order_line
,
test
=
test
,
**
kw
)
self
.
assertEquals
(
len
(
predicate_list
),
1
)
self
.
assertEquals
(
len
(
predicate_list
),
1
)
def
test_01_SearchPredidateListWithNoTest
(
self
,
quiet
=
0
,
run
=
run_all_test
):
def
test_01_SearchPredidateListWithNoTest
(
self
):
if
not
run
:
return
if
not
quiet
:
self
.
logMessage
(
'Search Predicate List With No Test'
)
self
.
createData
()
self
.
createData
()
self
.
checkPredicate
(
test
=
0
)
self
.
checkPredicate
(
test
=
0
)
def
test_02_SearchPredidateListWithTest
(
self
,
quiet
=
0
,
run
=
run_all_test
):
def
test_02_SearchPredidateListWithTest
(
self
):
if
not
run
:
return
if
not
quiet
:
self
.
logMessage
(
'Search Predicate List With Test'
)
self
.
createData
()
self
.
createData
()
self
.
checkPredicate
(
test
=
1
)
self
.
checkPredicate
(
test
=
1
)
def
test_03_GenerateMappedValue
(
self
,
quiet
=
0
,
run
=
run_all_test
):
def
test_03_GenerateMappedValue
(
self
):
if
not
run
:
return
if
not
quiet
:
self
.
logMessage
(
'Generate Mapped Value'
)
self
.
createData
()
self
.
createData
()
self
.
supply_line
.
setVariationBaseCategoryList
([
'colour'
])
self
.
supply_line
.
setVariationBaseCategoryList
([
'colour'
])
self
.
supply_line
.
setBasePrice
(
23
)
self
.
supply_line
.
setBasePrice
(
23
)
...
@@ -309,10 +299,7 @@ class TestDomainTool(TestPredicateMixIn):
...
@@ -309,10 +299,7 @@ class TestDomainTool(TestPredicateMixIn):
mapped_value
=
domain_tool
.
generateMappedValue
(
context
,
portal_type
=
"Supply Line"
)
mapped_value
=
domain_tool
.
generateMappedValue
(
context
,
portal_type
=
"Supply Line"
)
self
.
assertEquals
(
mapped_value
.
getBasePrice
(),
23
)
self
.
assertEquals
(
mapped_value
.
getBasePrice
(),
23
)
def
test_04_GenerateMappedValueWithRanges
(
self
,
quiet
=
0
,
run
=
run_all_test
):
def
test_04_GenerateMappedValueWithRanges
(
self
):
if
not
run
:
return
if
not
quiet
:
self
.
logMessage
(
'Generate Mapped Value With Ranges'
)
self
.
createData
()
self
.
createData
()
self
.
supply_line
.
setBasePrice
(
23
)
self
.
supply_line
.
setBasePrice
(
23
)
self
.
supply_line
.
setPricedQuantity
(
1
)
self
.
supply_line
.
setPricedQuantity
(
1
)
...
@@ -321,8 +308,6 @@ class TestDomainTool(TestPredicateMixIn):
...
@@ -321,8 +308,6 @@ class TestDomainTool(TestPredicateMixIn):
date2
=
DateTime
(
'2005/04/10'
)
date2
=
DateTime
(
'2005/04/10'
)
self
.
supply_line
.
setStartDateRangeMin
(
date1
)
self
.
supply_line
.
setStartDateRangeMin
(
date1
)
self
.
supply_line
.
setStartDateRangeMax
(
date2
)
self
.
supply_line
.
setStartDateRangeMax
(
date2
)
LOG
(
'Test04, supply_line.getStartDateRangeMin'
,
0
,
self
.
supply_line
.
getStartDateRangeMin
())
LOG
(
'Test04, supply_line.getStartDateRangeMax'
,
0
,
self
.
supply_line
.
getStartDateRangeMax
())
self
.
supply_line
.
setMappedValuePropertyList
([
'base_price'
,
'priced_quantity'
])
self
.
supply_line
.
setMappedValuePropertyList
([
'base_price'
,
'priced_quantity'
])
self
.
tic
()
self
.
tic
()
domain_tool
=
self
.
getDomainTool
()
domain_tool
=
self
.
getDomainTool
()
...
@@ -338,10 +323,7 @@ class TestDomainTool(TestPredicateMixIn):
...
@@ -338,10 +323,7 @@ class TestDomainTool(TestPredicateMixIn):
mapped_value
=
domain_tool
.
generateMappedValue
(
order_line
,
**
kw
)
mapped_value
=
domain_tool
.
generateMappedValue
(
order_line
,
**
kw
)
self
.
assertEquals
(
mapped_value
.
getBasePrice
(),
23
)
self
.
assertEquals
(
mapped_value
.
getBasePrice
(),
23
)
def
test_05_GenerateMappedValueWithVariation
(
self
,
quiet
=
0
,
run
=
run_all_test
):
def
test_05_GenerateMappedValueWithVariation
(
self
):
if
not
run
:
return
if
not
quiet
:
self
.
logMessage
(
'Generate Mapped Value With Variation'
)
self
.
createData
()
self
.
createData
()
self
.
supply_line
.
setVariationBaseCategoryList
([
'colour'
])
self
.
supply_line
.
setVariationBaseCategoryList
([
'colour'
])
self
.
supply_line
.
setBasePrice
(
23
)
self
.
supply_line
.
setBasePrice
(
23
)
...
@@ -355,7 +337,6 @@ class TestDomainTool(TestPredicateMixIn):
...
@@ -355,7 +337,6 @@ class TestDomainTool(TestPredicateMixIn):
cell
=
self
.
supply_line
.
newCell
(
range
,
base_id
=
'path'
,
portal_type
=
'Supply Cell'
)
cell
=
self
.
supply_line
.
newCell
(
range
,
base_id
=
'path'
,
portal_type
=
'Supply Cell'
)
cell
.
setMappedValuePropertyList
([
'base_price'
,
'priced_quantity'
])
cell
.
setMappedValuePropertyList
([
'base_price'
,
'priced_quantity'
])
cell
.
setMultimembershipCriterionBaseCategoryList
([
'resource'
,
'variation'
])
cell
.
setMultimembershipCriterionBaseCategoryList
([
'resource'
,
'variation'
])
LOG
(
'test, range'
,
0
,
range
)
cell
.
setPricedQuantity
(
1
)
cell
.
setPricedQuantity
(
1
)
if
range
.
find
(
'blue'
)
>=
0
:
if
range
.
find
(
'blue'
)
>=
0
:
cell
.
setMembershipCriterionCategoryList
([
range
])
cell
.
setMembershipCriterionCategoryList
([
range
])
...
@@ -418,10 +399,7 @@ class TestDomainTool(TestPredicateMixIn):
...
@@ -418,10 +399,7 @@ class TestDomainTool(TestPredicateMixIn):
'variation/%s/blue'
%
self
.
resource
.
getRelativeUrl
()]),
'variation/%s/blue'
%
self
.
resource
.
getRelativeUrl
()]),
sort_key_method
=
sort_key_method
),
45
)
sort_key_method
=
sort_key_method
),
45
)
def
test_06_SQLQueryDoesNotReturnTooManyPredicates
(
self
,
quiet
=
0
,
run
=
run_all_test
):
def
test_06_SQLQueryDoesNotReturnTooManyPredicates
(
self
):
if
not
run
:
return
if
not
quiet
:
self
.
logMessage
(
'Check that SQL query does not return unneeded predicates'
)
predicate_both_match
=
self
.
createPredicate
(
predicate_both_match
=
self
.
createPredicate
(
multimembership_criterion_base_category_list
=
[
'group'
,
'region'
],
multimembership_criterion_base_category_list
=
[
'group'
,
'region'
],
membership_criterion_category_list
=
[
GROUP_STOREVER_PATH
,
REGION_FRANCE_PATH
])
membership_criterion_category_list
=
[
GROUP_STOREVER_PATH
,
REGION_FRANCE_PATH
])
...
@@ -439,11 +417,7 @@ class TestDomainTool(TestPredicateMixIn):
...
@@ -439,11 +417,7 @@ class TestDomainTool(TestPredicateMixIn):
# Real test
# Real test
self
.
assertTrue
(
predicate_one_match
not
in
portal_domains
.
searchPredicateList
(
document
,
portal_type
=
self
.
portal_type_query
,
test
=
0
))
self
.
assertTrue
(
predicate_one_match
not
in
portal_domains
.
searchPredicateList
(
document
,
portal_type
=
self
.
portal_type_query
,
test
=
0
))
def
test_07_NonLeftJoinModeOfSearchPredicateList
(
self
,
quiet
=
0
,
run
=
run_all_test
):
def
test_07_NonLeftJoinModeOfSearchPredicateList
(
self
):
if
not
run
:
return
if
not
quiet
:
self
.
logMessage
(
'Test non-left join mode of searchPredicateList method'
)
# Add system preference
# Add system preference
system_preference
=
self
.
portal
.
portal_preferences
.
newContent
(
portal_type
=
'System Preference'
)
system_preference
=
self
.
portal
.
portal_preferences
.
newContent
(
portal_type
=
'System Preference'
)
system_preference
.
setPreferredPredicateCategoryList
(
system_preference
.
setPreferredPredicateCategoryList
(
...
...
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