Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Binh
erp5
Commits
8995b645
Commit
8995b645
authored
12 years ago
by
Julien Muchembled
Browse files
Options
Download
Email Patches
Plain Diff
tests: always start transactions with begin() and make tic() commit automatically
parent
ee196dff
Changes
201
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
31 additions
and
110 deletions
+31
-110
bt5/erp5_configurator_standard/TestTemplateItem/testStandardConfigurationWorkflow.py
...ard/TestTemplateItem/testStandardConfigurationWorkflow.py
+0
-2
bt5/erp5_configurator_standard/bt/revision
bt5/erp5_configurator_standard/bt/revision
+1
-1
bt5/erp5_egov/TestTemplateItem/TestEGovMixin.py
bt5/erp5_egov/TestTemplateItem/TestEGovMixin.py
+1
-6
bt5/erp5_egov/bt/revision
bt5/erp5_egov/bt/revision
+1
-1
bt5/erp5_forum_tutorial/TestTemplateItem/testDiscussionThread.py
...5_forum_tutorial/TestTemplateItem/testDiscussionThread.py
+1
-3
bt5/erp5_forum_tutorial/bt/revision
bt5/erp5_forum_tutorial/bt/revision
+1
-1
bt5/erp5_ingestion/TestTemplateItem/testLiveIngestion.py
bt5/erp5_ingestion/TestTemplateItem/testLiveIngestion.py
+0
-7
bt5/erp5_ingestion/bt/revision
bt5/erp5_ingestion/bt/revision
+1
-1
bt5/erp5_inotify/TestTemplateItem/testInotifyTool.py
bt5/erp5_inotify/TestTemplateItem/testInotifyTool.py
+8
-9
bt5/erp5_inotify/bt/revision
bt5/erp5_inotify/bt/revision
+1
-1
bt5/erp5_social_contracts/TestTemplateItem/testERP5SocialContracts.py
...ial_contracts/TestTemplateItem/testERP5SocialContracts.py
+1
-8
bt5/erp5_social_contracts/bt/revision
bt5/erp5_social_contracts/bt/revision
+1
-1
bt5/erp5_tiosafe_oxatis_test/TestTemplateItem/testOxatisSynchronization.py
...oxatis_test/TestTemplateItem/testOxatisSynchronization.py
+0
-15
bt5/erp5_tiosafe_oxatis_test/bt/revision
bt5/erp5_tiosafe_oxatis_test/bt/revision
+1
-1
bt5/erp5_tiosafe_ubercart_test/TestTemplateItem/testUbercartSynchronisation.py
...cart_test/TestTemplateItem/testUbercartSynchronisation.py
+0
-18
bt5/erp5_tiosafe_ubercart_test/bt/revision
bt5/erp5_tiosafe_ubercart_test/bt/revision
+1
-1
bt5/erp5_tiosafe_virtuemart_test/TestTemplateItem/testVirtuemartSynchronization.py
...rt_test/TestTemplateItem/testVirtuemartSynchronization.py
+1
-22
bt5/erp5_tiosafe_virtuemart_test/bt/revision
bt5/erp5_tiosafe_virtuemart_test/bt/revision
+1
-1
bt5/erp5_upgrader/TestTemplateItem/testLiveUpgrader.py
bt5/erp5_upgrader/TestTemplateItem/testLiveUpgrader.py
+9
-10
bt5/erp5_upgrader/bt/revision
bt5/erp5_upgrader/bt/revision
+1
-1
No files found.
bt5/erp5_configurator_standard/TestTemplateItem/testStandardConfigurationWorkflow.py
View file @
8995b645
...
...
@@ -29,7 +29,6 @@
import
os
import
transaction
from
DateTime
import
DateTime
from
Products.ERP5Type.tests.Sequence
import
SequenceList
from
Products.ERP5Type.tests.backportUnittest
import
expectedFailure
...
...
@@ -795,7 +794,6 @@ class StandardConfigurationMixin(TestLiveConfiguratorWorkflowMixin):
delivery
.
confirm
()
delivery
.
start
()
delivery
.
stop
()
transaction
.
commit
()
self
.
tic
()
# inventories of that resource are index in grams
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_configurator_standard/bt/revision
View file @
8995b645
637
\ No newline at end of file
638
\ No newline at end of file
This diff is collapsed.
Click to expand it.
bt5/erp5_egov/TestTemplateItem/TestEGovMixin.py
View file @
8995b645
...
...
@@ -34,7 +34,6 @@ from AccessControl import Unauthorized
from
Testing
import
ZopeTestCase
from
Products.ERP5Type.tests.Sequence
import
Step
,
Sequence
,
SequenceList
from
zLOG
import
LOG
import
transaction
import
random
import
email
from
email.header
import
decode_header
,
make_header
...
...
@@ -80,7 +79,7 @@ class TestEGovMixin(SecurityTestCase):
for
idx
,
step
in
enumerate
(
self
.
_step_list
):
step
.
play
(
context
,
sequence
=
self
,
quiet
=
quiet
)
# commit transaction after each step
transaction
.
commit
()
self
.
commit
()
Sequence
.
play
=
play
def
play
(
self
,
context
,
sequence
=
None
,
quiet
=
0
):
...
...
@@ -139,7 +138,6 @@ class TestEGovMixin(SecurityTestCase):
self
.
portal
.
__class__
.
DeclarationTVA_zGetSIGTASInformation
\
=
lambda
x
,
**
kw
:
[]
transaction
.
commit
()
self
.
tic
()
def
beforeTearDown
(
self
):
...
...
@@ -148,7 +146,6 @@ class TestEGovMixin(SecurityTestCase):
# we want to keep some IDs
module
.
manage_delObjects
([
x
for
x
in
module
.
objectIds
()
if
x
not
in
(
'EUR'
,)])
transaction
.
commit
()
self
.
tic
()
def
getUserFolder
(
self
)
:
...
...
@@ -200,7 +197,6 @@ class TestEGovMixin(SecurityTestCase):
'group/dgid/di/csf/bf'
)
# make this available to catalog
transaction
.
commit
()
self
.
tic
()
def
createOneOrganisation
(
self
,
username
,
role
=
None
,
function
=
None
,
...
...
@@ -232,7 +228,6 @@ class TestEGovMixin(SecurityTestCase):
role
=
'entreprise/siege'
)
# make this available to catalog
transaction
.
commit
()
self
.
tic
()
def
checkRights
(
self
,
object_list
,
security_mapping
,
username
):
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_egov/bt/revision
View file @
8995b645
758
\ No newline at end of file
759
\ No newline at end of file
This diff is collapsed.
Click to expand it.
bt5/erp5_forum_tutorial/TestTemplateItem/testDiscussionThread.py
View file @
8995b645
from
Products.ERP5Type.tests.SecurityTestCase
import
SecurityTestCase
import
transaction
from
httplib
import
OK
as
HTTP_OK
class
TestDiscussionThread
(
SecurityTestCase
):
...
...
@@ -109,7 +108,6 @@ class TestDiscussionThread(SecurityTestCase):
self
.
assertUserCanViewDocument
(
'forum_user'
,
post
)
self
.
assertUserCanAccessDocument
(
'forum_user'
,
post
)
transaction
.
commit
()
self
.
tic
()
thread_posts
=
thread
.
objectValues
()
...
...
@@ -180,7 +178,7 @@ class TestDiscussionThread(SecurityTestCase):
self
.
assertUserCanPassWorkflowTransition
(
'admin'
,
'close_action'
,
thread
)
thread
.
close
()
transaction
.
commit
()
self
.
commit
()
self
.
assertUserCanViewDocument
(
'admin'
,
thread
)
self
.
assertUserCanAccessDocument
(
'admin'
,
thread
)
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_forum_tutorial/bt/revision
View file @
8995b645
3
\ No newline at end of file
4
\ No newline at end of file
This diff is collapsed.
Click to expand it.
bt5/erp5_ingestion/TestTemplateItem/testLiveIngestion.py
View file @
8995b645
...
...
@@ -34,7 +34,6 @@ from Products.ERP5Type.tests.ERP5TypeTestCase import _getConversionServerDict
from
Products.ERP5Type.tests.ERP5TypeLiveTestCase
import
ERP5TypeLiveTestCase
from
zLOG
import
LOG
,
INFO
,
ERROR
from
Products.CMFCore.utils
import
getToolByName
import
transaction
import
random
import
string
...
...
@@ -85,7 +84,6 @@ class TestIngestion(ERP5TypeLiveTestCase):
document_parent
=
document
.
getParentValue
()
document_parent
.
_delObject
(
doucument_id
)
# Unindex deleted documents
transaction
.
commit
()
self
.
tic
()
def
setSystemPreference
(
self
):
...
...
@@ -121,7 +119,6 @@ class TestIngestion(ERP5TypeLiveTestCase):
script_id
=
'ERP5Site_getTextFileWithFileName'
filename
=
'any_file.txt'
document
=
self
.
contributeFileWithUrl
(
script_id
,
filename
=
filename
)
transaction
.
commit
()
self
.
tic
()
self
.
assertEquals
(
document
.
getPortalType
(),
'Text'
)
self
.
assertEquals
(
document
.
getFilename
(),
filename
)
...
...
@@ -135,7 +132,6 @@ class TestIngestion(ERP5TypeLiveTestCase):
"""
script_id
=
'ERP5Site_getTextFile.txt'
document
=
self
.
contributeFileWithUrl
(
script_id
)
transaction
.
commit
()
self
.
tic
()
self
.
assertEquals
(
document
.
getPortalType
(),
'Text'
)
self
.
assertEquals
(
document
.
getFilename
(),
script_id
)
...
...
@@ -148,7 +144,6 @@ class TestIngestion(ERP5TypeLiveTestCase):
"""
script_id
=
'ERP5Site_getTextFileWithoutContentType.txt'
document
=
self
.
contributeFileWithUrl
(
script_id
)
transaction
.
commit
()
self
.
tic
()
self
.
assertEquals
(
document
.
getPortalType
(),
'Text'
)
self
.
assertEquals
(
document
.
getFilename
(),
script_id
)
...
...
@@ -162,7 +157,6 @@ class TestIngestion(ERP5TypeLiveTestCase):
script_id
=
'ERP5Site_getTextFileWithFileNameAndRedirection'
filename
=
'any_file.txt'
document
=
self
.
contributeFileWithUrl
(
script_id
,
filename
=
filename
)
transaction
.
commit
()
self
.
tic
()
self
.
assertEquals
(
document
.
getPortalType
(),
'Text'
)
self
.
assertEquals
(
document
.
getFilename
(),
filename
)
...
...
@@ -176,7 +170,6 @@ class TestIngestion(ERP5TypeLiveTestCase):
"""
script_id
=
'ERP5Site_getTextFileWithoutFileNameButHTMLContentType'
document
=
self
.
contributeFileWithUrl
(
script_id
)
transaction
.
commit
()
self
.
tic
()
self
.
assertEquals
(
document
.
getPortalType
(),
'Web Page'
)
self
.
assertEquals
(
document
.
getFilename
(),
script_id
)
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_ingestion/bt/revision
View file @
8995b645
140
\ No newline at end of file
141
\ No newline at end of file
This diff is collapsed.
Click to expand it.
bt5/erp5_inotify/TestTemplateItem/testInotifyTool.py
View file @
8995b645
...
...
@@ -27,7 +27,6 @@
##############################################################################
import
os
,
shutil
,
tempfile
,
unittest
import
transaction
from
Acquisition
import
aq_base
from
Products.ERP5Type.Base
import
Base
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
...
...
@@ -45,7 +44,7 @@ class TestInotifyTool(ERP5TypeTestCase):
for
inotify
in
inotify_tool
.
objectValues
():
inotify
.
_setEnabled
(
False
)
inotify_tool
.
_p_changed
=
1
transaction
.
commit
()
self
.
commit
()
def
checkCache
(
notify_list
):
self
.
assertEqual
(
notify_list
,
getattr
(
aq_base
(
inotify_tool
),
'_v_notify_list'
,
None
))
...
...
@@ -53,7 +52,7 @@ class TestInotifyTool(ERP5TypeTestCase):
tmp_dir
=
tempfile
.
mkdtemp
()
try
:
inotify_tool
.
process_timer
(
None
,
None
)
transaction
.
commit
()
self
.
commit
()
checkCache
([])
inotify
=
inotify_tool
.
newContent
(
inode_path
=
'string:'
+
tmp_dir
,
sense_method_id
=
'Inotify_test'
,
...
...
@@ -61,34 +60,34 @@ class TestInotifyTool(ERP5TypeTestCase):
inotify_id
=
inotify
.
getId
()
checkCache
(
None
)
inotify_tool
.
process_timer
(
None
,
None
)
transaction
.
commit
()
self
.
commit
()
checkCache
([])
event_list
=
[]
inotify
.
__class__
.
Inotify_test
=
lambda
self
,
events
:
\
event_list
.
extend
(
events
)
try
:
inotify
.
setEnabled
(
True
)
transaction
.
commit
()
self
.
commit
()
checkCache
(
None
)
inotify_tool
.
process_timer
(
None
,
None
)
transaction
.
commit
()
self
.
commit
()
checkCache
([
inotify_id
])
self
.
assertEqual
(
event_list
,
[])
p
=
os
.
path
.
join
(
tmp_dir
,
'1'
)
with
open
(
p
,
'w'
)
as
f
:
inotify_tool
.
process_timer
(
None
,
None
)
transaction
.
commit
()
self
.
commit
()
self
.
assertEqual
(
event_list
,
[{
'path'
:
p
,
'mask'
:
IN_CREATE
}])
del
event_list
[:]
f
.
write
(
'foo'
)
inotify_tool
.
process_timer
(
None
,
None
)
transaction
.
commit
()
self
.
commit
()
self
.
assertEqual
(
event_list
,
[{
'path'
:
p
,
'mask'
:
IN_MODIFY
}])
del
event_list
[:]
p2
=
os
.
path
.
join
(
tmp_dir
,
'2'
)
os
.
rename
(
p
,
p2
)
inotify_tool
.
process_timer
(
None
,
None
)
transaction
.
commit
()
self
.
commit
()
expected
=
[{
'path'
:
p
,
'mask'
:
IN_DELETE
},
{
'path'
:
p2
,
'mask'
:
IN_CREATE
}]
expected
.
remove
(
event_list
.
pop
())
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_inotify/bt/revision
View file @
8995b645
3
\ No newline at end of file
4
\ No newline at end of file
This diff is collapsed.
Click to expand it.
bt5/erp5_social_contracts/TestTemplateItem/testERP5SocialContracts.py
View file @
8995b645
...
...
@@ -27,10 +27,7 @@
##############################################################################
import
unittest
import
transaction
from
DateTime
import
DateTime
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
...
...
@@ -55,19 +52,17 @@ class TestERP5SocialContracts(ERP5TypeTestCase):
title
=
'Person3'
)
def
beforeTearDown
(
self
):
transaction
.
begin
()
self
.
abort
()
self
.
portal
.
person_module
.
manage_delObjects
(
list
(
self
.
portal
.
person_module
.
objectIds
()))
self
.
portal
.
social_contract_module
.
manage_delObjects
(
list
(
self
.
portal
.
social_contract_module
.
objectIds
()))
transaction
.
commit
()
self
.
tic
()
def
test_getChildCount
(
self
):
self
.
assertEquals
(
0
,
self
.
person_1
.
Person_getChildCount
())
self
.
person_2
.
setNaturalParentValue
(
self
.
person_1
)
transaction
.
commit
()
self
.
tic
()
self
.
assertEquals
(
1
,
self
.
person_1
.
Person_getChildCount
())
...
...
@@ -83,7 +78,6 @@ class TestERP5SocialContracts(ERP5TypeTestCase):
start_date
=
'2001-01-01'
)
contract_1
.
setDestinationValueList
((
self
.
person_1
,
self
.
person_2
))
contract_1
.
validate
()
transaction
.
commit
()
self
.
tic
()
self
.
assertEquals
(
1
,
self
.
person_1
.
Person_getPartnerCount
())
...
...
@@ -94,7 +88,6 @@ class TestERP5SocialContracts(ERP5TypeTestCase):
contract_2
.
setStopDate
(
'3000-01-01'
)
contract_2
.
validate
()
transaction
.
commit
()
self
.
tic
()
self
.
assertEquals
(
2
,
self
.
person_1
.
Person_getPartnerCount
())
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_social_contracts/bt/revision
View file @
8995b645
24
\ No newline at end of file
25
\ No newline at end of file
This diff is collapsed.
Click to expand it.
bt5/erp5_tiosafe_oxatis_test/TestTemplateItem/testOxatisSynchronization.py
View file @
8995b645
...
...
@@ -27,7 +27,6 @@
##############################################################################
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
import
transaction
import
unittest
from
zLOG
import
LOG
from
Testing
import
ZopeTestCase
...
...
@@ -107,7 +106,6 @@ class TestOxatisSynchronization(ERP5TypeTestCase):
if
sync
.
getValidationState
()
!=
"validated"
:
sync
.
validate
()
transaction
.
commit
()
self
.
tic
()
def
beforeTearDown
(
self
):
...
...
@@ -117,7 +115,6 @@ class TestOxatisSynchronization(ERP5TypeTestCase):
for
connector
in
self
.
oxatis
.
contentValues
(
portal_type
=
"Web Service Connector"
):
# use the test connector
connector
.
setTransport
(
"oxatis"
)
transaction
.
commit
()
self
.
tic
()
...
...
@@ -127,12 +124,10 @@ class TestOxatisSynchronization(ERP5TypeTestCase):
for
im
in
[
'organisation_module'
,
'delivered_organisation_module'
,
'person_module'
,
'delivered_person_module'
,]:
LOG
(
"RUNNING SYNCHRO FOR %s"
%
(
im
),
300
,
""
)
transaction
.
commit
()
self
.
tic
()
self
.
oxatis
.
IntegrationSite_synchronize
(
reset
=
reset
,
synchronization_list
=
[
im
,],
batch_mode
=
True
)
transaction
.
commit
()
self
.
tic
()
if
conflict_dict
and
conflict_dict
.
has_key
(
im
):
nb_pub_conflict
,
nb_sub_conflict
,
in_conflict
=
conflict_dict
[
im
]
...
...
@@ -165,12 +160,10 @@ class TestOxatisSynchronization(ERP5TypeTestCase):
def
_runAndCheckResourceSynchronization
(
self
,
reset
=
True
):
# run synchronization
transaction
.
commit
()
self
.
tic
()
self
.
oxatis
.
IntegrationSite_synchronize
(
reset
=
reset
,
synchronization_list
=
[
'product_module'
,],
batch_mode
=
True
)
transaction
.
commit
()
self
.
tic
()
# Check fix point
for
im
in
[
'product_module'
]:
...
...
@@ -219,7 +212,6 @@ class TestOxatisSynchronization(ERP5TypeTestCase):
else
:
if
person
.
getValidationState
()
==
"validated"
:
person
.
invalidate
()
transaction
.
commit
()
self
.
tic
()
# Check initial data
self
.
assertEqual
(
len
(
self
.
portal
.
oxatis_test_module
.
contentValues
(
portal_type
=
"Oxatis Test Person"
)),
6
)
...
...
@@ -454,7 +446,6 @@ class TestOxatisSynchronization(ERP5TypeTestCase):
# Delete products
prod_ids
=
[
x
for
x
in
self
.
portal
.
product_module
.
objectIds
()
if
x
!=
self
.
default_resource_id
]
self
.
portal
.
product_module
.
manage_delObjects
(
prod_ids
)
transaction
.
commit
()
self
.
tic
()
# Check initial data
for
product
in
self
.
portal
.
oxatis_test_module
.
contentValues
(
portal_type
=
"Oxatis Test Product"
):
...
...
@@ -464,7 +455,6 @@ class TestOxatisSynchronization(ERP5TypeTestCase):
else
:
if
product
.
getValidationState
()
==
"validated"
:
product
.
invalidate
()
transaction
.
commit
()
self
.
tic
()
self
.
assertEqual
(
len
(
self
.
portal
.
oxatis_test_module
.
searchFolder
(
portal_type
=
"Oxatis Test Product"
,
...
...
@@ -502,7 +492,6 @@ class TestOxatisSynchronization(ERP5TypeTestCase):
for
product
in
self
.
portal
.
oxatis_test_module
.
contentValues
(
portal_type
=
"Oxatis Test Product"
):
if
product
.
getValidationState
()
!=
"validated"
:
product
.
validate
()
transaction
.
commit
()
self
.
tic
()
self
.
assertEqual
(
len
(
self
.
portal
.
oxatis_test_module
.
searchFolder
(
portal_type
=
"Oxatis Test Product"
,
...
...
@@ -545,7 +534,6 @@ class TestOxatisSynchronization(ERP5TypeTestCase):
self
.
portal
.
sale_order_module
.
manage_delObjects
(
so_ids
)
# Define date on integration site
self
.
oxatis
.
edit
(
stop_date
=
"2010/12/01"
)
transaction
.
commit
()
self
.
tic
()
# Check initial data
self
.
assertEqual
(
len
(
self
.
portal
.
oxatis_test_module
.
contentValues
(
portal_type
=
"Oxatis Test Sale Order"
)),
2
)
...
...
@@ -558,7 +546,6 @@ class TestOxatisSynchronization(ERP5TypeTestCase):
# run synchronization
self
.
oxatis
.
IntegrationSite_synchronize
(
reset
=
True
,
synchronization_list
=
[
'sale_order_module'
,],
batch_mode
=
True
)
transaction
.
commit
()
self
.
tic
()
# Check fix point
...
...
@@ -594,14 +581,12 @@ class TestOxatisSynchronization(ERP5TypeTestCase):
# Change date
self
.
oxatis
.
edit
(
stop_date
=
"2010/12/31"
)
transaction
.
commit
()
self
.
tic
()
# run synchronization
self
.
oxatis
.
IntegrationSite_synchronize
(
reset
=
False
,
synchronization_list
=
[
'sale_order_module'
,],
batch_mode
=
True
)
transaction
.
commit
()
self
.
tic
()
self
.
checkConflicts
(
'sale_order_module'
)
# Check fix point
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_tiosafe_oxatis_test/bt/revision
View file @
8995b645
71
\ No newline at end of file
72
\ No newline at end of file
This diff is collapsed.
Click to expand it.
bt5/erp5_tiosafe_ubercart_test/TestTemplateItem/testUbercartSynchronisation.py
View file @
8995b645
...
...
@@ -27,7 +27,6 @@
##############################################################################
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
import
transaction
import
unittest
from
zLOG
import
LOG
from
Testing
import
ZopeTestCase
...
...
@@ -105,7 +104,6 @@ class TestUbercartSynchronization(ERP5TypeTestCase):
if
sync
.
getValidationState
()
!=
"validated"
:
sync
.
validate
()
transaction
.
commit
()
self
.
tic
()
def
beforeTearDown
(
self
):
...
...
@@ -115,7 +113,6 @@ class TestUbercartSynchronization(ERP5TypeTestCase):
for
connector
in
self
.
ubercart
.
contentValues
(
portal_type
=
"Web Service Connector"
):
# use the test connector
connector
.
setTransport
(
"ubercart"
)
transaction
.
commit
()
self
.
tic
()
...
...
@@ -125,12 +122,10 @@ class TestUbercartSynchronization(ERP5TypeTestCase):
for
im
in
[
'organisation_module'
,
'delivered_organisation_module'
,
\
'person_module'
,
'delivered_person_module'
]:
LOG
(
"RUNNING SYNCHRO FOR %s"
%
(
im
),
300
,
""
)
transaction
.
commit
()
self
.
tic
()
self
.
ubercart
.
IntegrationSite_synchronize
(
reset
=
reset
,
synchronization_list
=
[
im
,],
batch_mode
=
True
)
transaction
.
commit
()
self
.
tic
()
if
conflict_dict
and
conflict_dict
.
has_key
(
im
):
nb_pub_conflict
,
nb_sub_conflict
,
in_conflict
=
conflict_dict
[
im
]
...
...
@@ -155,13 +150,11 @@ class TestUbercartSynchronization(ERP5TypeTestCase):
def
_runAndCheckResourceSynchronization
(
self
,
reset
=
True
,
conflict_dict
=
None
):
# run synchronization
transaction
.
commit
()
self
.
tic
()
LOG
(
"RUNNING SYNCHRO FOR product_module"
,
300
,
""
)
self
.
ubercart
.
IntegrationSite_synchronize
(
reset
=
reset
,
synchronization_list
=
[
'product_module'
,],
batch_mode
=
True
)
transaction
.
commit
()
self
.
tic
()
# Check fix point
for
im
in
[
'product_module'
,]:
...
...
@@ -212,7 +205,6 @@ class TestUbercartSynchronization(ERP5TypeTestCase):
if
person
.
getId
()
!=
self
.
default_node_id
and
person
.
getValidationState
()
!=
"validated"
:
person
.
validate
()
transaction
.
commit
()
self
.
tic
()
# Check initial data
self
.
assertEqual
(
len
(
ubercart_test_module
.
contentValues
(
portal_type
=
"Ubercart Test Person"
)),
2
)
...
...
@@ -391,13 +383,11 @@ class TestUbercartSynchronization(ERP5TypeTestCase):
prod_ids
=
[
x
for
x
in
self
.
portal
.
product_module
.
objectIds
()
if
x
!=
self
.
default_resource_id
]
self
.
portal
.
product_module
.
manage_delObjects
(
prod_ids
)
transaction
.
commit
()
self
.
tic
()
# Check initial data
for
product
in
self
.
portal
.
ubercart_test_module
.
contentValues
(
portal_type
=
"Ubercart Test Product"
):
if
product
.
getValidationState
()
!=
"validated"
:
product
.
validate
()
transaction
.
commit
()
self
.
tic
()
self
.
assertEqual
(
len
(
self
.
portal
.
ubercart_test_module
.
contentValues
(
portal_type
=
"Ubercart Test Product"
,
...
...
@@ -463,7 +453,6 @@ class TestUbercartSynchronization(ERP5TypeTestCase):
if
product_test
.
getTitle
()
==
"Fleure"
:
flower_test
=
product_test
flower_test
.
objectValues
()[
0
].
setCategory
(
"Catalog/Fleure/Rose"
)
transaction
.
commit
()
self
.
tic
()
...
...
@@ -485,7 +474,6 @@ class TestUbercartSynchronization(ERP5TypeTestCase):
if
flower
is
not
None
and
flower_test
is
not
None
:
deleted_cat_list
=
[
c
.
getId
()
for
c
in
flower_test
.
objectValues
()]
flower_test
.
manage_delObjects
(
deleted_cat_list
)
transaction
.
commit
()
self
.
tic
()
tiosafe_category_list
=
flower
.
contentValues
()
plugin_category_list
=
flower_test
.
contentValues
()
...
...
@@ -507,7 +495,6 @@ class TestUbercartSynchronization(ERP5TypeTestCase):
piv
=
flower
.
newContent
(
portal_type
=
"Product Individual Variation"
)
piv
.
setTitle
(
"Fleure/Calice"
)
piv
.
setVariationBaseCategory
(
"collection"
)
transaction
.
commit
()
self
.
tic
()
if
flower
is
not
None
and
flower_test
is
not
None
:
...
...
@@ -533,7 +520,6 @@ class TestUbercartSynchronization(ERP5TypeTestCase):
if
flower
is
not
None
and
flower_test
is
not
None
:
flower
.
objectValues
()[
0
].
setTitle
(
"Fleure/Samanta/Ndiondome"
)
flower
.
objectValues
()[
0
].
setVariationBaseCategory
(
"collection"
)
transaction
.
commit
()
self
.
tic
()
category
=
flower
.
objectValues
()[
0
].
getTitle
()
category_test
=
flower_test
.
objectValues
()[
0
].
getCategory
()
...
...
@@ -603,7 +589,6 @@ class TestUbercartSynchronization(ERP5TypeTestCase):
self
.
portal
.
sale_order_module
.
manage_delObjects
(
so_ids
)
# Define date on integration site
self
.
ubercart
.
edit
(
stop_date
=
"2010/12/01"
)
transaction
.
commit
()
self
.
tic
()
# Check initial data
self
.
assertEqual
(
len
(
self
.
portal
.
ubercart_test_module
.
contentValues
(
portal_type
=
"Ubercart Test Sale Order"
)),
1
)
...
...
@@ -616,7 +601,6 @@ class TestUbercartSynchronization(ERP5TypeTestCase):
# run synchronization
self
.
ubercart
.
IntegrationSite_synchronize
(
reset
=
True
,
synchronization_list
=
[
'sale_order_module'
,],
batch_mode
=
True
)
transaction
.
commit
()
self
.
tic
()
# Check fix point
...
...
@@ -650,13 +634,11 @@ class TestUbercartSynchronization(ERP5TypeTestCase):
self
.
assertNotEqual
(
sale_order
.
getDestinationAdministration
(),
None
)
# Change date
self
.
ubercart
.
edit
(
stop_date
=
"2010/10/31"
)
transaction
.
commit
()
self
.
tic
()
# run synchronization
self
.
ubercart
.
IntegrationSite_synchronize
(
reset
=
False
,
synchronization_list
=
[
'sale_order_module'
,],
batch_mode
=
True
)
transaction
.
commit
()
self
.
tic
()
self
.
checkConflicts
(
'sale_order_module'
)
# Check fix point
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_tiosafe_ubercart_test/bt/revision
View file @
8995b645
31
\ No newline at end of file
32
\ No newline at end of file
This diff is collapsed.
Click to expand it.
bt5/erp5_tiosafe_virtuemart_test/TestTemplateItem/testVirtuemartSynchronization.py
View file @
8995b645
...
...
@@ -27,7 +27,6 @@
##############################################################################
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
import
transaction
import
unittest
from
zLOG
import
LOG
from
Testing
import
ZopeTestCase
...
...
@@ -106,7 +105,6 @@ class TestVirtuemartSynchronization(ERP5TypeTestCase):
if
sync
.
getValidationState
()
!=
"validated"
:
sync
.
validate
()
transaction
.
commit
()
self
.
tic
()
def
beforeTearDown
(
self
):
...
...
@@ -116,7 +114,6 @@ class TestVirtuemartSynchronization(ERP5TypeTestCase):
for
connector
in
self
.
virtuemart
.
contentValues
(
portal_type
=
"Web Service Connector"
):
# use the test connector
connector
.
setTransport
(
"virtuemart"
)
transaction
.
commit
()
self
.
tic
()
...
...
@@ -130,12 +127,10 @@ class TestVirtuemartSynchronization(ERP5TypeTestCase):
node_module_list
=
[
'person_module'
,
'delivered_person_module'
,]
for
im
in
node_module_list
:
LOG
(
"RUNNING SYNCHRO FOR %s"
%
(
im
),
300
,
""
)
transaction
.
commit
()
self
.
tic
()
self
.
virtuemart
.
IntegrationSite_synchronize
(
reset
=
reset
,
synchronization_list
=
[
im
,],
batch_mode
=
True
)
transaction
.
commit
()
self
.
tic
()
if
conflict_dict
and
conflict_dict
.
has_key
(
im
):
nb_pub_conflict
,
nb_sub_conflict
,
in_conflict
=
conflict_dict
[
im
]
...
...
@@ -161,12 +156,10 @@ class TestVirtuemartSynchronization(ERP5TypeTestCase):
def
_runAndCheckResourceSynchronization
(
self
,
conflict_dict
=
None
,
reset
=
True
):
# run synchronization
transaction
.
commit
()
self
.
tic
()
self
.
virtuemart
.
IntegrationSite_synchronize
(
reset
=
reset
,
synchronization_list
=
[
'product_module'
,],
batch_mode
=
True
)
transaction
.
commit
()
self
.
tic
()
# Check fix point
for
im
in
[
'product_module'
]:
...
...
@@ -216,7 +209,6 @@ class TestVirtuemartSynchronization(ERP5TypeTestCase):
if
organisation
.
getValidationState
()
!=
"validated"
:
organisation
.
validate
()
transaction
.
commit
()
self
.
tic
()
# Check initial data
self
.
assertEqual
(
len
(
self
.
portal
.
virtuemart_test_module
.
contentValues
(
portal_type
=
"Virtuemart Test Organisation"
)),
3
)
...
...
@@ -376,7 +368,6 @@ class TestVirtuemartSynchronization(ERP5TypeTestCase):
if
person
.
getValidationState
()
!=
"validated"
:
person
.
validate
()
transaction
.
commit
()
self
.
tic
()
# Check initial data
self
.
assertEqual
(
len
(
self
.
portal
.
virtuemart_test_module
.
contentValues
(
portal_type
=
"Virtuemart Test Person"
)),
4
)
...
...
@@ -500,8 +491,7 @@ class TestVirtuemartSynchronization(ERP5TypeTestCase):
for person in self.portal.virtuemart_test_module.contentValues(portal_type="Virtuemart Test Person"):
if person.getTitle() == "Simple person":
person.edit(city=person_in_orga_update_dict['city'])
transaction.commit()
self.tic()
self.tic()
#self._runAndCheckNodeSynchronization(reset=False)
...
...
@@ -559,7 +549,6 @@ class TestVirtuemartSynchronization(ERP5TypeTestCase):
elif
product
.
getValidationState
()
!=
'validated'
:
product
.
validate
()
transaction
.
commit
()
self
.
tic
()
# Check initial data
...
...
@@ -567,7 +556,6 @@ class TestVirtuemartSynchronization(ERP5TypeTestCase):
if
product
.
getValidationState
()
!=
"validated"
:
product
.
validate
()
transaction
.
commit
()
self
.
tic
()
self
.
assertEqual
(
len
(
self
.
portal
.
virtuemart_test_module
.
contentValues
(
portal_type
=
"Virtuemart Test Product"
,
...
...
@@ -637,7 +625,6 @@ class TestVirtuemartSynchronization(ERP5TypeTestCase):
new_product = self.portal.product_module.newContent(portal_type='Product')
new_product.edit(**erp5_new_product)
new_product.validate()
transaction.commit()
self.tic()
# add to sale supply
...
...
@@ -671,7 +658,6 @@ class TestVirtuemartSynchronization(ERP5TypeTestCase):
if
product
.
getReference
()
==
"PRDNew"
:
if
product
.
getValidationState
()
==
"validated"
:
product
.
invalidate
()
transaction
.
commit
()
self
.
tic
()
self
.
assertEqual
(
len
(
self
.
portal
.
product_module
.
contentValues
()),
6
)
...
...
@@ -690,7 +676,6 @@ class TestVirtuemartSynchronization(ERP5TypeTestCase):
attribut
.
edit
(
category
=
'Color/white'
)
if
attribut
.
getValidationState
()
==
'invalidated'
:
attribut
.
validate
()
transaction
.
commit
()
self
.
tic
()
self
.
_runAndCheckResourceSynchronization
(
reset
=
False
)
self
.
assertEqual
(
len
(
self
.
portal
.
product_module
.
contentValues
()),
original_product_module_lenght
+
5
)
...
...
@@ -705,7 +690,6 @@ class TestVirtuemartSynchronization(ERP5TypeTestCase):
variation_base_category
=
'colour'
)
if
attribut
.
getValidationState
()
!=
'validated'
:
attribut
.
validate
()
transaction
.
commit
()
self
.
tic
()
self
.
_runAndCheckResourceSynchronization
(
reset
=
False
)
self
.
assertEqual
(
len
(
self
.
portal
.
product_module
.
contentValues
()),
original_product_module_lenght
+
5
)
...
...
@@ -719,7 +703,6 @@ class TestVirtuemartSynchronization(ERP5TypeTestCase):
for
attribute
in
product
.
contentValues
(
portal_type
=
"Product Individual Variation"
):
product
.
manage_delObjects
(
ids
=
[
attribute
.
getId
(),])
transaction
.
commit
()
self
.
tic
()
self
.
_runAndCheckResourceSynchronization
(
reset
=
False
)
...
...
@@ -767,7 +750,6 @@ class TestVirtuemartSynchronization(ERP5TypeTestCase):
self
.
portal
.
sale_order_module
.
manage_delObjects
(
so_ids
)
# Define date on integration site
self
.
virtuemart
.
edit
(
stop_date
=
"2010/12/01"
)
transaction
.
commit
()
self
.
tic
()
# Check initial data
self
.
assertEqual
(
len
(
self
.
portal
.
virtuemart_test_module
.
contentValues
(
portal_type
=
"Virtuemart Test Sale Order"
)),
1
)
...
...
@@ -785,7 +767,6 @@ class TestVirtuemartSynchronization(ERP5TypeTestCase):
#sale orders
self
.
virtuemart
.
IntegrationSite_synchronize
(
reset
=
True
,
synchronization_list
=
[
'sale_order_module'
,],
batch_mode
=
True
)
transaction
.
commit
()
self
.
tic
()
# Check fix point
...
...
@@ -823,13 +804,11 @@ class TestVirtuemartSynchronization(ERP5TypeTestCase):
# Change date
self
.
virtuemart
.
edit
(
stop_date
=
"2010/12/31"
)
transaction
.
commit
()
self
.
tic
()
# run synchronization
self
.
virtuemart
.
IntegrationSite_synchronize
(
reset
=
False
,
synchronization_list
=
[
'sale_order_module'
,],
batch_mode
=
True
)
transaction
.
commit
()
self
.
tic
()
self
.
checkConflicts
(
'sale_order_module'
)
# Check fix point
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_tiosafe_virtuemart_test/bt/revision
View file @
8995b645
19
\ No newline at end of file
20
\ No newline at end of file
This diff is collapsed.
Click to expand it.
bt5/erp5_upgrader/TestTemplateItem/testLiveUpgrader.py
View file @
8995b645
...
...
@@ -29,7 +29,6 @@
from
Products.ERP5Type.tests.ERP5TypeLiveTestCase
import
ERP5TypeLiveTestCase
from
Products.ERP5Type.tests.utils
import
createZODBPythonScript
import
transaction
class
TestLiveUpgrader
(
ERP5TypeLiveTestCase
):
"""
...
...
@@ -144,7 +143,7 @@ class TestLiveUpgrader(ERP5TypeLiveTestCase):
createZODBPythonScript
(
self
.
getPortal
().
portal_skins
.
custom
,
'ERP5Site_getUpgraderSignature'
,
"item=None"
,
"return "
+
str
(
signature_code
))
transaction
.
commit
()
self
.
commit
()
self
.
assertEquals
(
self
.
portal
.
ERP5Site_getUpgraderSignature
(),
signature_code
)
self
.
assertEquals
(
self
.
portal
.
ERP5Site_upgradeObjectList
(),
[])
test_object
=
self
.
portal
.
portal_categories
.
newContent
(
id
=
self
.
upgrade_object_test_id
,
...
...
@@ -169,7 +168,7 @@ class TestLiveUpgrader(ERP5TypeLiveTestCase):
createZODBPythonScript
(
self
.
getPortal
().
portal_skins
.
custom
,
'ERP5Site_getUpgraderSignature'
,
"item=None"
,
"return "
+
str
(
signature_code
))
transaction
.
commit
()
self
.
commit
()
self
.
assertEquals
(
self
.
portal
.
ERP5Site_getUpgraderSignature
(),
signature_code
)
# Nothing to upgrade
self
.
assertEquals
(
self
.
portal
.
ERP5Site_upgradeObjectClass
(),
[])
...
...
@@ -188,7 +187,7 @@ class TestLiveUpgrader(ERP5TypeLiveTestCase):
to_class_as_string
,
test_script
)
transaction
.
commit
()
self
.
commit
()
self
.
assertNotEquals
(
self
.
portal
.
ERP5Site_upgradeObjectClass
(),
[])
self
.
assertEquals
(
self
.
portal
.
ERP5Site_upgradeObjectClass
(
upgrade
=
1
),
[(
gadget
.
getRelativeUrl
(),
'ERP5 Gadget'
)])
...
...
@@ -206,7 +205,7 @@ class TestLiveUpgrader(ERP5TypeLiveTestCase):
createZODBPythonScript
(
self
.
getPortal
().
portal_skins
.
custom
,
'ERP5Site_getUpgraderSignature'
,
"item=None"
,
"return "
+
str
(
signature_code
))
transaction
.
commit
()
self
.
commit
()
self
.
assertEquals
(
self
.
portal
.
ERP5Site_getUpgraderSignature
(),
signature_code
)
self
.
assertEquals
(
self
.
portal
.
ERP5Site_upgradeGlobalPropertyList
(),
[
"Upgrade Required for Global Properties."
])
...
...
@@ -229,7 +228,7 @@ class TestLiveUpgrader(ERP5TypeLiveTestCase):
createZODBPythonScript
(
self
.
getPortal
().
portal_skins
.
custom
,
'ERP5Site_getUpgraderSignature'
,
"item=None"
,
"return "
+
str
(
signature_code
))
transaction
.
commit
()
self
.
commit
()
self
.
assertEquals
(
self
.
portal
.
ERP5Site_upgradeWorkflowChain
(),
[])
...
...
@@ -275,7 +274,7 @@ class TestLiveUpgrader(ERP5TypeLiveTestCase):
createZODBPythonScript
(
self
.
getPortal
().
portal_skins
.
custom
,
'ERP5Site_getUpgraderSignature'
,
"item=None"
,
"return "
+
str
(
signature_code
))
transaction
.
commit
()
self
.
commit
()
self
.
assertEquals
(
self
.
portal
.
ERP5Site_getUpgraderSignature
(),
signature_code
)
self
.
assertEquals
(
self
.
portal
.
ERP5Site_upgradePortalTypePropertySheet
(),
[
"Person doesn't has Account associated."
])
...
...
@@ -294,14 +293,14 @@ class TestLiveUpgrader(ERP5TypeLiveTestCase):
'ERP5Site_testRecreateActivityScript'
,
""
,
"context.manage_addProperty('custom_property_without_meaning', 'I was there', 'string')"
)
transaction
.
commit
()
self
.
commit
()
object_to_test
.
activate
().
ERP5Site_testRecreateActivityScript
()
transaction
.
commit
()
self
.
commit
()
# Verify if the final activity is created.
self
.
assertTrue
(
object_to_test
.
hasActivity
(
method_id
=
"ERP5Site_testRecreateActivityScript"
))
self
.
portal
.
portal_activities
.
activate
().
ERP5Site_clearActivities
()
transaction
.
commit
()
self
.
commit
()
self
.
assertTrue
(
object_to_test
.
hasActivity
(
method_id
=
"ERP5Site_testRecreateActivityScript"
))
self
.
assertTrue
(
self
.
portal
.
portal_activities
.
hasActivity
(
method_id
=
'ERP5Site_clearActivities'
))
self
.
stepTic
()
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_upgrader/bt/revision
View file @
8995b645
594
\ No newline at end of file
595
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Prev
1
2
3
4
5
…
11
Next
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