Commit 8995b645 authored by Julien Muchembled's avatar Julien Muchembled

tests: always start transactions with begin() and make tic() commit automatically

parent ee196dff
......@@ -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
......
637
\ No newline at end of file
638
\ No newline at end of file
......@@ -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):
......
758
\ No newline at end of file
759
\ No newline at end of file
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)
......
3
\ No newline at end of file
4
\ No newline at end of file
......@@ -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)
......
140
\ No newline at end of file
141
\ No newline at end of file
......@@ -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())
......
3
\ No newline at end of file
4
\ No newline at end of file
......@@ -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())
......
24
\ No newline at end of file
25
\ No newline at end of file
......@@ -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
......
71
\ No newline at end of file
72
\ No newline at end of file
......@@ -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
......
31
\ No newline at end of file
32
\ No newline at end of file
......@@ -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
......
19
\ No newline at end of file
20
\ No newline at end of file
......@@ -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()
......
594
\ No newline at end of file
595
\ No newline at end of file
......@@ -28,7 +28,6 @@
##############################################################################
import transaction
import httplib
import urlparse
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
......@@ -87,7 +86,6 @@ class TestShaCache(ShaCacheMixin, ERP5TypeTestCase):
self.assertEqual(result, httplib.CREATED)
self.assertEqual(data, self.key)
transaction.commit()
self.tic()
document = self.portal.portal_catalog.getResultValue(reference=self.key)
......@@ -106,7 +104,6 @@ class TestShaCache(ShaCacheMixin, ERP5TypeTestCase):
self.assertEqual(result, httplib.CREATED)
self.assertEqual(data, self.key)
transaction.commit()
self.tic()
document = self.portal.portal_catalog.getResultValue(reference=self.key)
......@@ -121,13 +118,11 @@ class TestShaCache(ShaCacheMixin, ERP5TypeTestCase):
Check if is allowed to put the same file twice.
"""
self.postFile()
transaction.commit()
self.tic()
document = self.portal.portal_catalog.getResultValue(reference=self.key)
self.assertEquals('published', document.getValidationState())
self.postFile()
transaction.commit()
self.tic()
self.assertEquals(2, self.portal.portal_catalog.countResults(
reference=self.key)[0][0])
......@@ -140,9 +135,8 @@ class TestShaCache(ShaCacheMixin, ERP5TypeTestCase):
@expectedFailure
def test_put_file_twice_no_tic(self):
self.postFile()
transaction.commit()
self.commit()
self.postFile()
transaction.commit()
self.tic()
document_list = self.portal.portal_catalog(reference=self.key)
......
63
\ No newline at end of file
64
\ No newline at end of file
......@@ -31,7 +31,6 @@
import httplib
import urlparse
import json
import transaction
import random
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from ShaDirMixin import ShaDirMixin
......@@ -90,7 +89,6 @@ class TestShaDir(ShaDirMixin, ERP5TypeTestCase):
folder = self.portal[module]
folder.manage_delObjects(list(folder.objectIds()))
self.portal.portal_caches.clearAllCache()
transaction.commit()
self.tic()
def test_post_information(self):
......@@ -98,7 +96,6 @@ class TestShaDir(ShaDirMixin, ERP5TypeTestCase):
Check if posting information is working.
"""
self.postInformation()
transaction.commit()
self.tic()
# Asserting Data Set
......@@ -125,7 +122,6 @@ class TestShaDir(ShaDirMixin, ERP5TypeTestCase):
"""
self.postInformation()
transaction.commit()
self.tic()
result, data = self.getInformation()
......@@ -141,11 +137,9 @@ class TestShaDir(ShaDirMixin, ERP5TypeTestCase):
Check if posting information is working.
"""
self.postInformation()
transaction.commit()
self.tic()
self.postInformation()
transaction.commit()
self.tic()
self.assertEqual(1, self.portal.portal_catalog.countResults(
......@@ -175,10 +169,9 @@ class TestShaDir(ShaDirMixin, ERP5TypeTestCase):
Check if posting information is working.
"""
self.postInformation()
transaction.commit()
self.commit()
self.postInformation()
transaction.commit()
self.tic()
self.assertEqual(1, self.portal.portal_catalog.countResults(
......@@ -200,7 +193,6 @@ class TestShaDir(ShaDirMixin, ERP5TypeTestCase):
check if return the temp document with text content.
"""
self.postInformation()
transaction.commit()
self.tic()
result, data = self.getInformation()
......@@ -221,7 +213,6 @@ class TestShaDir(ShaDirMixin, ERP5TypeTestCase):
This relation is controlled by Data Set object.
"""
self.postInformation()
transaction.commit()
self.tic()
urlmd5_2 = 'anotherurlmd5' + str(random.random())
......@@ -237,7 +228,6 @@ class TestShaDir(ShaDirMixin, ERP5TypeTestCase):
"User SIGNATURE goes here."]
data_2 = json.dumps(data_list_2)
self.postInformation(key_2, data_2)
transaction.commit()
self.tic()
self.assertEquals(2, len(self.portal.data_set_module))
......@@ -250,7 +240,6 @@ class TestShaDir(ShaDirMixin, ERP5TypeTestCase):
self.assertEquals(1, len(json.loads(document2)))
self.postInformation()
transaction.commit()
self.tic()
self.assertEquals(2, len(self.portal.data_set_module))
self.assertEquals(3, len(self.portal.document_module))
......
70
\ No newline at end of file
71
\ No newline at end of file
......@@ -29,7 +29,6 @@
import base64
import transaction
import httplib
from DateTime import DateTime
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
......@@ -87,7 +86,6 @@ class TestShaCacheExternal(ShaCacheMixin, ShaSecurityMixin, ERP5TypeTestCase):
try:
connection.request('POST', self.path, self.data, self.header_dict)
result = connection.getresponse()
transaction.commit()
self.tic()
data = result.read()
finally:
......@@ -144,7 +142,6 @@ class TestShaCacheExternal(ShaCacheMixin, ShaSecurityMixin, ERP5TypeTestCase):
try:
connection.request('POST', self.path, self.data, header_dict)
result = connection.getresponse()
transaction.commit()
self.tic()
finally:
connection.close()
......
......@@ -28,7 +28,6 @@
##############################################################################
import transaction
from AccessControl import Unauthorized
from Products.ERP5Type.tests.SecurityTestCase import SecurityTestCase
from ShaCacheMixin import ShaCacheMixin
......@@ -73,7 +72,6 @@ class TestShaCacheSecurity(ShaCacheMixin, ShaSecurityMixin, SecurityTestCase):
'document_module',):
folder = self.portal[module]
folder.manage_delObjects(list(folder.objectIds()))
transaction.commit()
self.tic()
# Tests
......
......@@ -31,7 +31,6 @@
import base64
import json
import os
import transaction
import httplib
from DateTime import DateTime
from Products.ERP5Type.tests.ERP5TypeLiveTestCase import ERP5TypeTestCase
......@@ -87,7 +86,6 @@ class TestShaDirExternal(ShaDirMixin, ShaSecurityMixin, ERP5TypeTestCase):
try:
connection.request('PUT', self.path, self.data, self.header_dict)
result = connection.getresponse()
transaction.commit()
self.tic()
data = result.read()
finally:
......@@ -149,7 +147,6 @@ class TestShaDirExternal(ShaDirMixin, ShaSecurityMixin, ERP5TypeTestCase):
try:
connection.request('PUT', self.path, self.data, header_dict)
result = connection.getresponse()
transaction.commit()
self.tic()
finally:
connection.close()
......@@ -171,7 +168,6 @@ class TestShaDirExternal(ShaDirMixin, ShaSecurityMixin, ERP5TypeTestCase):
try:
connection.request('PUT', self.path, data, self.header_dict)
result = connection.getresponse()
transaction.commit()
self.tic()
data = result.read()
finally:
......
......@@ -28,7 +28,6 @@
##############################################################################
import transaction
from AccessControl import Unauthorized
from Products.ERP5Type.tests.SecurityTestCase import SecurityTestCase
from ShaDirMixin import ShaDirMixin
......@@ -70,7 +69,6 @@ class TestShaDirSecurity(ShaDirMixin, ShaSecurityMixin, SecurityTestCase):
'document_module',):
folder = self.portal[module]
folder.manage_delObjects(list(folder.objectIds()))
transaction.commit()
self.tic()
# Tests
......
26
\ No newline at end of file
27
\ No newline at end of file
......@@ -28,7 +28,6 @@
import unittest
import urllib
import transaction
import ZODB
from ZODB.DemoStorage import DemoStorage
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
......@@ -111,16 +110,16 @@ class TestERP5(ERP5TypeTestCase):
cookie_name = self._testMethodName
portal = self.portal
self.assertEqual(0, portal.getCacheCookie(cookie_name))
transaction.commit()
self.commit()
portal.newCacheCookie(cookie_name) # 1
self.other_node.newCacheCookie(cookie_name) # 1
self.other_node.newCacheCookie(cookie_name) # 2
transaction.commit() # max(1, 2) + 1
self.commit()# max(1, 2) + 1
self.assertEqual(3, portal.getCacheCookie(cookie_name))
def testActiveProcess(self):
active_process = self.portal.portal_activities.newActiveProcess()
transaction.commit()
self.commit()
remote = self.other_node
for id in active_process.getRelativeUrl().split('/'):
remote = getattr(remote, id)
......@@ -128,9 +127,9 @@ class TestERP5(ERP5TypeTestCase):
active_process.postResult(x)
remote.testActiveProcess_postResult(100)
try:
transaction.commit()
self.commit()
except:
transaction.abort() # make failure more readable in case of regression
self.abort() # make failure more readable in case of regression
raise
self.assertEqual(sorted(active_process.getResultList()), range(101))
......
1
\ No newline at end of file
2
\ No newline at end of file
......@@ -32,7 +32,6 @@ from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Testing.ZopeTestCase.PortalTestCase import PortalTestCase
from AccessControl.SecurityManagement import newSecurityManager
from AccessControl.SecurityManagement import noSecurityManager
import transaction
class TestCMFCategory(ERP5TypeTestCase):
......@@ -379,13 +378,11 @@ class TestCMFCategory(ERP5TypeTestCase):
p2 = self.getPersonModule()._getOb(self.id2)
o1 = self.getOrganisationModule()._getOb(self.id1)
p1.setGenderValue(o1)
transaction.commit()
self.tic() # This is required
self.tic()# This is required
self.assertEqual(p1.getGenderValue(),o1)
self.assertEqual(o1.getGenderRelatedValueList(),[p1])
p2.setGenderValue(o1) # reindex implicit
transaction.commit()
self.tic()
self.assertEqual(len(o1.getGenderRelatedValueList()),2)
......@@ -397,12 +394,10 @@ class TestCMFCategory(ERP5TypeTestCase):
p1 = self.getPersonModule()._getOb(self.id1)
p1.setRegion('europe/west/france')
transaction.commit()
self.tic()
west = self.portal.portal_categories.resolveCategory('region/europe/west')
west.setId("ouest")
transaction.commit()
self.tic()
self.assertEqual(west,
......@@ -417,14 +412,12 @@ class TestCMFCategory(ERP5TypeTestCase):
p1 = self.getPersonModule()._getOb(self.id1)
p1.setRegion('europe/west/france')
transaction.commit()
self.tic()
europe = self.portal.portal_categories.resolveCategory('region/europe')
west = europe.west
cb_data = europe.manage_cutObjects(['west'])
self.portal.portal_categories.region.manage_pasteObjects(cb_data)
transaction.commit()
self.tic()
self.assertEqual(west,
......@@ -439,14 +432,12 @@ class TestCMFCategory(ERP5TypeTestCase):
p1 = self.getPersonModule()._getOb(self.id1)
p1.setRegion('europe/west/france')
transaction.commit()
self.tic()
europe = self.portal.portal_categories.resolveCategory('region/europe')
west = europe.west
cb_data = europe.manage_copyObjects(['west'])
self.portal.portal_categories.region.manage_pasteObjects(cb_data)
transaction.commit()
self.tic()
self.assertEqual(west,
......@@ -535,7 +526,6 @@ class TestCMFCategory(ERP5TypeTestCase):
pc = self.getCategoriesTool()
bc = pc.newContent(portal_type='Base Category', id='related_value_test')
self.failUnless(bc is not None)
transaction.commit()
self.tic()
# A newly created base category should be referred to only by itself
value_list = pc.getRelatedValueList(bc)
......@@ -543,7 +533,6 @@ class TestCMFCategory(ERP5TypeTestCase):
c = bc.newContent(portal_type='Category', id='1')
self.failUnless(c is not None)
transaction.commit()
self.tic()
value_list = pc.getRelatedValueList(bc)
# Now the base category should be referred to by itself and this sub category
......@@ -557,7 +546,6 @@ class TestCMFCategory(ERP5TypeTestCase):
org = self.portal.organisation_module.newContent(
id='organisation_test',
destination='person_module/person_test')
transaction.commit()
self.tic()
self.assertEquals(person.getDefaultDestinationRelated(),
'organisation_module/organisation_test' )
......@@ -572,7 +560,6 @@ class TestCMFCategory(ERP5TypeTestCase):
obj = self.getOrganisationModule().newContent(
portal_type = 'Organisation')
obj.setCategoryList(['test_base_cat/test_cat'])
transaction.commit()
self.tic()
self.assert_(obj in [x.getObject() for x in test.getCategoryMemberValueList()])
......@@ -605,7 +592,6 @@ class TestCMFCategory(ERP5TypeTestCase):
organisation = self.getOrganisationModule().newContent(
portal_type='Organisation', region='west/france')
transaction.commit()
self.tic()
self.assertEquals([x.getObject() for x in
......@@ -949,7 +935,6 @@ class TestCMFCategory(ERP5TypeTestCase):
bc = self.portal.portal_categories.newContent(
portal_type='Base Category',
id='first_id')
transaction.commit()
self.tic()
bc.setId('new_id')
self.assertEquals('new_id', bc.getId())
......@@ -964,7 +949,6 @@ class TestCMFCategory(ERP5TypeTestCase):
self.assertNotEquals(line, None)
cell = line.newContent(id='baz', portal_type='Sale Order Cell')
self.assertNotEquals(cell, None)
transaction.commit()
self.tic()
for relative_url, value in (
......@@ -994,7 +978,7 @@ class TestCMFCategory(ERP5TypeTestCase):
#First remove Base Category
self.portal.portal_categories.manage_delObjects(['region'])
obj = self.portal.person_module.newContent(portal_type='Person')
transaction.commit()
self.commit()
try:
#Setters
self.assertRaises(AttributeError, getattr, obj, 'setRegion')
......@@ -1010,7 +994,7 @@ class TestCMFCategory(ERP5TypeTestCase):
finally:
#add Base Category
self.portal.portal_categories.newContent(id='region', portal_type='Base Category')
transaction.commit()
self.commit()
#check Method exists after base_category creation
#Setters
self.assertTrue(getattr(obj, 'setRegion') is not None)
......@@ -1089,7 +1073,6 @@ class TestCMFCategory(ERP5TypeTestCase):
portal_type='Category'),
['id1'])
# Check indexation
transaction.commit()
self.tic()
def test_suite():
......
This diff is collapsed.
......@@ -32,7 +32,6 @@
import unittest
import os
import transaction
from DateTime import DateTime
from Products.ERP5.tests.testAccounting import AccountingTestCase
......@@ -1096,7 +1095,6 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
source_credit=400.0)))
t4.stop()
t4.deliver()
transaction.commit()
self.tic()
# set request variables and render
......@@ -1236,7 +1234,6 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
source_credit=400.0)))
t4.stop()
t4.deliver()
transaction.commit()
self.tic()
......@@ -3843,7 +3840,6 @@ class TestAccountingReportsWithAnalytic(AccountingTestCase, ERP5ReportTestCase):
product_line_value=None,
source_credit=700.0),
))
transaction.commit()
self.tic()
self.login(self.username)
......@@ -3853,7 +3849,7 @@ class TestAccountingReportsWithAnalytic(AccountingTestCase, ERP5ReportTestCase):
preference._edit(
preferred_accounting_transaction_line_function_base_category=None,
preferred_accounting_transaction_line_analytic_base_category_list=())
transaction.commit()
self.commit()
def testJournalAnalyticsShown(self):
request_form = self.portal.REQUEST.form
......
......@@ -43,7 +43,6 @@ way it is used in the invoice related simulation.
import unittest
import random
import transaction
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type.tests.Sequence import SequenceList
......@@ -202,7 +201,7 @@ class TestAccountingRules(TestAccountingRulesMixin, ERP5TypeTestCase):
'default_invoice_transaction_simulation_rule')
if invoice_transaction_rule.getValidationState() == 'validated':
invoice_transaction_rule.invalidate()
transaction.commit()
self.commit()
# delete anything inside the rule first
# clear the message queue, so that it does not contains unexistant paths
......@@ -210,7 +209,7 @@ class TestAccountingRules(TestAccountingRulesMixin, ERP5TypeTestCase):
invoice_transaction_rule.deleteContent(
[x for x in invoice_transaction_rule.objectIds()])
self.assertEquals(len(invoice_transaction_rule.objectValues()), 0)
transaction.commit()
self.commit()
# and add new content, predicate product_line
predicate_product_notebook = invoice_transaction_rule.newContent(
......@@ -489,7 +488,7 @@ class TestAccountingRules(TestAccountingRulesMixin, ERP5TypeTestCase):
'default_payment_simulation_rule')
if payment_rule.getValidationState() == 'validated':
payment_rule.invalidate()
transaction.commit()
self.commit()
# delete anything inside the rule first
# clear the message queue, so that it does not contains unexistant paths
......@@ -497,7 +496,7 @@ class TestAccountingRules(TestAccountingRulesMixin, ERP5TypeTestCase):
payment_rule.deleteContent(
[x.getId() for x in payment_rule.objectValues(
portal_type=['Predicate', self.accounting_rule_cell_portal_type])])
transaction.commit()
self.commit()
# and add a new predicate
payment_rule.newContent(
......@@ -531,7 +530,6 @@ class TestAccountingRules(TestAccountingRulesMixin, ERP5TypeTestCase):
source=line_source_id,
destination=line_destination_id)
payment_rule.validate()
transaction.commit()
self.tic()
def stepCreateEmptyInvoice(self, sequence, **kw) :
......
......@@ -30,7 +30,6 @@
import unittest
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
import transaction
from DateTime import DateTime
class TestAcknowledgementTool(ERP5TypeTestCase):
......@@ -63,7 +62,6 @@ class TestAcknowledgementTool(ERP5TypeTestCase):
stop_date = now+2)
portal.portal_workflow.doActionFor(event, 'start_action')
self.assertEqual(event.getSimulationState(), 'started')
transaction.commit()
self.tic()
acknowledgement_tool_kw = {}
......@@ -98,7 +96,7 @@ class TestAcknowledgementTool(ERP5TypeTestCase):
# the event
self.assertEqual(acknowledgement.getPortalType(), 'Acknowledgement')
self.assertEqual(acknowledgement.getTextContent(), "A Nice Message")
transaction.commit()
self.commit()
# We should not have any acknowledgements, we just committed previous
# transaction, this means that we look if the mechanism that looks at
......
......@@ -31,7 +31,6 @@
Most test-cases are based on the testInvoice.py.
"""
import transaction
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type.tests.SecurityTestCase import SecurityTestCase
from AccessControl.SecurityManagement import newSecurityManager
......@@ -177,7 +176,6 @@ class TestAdvancedInvoice(TestSaleInvoiceMixin, ERP5TypeTestCase):
invoice_transaction = invoice.getCausalityRelatedValue()
transaction_line_1 = invoice_transaction.newContent(portal_type=self.invoice_transaction_line_portal_type)
transaction_line_2 = invoice_transaction.newContent(portal_type=self.invoice_transaction_line_portal_type)
transaction.commit()
self.tic()
transaction_line_1.edit(id ='receivable', source='account_module/customer',
destination='account_module/supplier', quantity=-1665)
......@@ -392,7 +390,6 @@ class TestAdvancedInvoice(TestSaleInvoiceMixin, ERP5TypeTestCase):
quantity=10,
price=3)
invoice.confirm()
transaction.commit()
self.tic()
odt = invoice.Invoice_viewAsODT()
......@@ -426,7 +423,7 @@ class TestAdvancedSaleInvoice(TestAdvancedInvoice):
self.portal.erp5_sql_transactionless_connection.manage_test(
"delete from portal_ids where \
id_group='Accounting_Transaction_Module-Sale_Invoice_Transaction'")
transaction.commit()
self.commit()
def stepCheckInvoicesAndTransactionsConsistency(self, sequence=None, sequence_list=None,
**kw):
......@@ -1138,7 +1135,7 @@ class TestAdvancedPurchaseInvoice(TestAdvancedInvoice):
packing_list.start()
packing_list.stop()
self.assertEquals('stopped', packing_list.getSimulationState())
transaction.commit()
self.commit()
class TestWorkflow(SecurityTestCase):
......@@ -1168,7 +1165,6 @@ class TestWorkflow(SecurityTestCase):
for role in role_list:
type_document = sale_invoice_type.newContent(portal_type='Role Information')
type_document.edit(**role)
transaction.commit()
self.tic()
for role in role_list:
......@@ -1181,7 +1177,6 @@ class TestWorkflow(SecurityTestCase):
node = node.newContent(id=category_id, portal_type='Category')
else:
node = node.get(category_id)
transaction.commit()
self.tic()
person_list = [
......@@ -1203,7 +1198,6 @@ class TestWorkflow(SecurityTestCase):
assignment_document = person_document.newContent(portal_type='Assignment')
assignment_document.edit(function=assignment['function'])
self.portal.portal_workflow.doActionFor(assignment_document, 'open_action')
transaction.commit()
self.tic()
setattr(self, person['id'], person_document)
......
This diff is collapsed.
......@@ -28,7 +28,6 @@
import unittest
import os
import transaction
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from AccessControl.SecurityManagement import newSecurityManager
......@@ -247,7 +246,7 @@ class TestMovement(ERP5TypeTestCase):
self.portal.newContent(id="dummy_delivery_module",
portal_type="My Delivery Module")
transaction.commit()
self.commit()
self.delivery_module = self.portal.dummy_delivery_module
def getPortalName(self):
......@@ -540,7 +539,7 @@ class TestAccountingTransactionLine(TestMovement):
self.portal.newContent(id="accounting_transaction_line_module",
portal_type="My Accounting Transaction Line Module")
transaction.commit()
self.commit()
self.atl_module = self.portal.accounting_transaction_line_module
def _makeOne(self, **kw):
......
......@@ -29,7 +29,6 @@ import unittest
from Products.ERP5Type.tests.utils import reindex
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from zLOG import LOG
import transaction
class TestApparelModel(ERP5TypeTestCase):
......
......@@ -32,7 +32,6 @@
#
import transaction
import os, sys
if __name__ == '__main__':
execfile(os.path.join(sys.path[0], 'framework.py'))
......@@ -112,7 +111,6 @@ class TestApparelTransformation(TestOrderMixin, ERP5TypeTestCase):
variations = [variation1, variation2]
# Commit and catalog
transaction.commit()
self.tic()
component.setVariationBaseCategoryList(['variation'])
......
......@@ -30,7 +30,6 @@
import unittest
import time
import transaction
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type.tests.backportUnittest import expectedFailure
from Products.Formulator.Errors import ValidationError
......@@ -169,7 +168,7 @@ class TestAuthenticationPolicy(ERP5TypeTestCase):
person.notifyLoginFailure()
person.notifyLoginFailure()
transaction.commit()
self.commit()
self.assertTrue(person.isLoginBlocked())
self.stepTic()
self.assertTrue(person.isLoginBlocked())
......
......@@ -30,7 +30,6 @@
import unittest
import time
import transaction
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type.tests.backportUnittest import expectedFailure
from DateTime import DateTime
......
......@@ -29,7 +29,6 @@
##############################################################################
import unittest
import transaction
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from DateTime import DateTime
......
......@@ -31,7 +31,6 @@
import unittest
import os
import transaction
from Testing import ZopeTestCase
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase,\
......@@ -193,7 +192,7 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional):
Check if there is a activity in activity queue.
"""
portal = self.getPortal()
transaction.commit()
self.commit()
message_list = portal.portal_activities.getMessageList()
method_id_list = [x.method_id for x in message_list]
# XXX FIXME: how many activities should be created normally ?
......@@ -949,7 +948,7 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional):
dummy_worlflow_id = 'never_existent_workflow'
addWorkflowByType(pw, 'erp5_workflow', dummy_worlflow_id)
transaction.commit()
self.commit()
cbt = pw._chains_by_type
props = {}
......@@ -960,7 +959,7 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional):
pw.manage_changeWorkflows('', props = props)
pw.manage_delObjects([dummy_worlflow_id])
transaction.commit()
self.commit()
try:
self.assertRaises(AttributeError, getattr, obj,
......@@ -977,7 +976,7 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional):
props['chain_%s' % id] = ','.join(wf_ids)
pw.manage_changeWorkflows('', props = props)
transaction.commit()
self.commit()
def test_14_UpdateRoleMappingwithNoDefinedRoleAndAcquisitionActivatedOnWorkflow(self, quiet=quiet, run=run_all_test):
"""updateRoleMappingsFor does a logical AND between all workflow defining security,
......@@ -1173,7 +1172,7 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional):
'return context.getDummyTypeBaseMethod()' )
transaction.commit() # Flush transactional cache.
self.commit()# Flush transactional cache.
self.assertEqual(pers.getDummyTypeBaseMethod(), pers.getId())
# Call once more to check cache.
self.assertEqual(pers.getDummyTypeBaseMethod(), pers.getId())
......@@ -1187,7 +1186,6 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional):
"""
self.getPortal().person_module.newContent(portal_type='Person',
title='translate_table_test')
transaction.commit()
self.tic()
self.assertEquals(1, len(self.getPortal().portal_catalog(
portal_type='Person', title='translate_table_test')))
......@@ -1244,7 +1242,6 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional):
"""
person = self.portal.person_module.newContent(portal_type='Person')
person.isIndexable = 0
transaction.commit()
self.tic()
self.assertFalse(person.isIndexable)
self.assertEquals(0, len(self.portal.portal_catalog(uid=person.getUid())))
......@@ -1255,7 +1252,6 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional):
"""check if a document is not indexed where we call edit() and set isIndexable=0 after it is already indexed.
"""
person = self.portal.person_module.newContent(portal_type='Person')
transaction.commit()
self.tic()
self.assertTrue(person.isIndexable)
self.assertEquals(1, len(self.portal.portal_catalog(uid=person.getUid())))
......@@ -1264,7 +1260,6 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional):
# not yet False when edit() is called.
person.edit()
person.isIndexable = 0
transaction.commit()
self.tic()
self.assertFalse(person.isIndexable)
self.assertEquals(0, len(self.portal.portal_catalog(uid=person.getUid())))
......@@ -1275,7 +1270,6 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional):
"""check if a document is not indexed where we set isIndexable=0 and call edit() after it is already indexed.
"""
person = self.portal.person_module.newContent(portal_type='Person')
transaction.commit()
self.tic()
self.assertTrue(person.isIndexable)
self.assertEquals(1, len(self.portal.portal_catalog(uid=person.getUid())))
......@@ -1284,7 +1278,6 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional):
# is already False when edit() is called.
person.isIndexable = 0
person.edit()
transaction.commit()
self.tic()
self.assertFalse(person.isIndexable)
self.assertEquals(0, len(self.portal.portal_catalog(uid=person.getUid())))
......
......@@ -27,7 +27,6 @@
import unittest
import transaction
from DateTime import DateTime
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
......@@ -50,10 +49,9 @@ class TestBudget(ERP5TypeTestCase):
category.newContent(portal_type='Category', id='2.2')
def beforeTearDown(self):
transaction.abort()
self.abort()
self.portal.accounting_module.manage_delObjects(
list(self.portal.accounting_module.objectIds()))
transaction.commit()
self.tic()
def getBusinessTemplateList(self):
......@@ -416,7 +414,6 @@ class TestBudget(ERP5TypeTestCase):
atransaction.confirm()
# a confirmed transaction engages budget
transaction.commit()
self.tic()
self.assertEquals(dict(), budget_line.getConsumedBudgetDict())
......@@ -433,7 +430,6 @@ class TestBudget(ERP5TypeTestCase):
atransaction.stop()
# a stopped transaction consumes budget
transaction.commit()
self.tic()
self.assertEquals(
......@@ -556,7 +552,6 @@ class TestBudget(ERP5TypeTestCase):
source_credit=100)
atransaction.stop()
transaction.commit()
self.tic()
self.assertEquals(
......@@ -670,7 +665,6 @@ class TestBudget(ERP5TypeTestCase):
source_credit=300)
atransaction.stop()
transaction.commit()
self.tic()
self.assertEquals(
......@@ -779,7 +773,6 @@ class TestBudget(ERP5TypeTestCase):
source_credit=300)
atransaction.stop()
transaction.commit()
self.tic()
self.assertEquals(
......@@ -884,7 +877,6 @@ class TestBudget(ERP5TypeTestCase):
source_credit=120)
atransaction.stop()
transaction.commit()
self.tic()
self.assertEquals(
......@@ -1018,7 +1010,6 @@ class TestBudget(ERP5TypeTestCase):
source_credit=100)
atransaction.stop()
transaction.commit()
self.tic()
self.assertEquals(
......@@ -1128,7 +1119,6 @@ class TestBudget(ERP5TypeTestCase):
source_credit=100)
atransaction.stop()
transaction.commit()
self.tic()
self.assertEquals(
......@@ -1217,7 +1207,6 @@ class TestBudget(ERP5TypeTestCase):
source_credit=100)
atransaction.stop()
transaction.commit()
self.tic()
self.assertEquals(
......@@ -1304,7 +1293,6 @@ class TestBudget(ERP5TypeTestCase):
source_credit=100)
atransaction.stop()
transaction.commit()
self.tic()
self.assertEquals(
......@@ -1463,7 +1451,6 @@ class TestBudget(ERP5TypeTestCase):
source_debit=100)
atransaction.stop()
transaction.commit()
self.tic()
# Budget_getBudgetConsumptionReportData returns all the data for the report
......@@ -1876,7 +1863,7 @@ class TestBudget(ERP5TypeTestCase):
self.portal.product_module.newContent(portal_type='Product',
id='demo_product',
title='Demo Prduct')
transaction.commit()
self.commit()
budget_model = self.portal.budget_model_module.newContent(
portal_type='Budget Model')
budget_model.newContent(
......@@ -1938,7 +1925,7 @@ class TestBudget(ERP5TypeTestCase):
spll.setQuantity(quantity)
spll.setPrice(price)
spll.setResource('product_module/%s' % product_id)
transaction.commit()
self.commit()
spl.confirm()
self.tic()
spl.start()
......
......@@ -30,7 +30,6 @@
import unittest
import transaction
from DateTime import DateTime
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type.tests.Sequence import SequenceList
......@@ -125,7 +124,6 @@ class TestBug(ERP5TypeTestCase):
start_date='1980-01-01',
stop_date='2099-12-31')
assignment.open()
transaction.commit()
self.tic()
portal_type_list = []
for portal_type in (self.project_portal_type,
......@@ -148,7 +146,6 @@ class TestBug(ERP5TypeTestCase):
role_category='group/dummy')
ti.updateRoleMapping()
transaction.commit()
self.tic()
portal.portal_caches.clearAllCache()
......@@ -596,10 +593,8 @@ class TestBug(ERP5TypeTestCase):
cloned_bug_line = bug_line.Base_createCloneDocument(batch_mode=1)
self.workflow_tool.doActionFor(bug, 'confirm_action', send_event=1)
self.assertEquals(bug.getSimulationState(), 'confirmed')
transaction.commit()
self.tic()
bug.deleteContent(id='2')
transaction.commit()
self.tic()
self.workflow_tool.doActionFor(bug, 'stop_action', send_event=1)
self.assertEquals(bug.getSimulationState(), 'stopped')
......
......@@ -29,7 +29,6 @@
import unittest
import logging
import transaction
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Acquisition import aq_base
......@@ -104,7 +103,7 @@ class BusinessTemplateMixin(TestDeveloperMixin, ERP5TypeTestCase, LogInterceptor
if (content_type_registry is not None and
'any' in content_type_registry.predicate_ids):
content_type_registry.removePredicate('any')
transaction.commit()
self.commit()
def beforeTearDown(self):
"""Remove objects created in tests."""
......@@ -182,7 +181,7 @@ class BusinessTemplateMixin(TestDeveloperMixin, ERP5TypeTestCase, LogInterceptor
for property_sheet in ('UnitTest',):
if property_sheet in property_sheet_tool.objectIds():
property_sheet_tool.manage_delObjects([property_sheet])
transaction.commit()
self.commit()
self._ignore_log_errors()
def getBusinessTemplate(self,title):
......@@ -6177,7 +6176,6 @@ class TestBusinessTemplate(BusinessTemplateMixin):
# create a previously existing instance of the overriden document type
File = portal.portal_types.getPortalTypeClass('File')
portal._setObject('another_file', File('another_file'))
transaction.commit()
self.tic()
# logged errors could keep a reference to a traceback having a reference
# to 'another_file' object
......@@ -6190,14 +6188,12 @@ class TestBusinessTemplate(BusinessTemplateMixin):
bt = template_tool.download(bt_path)
assert marker_list
if i:
transaction.commit()
self.tic()
bt.install(force=1)
assert not marker_list
gc.enable()
for id in object_id_list:
self.assertEqual(getattr(portal, id).int_index, i)
transaction.commit()
self.tic()
finally:
BaseTemplateItem.removeProperties = BaseTemplateItem_removeProperties
......@@ -7145,7 +7141,7 @@ class TestDocumentTemplateItem(BusinessTemplateMixin):
copied, = template_tool.manage_pasteObjects(cb_data)
copied_bt = template_tool._getOb(copied['new_id'])
getattr(copied_bt, self.set_template_id_method_name)(sequence['document_id'])
transaction.commit()
self.commit()
sequence.edit(current_bt=copied_bt)
importFromFilesystem = DocumentComponent.importFromFilesystem
......
This diff is collapsed.
......@@ -26,7 +26,6 @@
#
##############################################################################
import transaction
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5ReportTestCase
from AccessControl.SecurityManagement import newSecurityManager
......@@ -97,15 +96,14 @@ class TestCalendar(ERP5ReportTestCase):
self._addPropertySheet('Group Presence Period', 'CalendarPeriodConstraint')
# regenerate accessors after category changes & portal type changes
transaction.commit()
self.commit()
def beforeTearDown(self):
transaction.abort()
self.abort()
for module in (self.portal.group_calendar_module,
self.portal.leave_request_module,
self.portal.presence_request_module,):
module.manage_delObjects(list(module.objectIds()))
transaction.commit()
self.tic()
def stepCreatePerson(self, sequence=None, sequence_list=None, **kw):
......@@ -814,7 +812,6 @@ class TestCalendar(ERP5ReportTestCase):
person = self.portal.person_module.newContent(portal_type='Person')
assignment = person.newContent(portal_type='Assignment',
calendar_value=group_calendar)
transaction.commit()
self.tic()
# there is 43200 seconds between self.start_date and self.stop_date
......@@ -849,7 +846,6 @@ class TestCalendar(ERP5ReportTestCase):
leave_request.setDestinationValue(person)
leave_request.confirm()
transaction.commit()
self.tic()
self.assertEquals(0, person.getAvailableTime(
......@@ -888,7 +884,6 @@ class TestCalendar(ERP5ReportTestCase):
person = self.portal.person_module.newContent(portal_type='Person')
assignment = person.newContent(portal_type='Assignment',
calendar_value=group_calendar)
transaction.commit()
self.tic()
self.assertEquals((18 - 14 + 12 - 8) * 60 * 60, person.getAvailableTime(
......@@ -922,7 +917,6 @@ class TestCalendar(ERP5ReportTestCase):
leave_request.setDestinationValue(person)
leave_request.confirm()
transaction.commit()
self.tic()
self.assertEquals(0, person.getAvailableTime(
......@@ -959,7 +953,6 @@ class TestCalendar(ERP5ReportTestCase):
person = self.portal.person_module.newContent(portal_type='Person')
assignment = person.newContent(portal_type='Assignment',
calendar_value=group_calendar)
transaction.commit()
self.tic()
# 2008/01/07 was a Monday
......@@ -994,7 +987,6 @@ class TestCalendar(ERP5ReportTestCase):
leave_request.setDestinationValue(person)
leave_request.confirm()
transaction.commit()
self.tic()
self.assertEquals(0, person.getAvailableTime(
......@@ -1025,7 +1017,6 @@ class TestCalendar(ERP5ReportTestCase):
person = self.portal.person_module.newContent(portal_type='Person')
assignment = person.newContent(portal_type='Assignment',
calendar_value=group_calendar)
transaction.commit()
self.tic()
self.assertEquals((18 - 8) * 60 * 60, person.getAvailableTime(
......@@ -1058,7 +1049,6 @@ class TestCalendar(ERP5ReportTestCase):
leave_request.setDestinationValue(person)
leave_request.confirm()
transaction.commit()
self.tic()
self.assertEquals((9-8 + 18-17) * 60 * 60, person.getAvailableTime(
......@@ -1097,7 +1087,6 @@ class TestCalendar(ERP5ReportTestCase):
person = self.portal.person_module.newContent(portal_type='Person')
assignment = person.newContent(portal_type='Assignment',
calendar_value=group_calendar)
transaction.commit()
self.tic()
leave_request = self.portal.leave_request_module.newContent(
portal_type='Leave Request')
......@@ -1110,7 +1099,6 @@ class TestCalendar(ERP5ReportTestCase):
leave_request.setDestinationValue(person)
leave_request.confirm()
transaction.commit()
self.tic()
self.assertEquals((18-9) * 60 * 60, person.getAvailableTime(
......@@ -1146,7 +1134,6 @@ class TestCalendar(ERP5ReportTestCase):
person = self.portal.person_module.newContent(portal_type='Person')
assignment = person.newContent(portal_type='Assignment',
calendar_value=group_calendar)
transaction.commit()
self.tic()
leave_request = self.portal.leave_request_module.newContent(
portal_type='Leave Request')
......@@ -1159,7 +1146,6 @@ class TestCalendar(ERP5ReportTestCase):
leave_request.setDestinationValue(person)
leave_request.confirm()
transaction.commit()
self.tic()
self.assertEquals((17-8) * 60 * 60, person.getAvailableTime(
......@@ -1195,7 +1181,6 @@ class TestCalendar(ERP5ReportTestCase):
person = self.portal.person_module.newContent(portal_type='Person')
assignment = person.newContent(portal_type='Assignment',
calendar_value=group_calendar)
transaction.commit()
self.tic()
leave_request = self.portal.leave_request_module.newContent(
portal_type='Leave Request')
......@@ -1214,7 +1199,6 @@ class TestCalendar(ERP5ReportTestCase):
leave_request.setDestinationValue(person)
leave_request.confirm()
transaction.commit()
self.tic()
self.assertEquals((18-13 + 12-10 + 9-8) * 60 * 60, person.getAvailableTime(
......@@ -1254,7 +1238,6 @@ class TestCalendar(ERP5ReportTestCase):
person = self.portal.person_module.newContent(portal_type='Person')
assignment = person.newContent(portal_type='Assignment',
calendar_value=group_calendar)
transaction.commit()
self.tic()
leave_request = self.portal.leave_request_module.newContent(
portal_type='Leave Request')
......@@ -1273,7 +1256,6 @@ class TestCalendar(ERP5ReportTestCase):
leave_request.setDestinationValue(person)
leave_request.confirm()
transaction.commit()
self.tic()
self.assertEquals((18-11 + 9-8) * 60 * 60, person.getAvailableTime(
......@@ -1311,7 +1293,6 @@ class TestCalendar(ERP5ReportTestCase):
person = self.portal.person_module.newContent(portal_type='Person')
assignment = person.newContent(portal_type='Assignment',
calendar_value=group_calendar)
transaction.commit()
self.tic()
leave_request = self.portal.leave_request_module.newContent(
portal_type='Leave Request')
......@@ -1330,7 +1311,6 @@ class TestCalendar(ERP5ReportTestCase):
leave_request.setDestinationValue(person)
leave_request.confirm()
transaction.commit()
self.tic()
self.assertEquals((18-11 + 9-8) * 60 * 60, person.getAvailableTime(
......@@ -1414,7 +1394,6 @@ class TestCalendar(ERP5ReportTestCase):
self.portal.portal_categories.calendar_period_type.type3)
leave_request2.confirm()
transaction.commit()
self.tic()
# set request variables and render
......
......@@ -28,7 +28,6 @@
##############################################################################
import unittest
import transaction
from Products.ERP5.tests.testTradeModelLine import TestTradeModelLineMixin
......@@ -196,7 +195,7 @@ return getBaseAmountQuantity""")
))
self.appendBaseContributionCategory(order['1'], special_discount)
self.appendBaseContributionCategory(order['2'], special_discount)
transaction.commit()
self.commit()
self.getAggregatedAmountDict(order, partial_check=True,
SPECIAL_DISCOUNT_3CD_LINEAR=dict(total_price=0),
TOTAL_PRICE_WITHOUT_VAT=dict(total_price=8100),
......@@ -209,7 +208,7 @@ return getBaseAmountQuantity""")
quantity=1,
price=2400)
self.appendBaseContributionCategory(line, special_discount)
transaction.commit()
self.commit()
self.getAggregatedAmountDict(order, partial_check=True,
SPECIAL_DISCOUNT_3CD_LINEAR=dict(total_price=-1040),
TOTAL_PRICE_WITHOUT_VAT=dict(total_price=9460),
......@@ -252,7 +251,7 @@ return lambda delivery_amount, base_application, **kw: \\
))
self.appendBaseContributionCategory(order['1'], special_discount)
self.appendBaseContributionCategory(order['2'], special_discount)
transaction.commit()
self.commit()
self.getAggregatedAmountDict(order, partial_check=True,
SPECIAL_DISCOUNT_3CD_FIXED=dict(total_price=0),
TOTAL_PRICE_WITHOUT_VAT=dict(total_price=11000),
......@@ -265,7 +264,7 @@ return lambda delivery_amount, base_application, **kw: \\
quantity=1,
price=2400)
self.appendBaseContributionCategory(line, special_discount)
transaction.commit()
self.commit()
self.getAggregatedAmountDict(order, partial_check=True,
SPECIAL_DISCOUNT_3CD_FIXED=dict(total_price=-500),
TOTAL_PRICE_WITHOUT_VAT=dict(total_price=12900),
......@@ -312,7 +311,7 @@ return getBaseAmountQuantity""")
))
self.appendBaseContributionCategory(order['1'], special_discount)
self.appendBaseContributionCategory(order['3'], special_discount)
transaction.commit()
self.commit()
self.getAggregatedAmountDict(order, partial_check=True,
SPECIAL_DISCOUNT_3CD_LINEAR=dict(total_price=0),
TOTAL_PRICE_WITHOUT_VAT=dict(total_price=11000),
......@@ -325,7 +324,7 @@ return getBaseAmountQuantity""")
quantity=1,
price=2400)
self.appendBaseContributionCategory(line, special_discount)
transaction.commit()
self.commit()
self.getAggregatedAmountDict(order, partial_check=True,
SPECIAL_DISCOUNT_3CD_LINEAR=dict(total_price=-1340),
TOTAL_PRICE_WITHOUT_VAT=dict(total_price=12060),
......@@ -372,7 +371,7 @@ return lambda delivery_amount, base_application, **kw: \\
dict(id='1', price=3000, quantity=2, resource_value=self.music_album_4),
))
self.appendBaseContributionCategory(order['1'], poster_present_3cd)
transaction.commit()
self.commit()
self.getAggregatedAmountDict(order, partial_check=True,
SPECIAL_DISCOUNT_3CD_OR_1DVD_FIXED=dict(total_price=None),
TOTAL_PRICE_WITHOUT_VAT=dict(total_price=6000),
......@@ -385,7 +384,7 @@ return lambda delivery_amount, base_application, **kw: \\
quantity=1,
price=3000)
self.appendBaseContributionCategory(line, poster_present_1dvd)
transaction.commit()
self.commit()
self.getAggregatedAmountDict(order, partial_check=True,
SPECIAL_DISCOUNT_3CD_OR_1DVD_FIXED=dict(total_price=None, quantity=1,
resource_value=self.poster),
......@@ -399,7 +398,7 @@ return lambda delivery_amount, base_application, **kw: \\
quantity=1,
price=2400)
self.appendBaseContributionCategory(line, poster_present_3cd)
transaction.commit()
self.commit()
self.getAggregatedAmountDict(order, partial_check=True,
SPECIAL_DISCOUNT_3CD_OR_1DVD_FIXED=dict(total_price=None, quantity=1,
resource_value=self.poster),
......@@ -448,7 +447,7 @@ return getBaseAmountQuantity""")
))
self.appendBaseContributionCategory(order['3'], special_discount)
self.appendBaseContributionCategory(order['4'], special_discount)
transaction.commit()
self.commit()
self.getAggregatedAmountDict(order, partial_check=True,
SPECIAL_DISCOUNT_3CD=dict(total_price=0),
TOTAL_PRICE_WITHOUT_VAT=dict(total_price=12000),
......@@ -457,7 +456,7 @@ return getBaseAmountQuantity""")
# add one more cd, then total is 3. the special discount will be applied.
order['3'].setQuantity(2)
transaction.commit()
self.commit()
self.getAggregatedAmountDict(order, partial_check=True,
SPECIAL_DISCOUNT_3CD=dict(total_price=-450),
TOTAL_PRICE_WITHOUT_VAT=dict(total_price=16550),
......@@ -488,7 +487,7 @@ return lambda *args, **kw: 1""")
dict(id='1', price=3000, quantity=1, resource_value=self.movie_dvd_1),
dict(id='2', price=1000, quantity=1, resource_value=self.movie_dvd_2),
))
transaction.commit()
self.commit()
self.getAggregatedAmountDict(order, partial_check=True,
TOTAL_PRICE_WITHOUT_VAT=dict(total_price=4500),
TOTAL_PRICE_WITH_VAT=dict(total_price=4725),
......
......@@ -28,7 +28,6 @@
import unittest
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type.tests.utils import to_utf8
import transaction
class TestContentTranslation(ERP5TypeTestCase):
......@@ -61,7 +60,6 @@ class TestContentTranslation(ERP5TypeTestCase):
portal.Localizer._add_user_defined_language('Nobody Readable', 'nob-read')
portal.Localizer.add_language('nob-read')
transaction.commit()
self.tic()
person1 = portal.person_module.newContent(portal_type='Person',
......@@ -85,7 +83,6 @@ class TestContentTranslation(ERP5TypeTestCase):
self.assertEqual(person2.getNobReadTranslatedLastName(' '), ' ')
self.assertEqual(person3.getNobReadTranslatedFirstName('友介'), '友介')
self.assertEqual(person3.getNobReadTranslatedLastName('村岡'), '村岡')
transaction.commit()
self.tic()
result1 = portal.portal_catalog(content_translation_title='Yusuke')
......@@ -100,7 +97,6 @@ class TestContentTranslation(ERP5TypeTestCase):
# re-catalog
person3.setNobReadTranslatedFirstName('ゆうすけ')
transaction.commit()
self.tic()
result3 = portal.portal_catalog(content_translation_title='友介')
......@@ -108,7 +104,6 @@ class TestContentTranslation(ERP5TypeTestCase):
# un-catalog
portal.person_module.manage_delObjects(person3.getId())
transaction.commit()
self.tic()
result4 = portal.portal_catalog(content_translation_title='村岡')
......@@ -140,7 +135,6 @@ class TestContentTranslation(ERP5TypeTestCase):
portal_type='Person',
first_name='John',
last_name='Smith')
transaction.commit()
self.tic()
self.assertEqual(getattr(person, 'setJaKanaTranslatedFirstName', False),
......@@ -155,7 +149,6 @@ class TestContentTranslation(ERP5TypeTestCase):
##
portal.Localizer._add_user_defined_language('Japanese Kana', 'ja-kana')
portal.Localizer.add_language('ja-kana')
transaction.commit()
self.tic()
self.assert_(getattr(person, 'setJaKanaTranslatedFirstName', False))
......@@ -178,7 +171,6 @@ class TestContentTranslation(ERP5TypeTestCase):
self.assert_(person.hasJaKanaTranslatedFirstName())
transaction.commit()
self.tic()
self.assert_('タハラ' in to_utf8(person.Base_viewContentTranslation()))
......
......@@ -29,7 +29,6 @@
import unittest
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
import transaction
class TestContributionRegistryTool(ERP5TypeTestCase):
......@@ -70,7 +69,6 @@ return predicate.getDestinationPortalType()
""")
self.portal.manage_addProduct['PythonScripts'].manage_addPythonScript(id='IngestionFile_testEvent')
self.portal.IngestionFile_testEvent.write(python_script_src)
transaction.commit()
self.tic()
def setUpPredicate(self):
......@@ -83,7 +81,6 @@ return predicate.getDestinationPortalType()
id=predicate_id)
predicate.setCriterion('content_type', identity=['text/html'])
predicate.setDestinationPortalType('Web Page')
transaction.commit()
self.tic()
predicate_id = 'webpage_by_extension'
......@@ -93,7 +90,6 @@ return predicate.getDestinationPortalType()
id=predicate_id)
predicate.setCriterion('extension_from_filename', identity=['html'])
predicate.setDestinationPortalType('Web Page')
transaction.commit()
self.tic()
predicate_id = 'email_by_extension_and_content_type'
......@@ -105,7 +101,6 @@ return predicate.getDestinationPortalType()
predicate.setCriterion('content_type', identity=['message/rfc822'])
predicate.setDestinationPortalType('Mail Message')
predicate.setTestMethodId('IngestionFile_testEvent')
transaction.commit()
self.tic()
predicate_id = 'text_by_extension'
......@@ -115,7 +110,6 @@ return predicate.getDestinationPortalType()
id=predicate_id)
predicate.setCriterion('extension_from_filename', identity=['odt', 'txt'])
predicate.setDestinationPortalType('Text')
transaction.commit()
self.tic()
predicate_id = 'image_by_extension'
......@@ -125,7 +119,6 @@ return predicate.getDestinationPortalType()
id=predicate_id)
predicate.setCriterion('extension_from_filename', identity=['jpg', 'png'])
predicate.setDestinationPortalType('Image')
transaction.commit()
self.tic()
def testFindPortalTypeName(self, quiet=0, run=run_all_test):
......
......@@ -32,7 +32,6 @@
"""
import unittest
import transaction
from DateTime import DateTime
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5ReportTestCase
......@@ -232,14 +231,13 @@ class CrmTestCase(ERP5ReportTestCase):
doc.validate()
# and all this available to catalog
transaction.commit()
self.tic()
def beforeTearDown(self):
"""Remove all documents.
"""
transaction.abort()
self.abort()
for module in (self.campaign_module,
self.meeting_module,
self.sale_opportunity_module,
......@@ -249,7 +247,6 @@ class CrmTestCase(ERP5ReportTestCase):
self.event_module):
module.manage_delObjects(list(module.objectIds()))
self.portal_categories['group'].manage_delObjects((['demo_group',]))
transaction.commit()
self.tic()
def getBusinessTemplateList(self):
......@@ -365,7 +362,6 @@ class TestCrmReports(CrmTestCase):
causality=eventOut1.getRelativeUrl(),
follow_up=second.getRelativeUrl())
transaction.commit()
self.tic()
request_form = self.portal.REQUEST.other
request_form['from_date'] = DateTime(2007, 1, 1)
......@@ -512,7 +508,6 @@ class TestCrmReports(CrmTestCase):
causality=second_event_out1.getRelativeUrl(),
follow_up=second.getRelativeUrl())
transaction.commit()
self.tic()
# set request variables and render
request_form = self.portal.REQUEST.other
......@@ -676,7 +671,6 @@ class TestCrmReports(CrmTestCase):
causality=eventOut1.getRelativeUrl(),
follow_up=second.getRelativeUrl())
transaction.commit()
self.tic()
# set request variables and render
request_form = self.portal.REQUEST.other
......@@ -822,7 +816,6 @@ class TestCrmReports(CrmTestCase):
causality=second_event_out1.getRelativeUrl(),
follow_up=second.getRelativeUrl())
transaction.commit()
self.tic()
# set request variables and render
request_form = self.portal.REQUEST.other
......@@ -986,7 +979,6 @@ class TestCrmReports(CrmTestCase):
causality=second_event_inc1.getRelativeUrl(),
follow_up=second.getRelativeUrl())
transaction.commit()
self.tic()
# set request variables and render
request_form = self.portal.REQUEST.other
......@@ -1132,7 +1124,6 @@ class TestCrmReports(CrmTestCase):
causality=second_event_inc1.getRelativeUrl(),
follow_up=second.getRelativeUrl())
transaction.commit()
self.tic()
# set request variables and render
request_form = self.portal.REQUEST.other
......@@ -1296,7 +1287,6 @@ class TestCrmReports(CrmTestCase):
causality=eventOut1.getRelativeUrl(),
follow_up=second.getRelativeUrl())
transaction.commit()
self.tic()
# set request variables and render
request_form = self.portal.REQUEST.other
......@@ -1442,7 +1432,6 @@ class TestCrmReports(CrmTestCase):
causality=second_event_out1.getRelativeUrl(),
follow_up=second.getRelativeUrl())
transaction.commit()
self.tic()
# set request variables and render
request_form = self.portal.REQUEST.other
......@@ -1701,7 +1690,6 @@ class TestCrmReports(CrmTestCase):
causality=event6.getRelativeUrl(),
follow_up=campaign.getRelativeUrl())
transaction.commit()
self.tic()
# set request variables and render
request_form = self.portal.REQUEST.other
......@@ -2044,7 +2032,6 @@ class TestCrmReports(CrmTestCase):
causality=event6.getRelativeUrl(),
follow_up=campaign.getRelativeUrl())
transaction.commit()
self.tic()
# set request variables and render
request_form = self.portal.REQUEST.other
......
......@@ -29,7 +29,6 @@
##############################################################################
import unittest
import transaction
from Products.ERP5Type.tests.Sequence import Sequence, SequenceList
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
......@@ -92,7 +91,6 @@ class TestDataProtection(ERP5TypeTestCase):
document = portal.restrictedTraverse(sequence.get('document_relative_url'))
document.Base_addDataProtectionRequest(
description='I think the description is compromised')
transaction.commit()
self.tic()
data_protection = document.getAgentRelatedValueList(
portal_type=portal_type)[0]
......
......@@ -27,7 +27,6 @@
##############################################################################
import unittest
import transaction
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type.tests.Sequence import Sequence
from Products.ERP5.tests.testPackingList import TestPackingListMixin
......@@ -56,13 +55,12 @@ class TestDivergenceTester(TestPackingListMixin, ERP5TypeTestCase):
validation_state="validated")
def beforeTearDown(self):
transaction.abort()
self.abort()
portal_rules = self.portal.portal_rules
rule_id_list = [rule_id for rule_id in portal_rules.objectIds()
if rule_id.startswith('testDivergenceTester_')]
if rule_id_list:
portal_rules.deleteContent(rule_id_list)
transaction.commit()
self.tic()
def stepResetDeliveringRule(self, sequence):
......@@ -74,7 +72,6 @@ class TestDivergenceTester(TestPackingListMixin, ERP5TypeTestCase):
new_rule_id = prefix + rule.getId()
new_rule_reference = prefix + rule.getReference()
rule = portal_rules.manage_clone(rule, new_rule_id)
transaction.savepoint(optimistic=True)
rule.setVersion(str(int(rule.getVersion()) + 1))
rule.setReference(new_rule_reference)
tester_list = rule.contentValues(
......@@ -86,7 +83,6 @@ class TestDivergenceTester(TestPackingListMixin, ERP5TypeTestCase):
if movement is not None:
applied_rule = movement.getDeliveryRelatedValue().getParentValue()
applied_rule.setSpecialiseValue(rule)
transaction.commit()
self.tic()
sequence.edit(rule=rule)
......
This diff is collapsed.
......@@ -28,7 +28,6 @@
##############################################################################
import unittest
import transaction
from Products.ERP5.tests.testInventoryAPI import InventoryAPITestCase
class TestERP5Administration(InventoryAPITestCase):
......@@ -53,7 +52,6 @@ class TestERP5Administration(InventoryAPITestCase):
alarm = portal.portal_alarms.check_stock
def checkActiveProcess(failed):
transaction.commit()
self.tic()
self.assertEqual(alarm.getLastActiveProcess().ActiveProcess_sense(),
failed)
......@@ -68,7 +66,6 @@ class TestERP5Administration(InventoryAPITestCase):
alarm.setAlarmNotificationMode('never')
mvt = self._makeMovement(quantity=1.23)
transaction.commit()
self.tic()
alarm.activeSense()
checkActiveProcess(0)
......@@ -107,7 +104,6 @@ class TestERP5Administration(InventoryAPITestCase):
# this alarm can solve, as long as the constraints can solve, this is the
# case of PropertyTypeValidity
alarm.solve()
transaction.commit()
self.tic()
self.assertEquals('3', person.title)
......
......@@ -29,7 +29,6 @@
import os
import unittest
import transaction
from DateTime import DateTime
from Products.ERP5Type.Utils import convertToUpperCase
......@@ -81,11 +80,10 @@ class TestERP5Base(ERP5TypeTestCase):
self.createCategories()
def beforeTearDown(self):
transaction.abort()
self.abort()
for module in ( self.portal.person_module,
self.portal.organisation_module, ):
module.manage_delObjects(list(module.objectIds()))
transaction.commit()
self.tic()
##################################
......@@ -515,7 +513,6 @@ class TestERP5Base(ERP5TypeTestCase):
self._checkCategoryAccessorList(person, tested_base_category_list)
# skill must be acquired on person
transaction.commit()
self.tic()
category_dict_list = self.getCategoryDictList('skill')
skill_object_list = []
......@@ -1037,7 +1034,6 @@ class TestERP5Base(ERP5TypeTestCase):
active_process = portal_activities.newActiveProcess()
portal_activities.ERP5Site_checkDataWithScript(method_id=test, tag=test,
active_process=active_process.getPath())
transaction.commit()
self.tic()
relative_url_list = sum((x.detail.split('\n')
for x in active_process.getResultList()), [])
......@@ -1070,7 +1066,6 @@ class TestERP5Base(ERP5TypeTestCase):
person_2 = self.portal.person_module.newContent(portal_type='Person')
organisation = self.portal.organisation_module.newContent(
portal_type='Organisation')
transaction.commit()
self.tic()
# patch the method, we'll abort later
......@@ -1087,7 +1082,7 @@ class TestERP5Base(ERP5TypeTestCase):
[x.getObject() for x in
self.portal.portal_catalog(translated_validation_state_title='Brouillon',
translated_portal_type='Personne')])
transaction.abort()
self.abort()
def test_Base_createCloneDocument(self):
module = self.portal.person_module
......@@ -1168,7 +1163,6 @@ class TestERP5Base(ERP5TypeTestCase):
reference='user_login',
password='pass',
password_confirm='pass')
transaction.commit()
self.tic()
# a user is created
......
......@@ -27,7 +27,6 @@
##############################################################################
import unittest
import transaction
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type.Base import _aq_reset
from AccessControl.SecurityManagement import newSecurityManager
......@@ -90,7 +89,7 @@ class TestERP5Category(ERP5TypeTestCase):
type_info = self.getTypeTool().Organisation
type_info._setTypeBaseCategoryList([self.base_cat, self.base_cat2])
transaction.commit()
self.commit()
organisation_module = self.getOrganisationModule()
if not organisation_module.has_key('1'):
......@@ -137,7 +136,7 @@ class TestERP5Category(ERP5TypeTestCase):
predicate.setCriterion('quantity', identity=None, min=None, max=None)
self.predicate = predicate
transaction.commit() # If we don't commit, then we can't rename
self.commit()# If we don't commit, then we can't rename
self.tic()
def beforeTearDown(self):
......@@ -166,7 +165,6 @@ class TestERP5Category(ERP5TypeTestCase):
def commitAndTic(self):
"""Just to save one line.
"""
transaction.commit()
self.tic()
def test_01_RenameCategory(self, quiet=quiet, run=run_all_test):
......@@ -321,7 +319,7 @@ class TestERP5Category(ERP5TypeTestCase):
ttool = self.getTypesTool()
ttool['Organisation']._setTypeBaseCategoryList(['test_aq_category'])
ttool['Telephone']._setTypeBaseCategoryList(['test_aq_category'])
transaction.commit()
self.commit()
doc = self.organisation
subdoc = doc['1']
......@@ -339,7 +337,7 @@ class TestERP5Category(ERP5TypeTestCase):
self.assertEquals([], ctool.getAcquiredCategoryList(doc))
# XXX this test's beforeTearDown commits transaction
transaction.abort()
self.abort()
def test_suite():
......
This diff is collapsed.
......@@ -30,7 +30,6 @@
import os
import unittest
import transaction
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from AccessControl.SecurityManagement import newSecurityManager
......@@ -53,11 +52,10 @@ class TestERP5Coordinate(ERP5TypeTestCase):
'erp5_base',)
def beforeTearDown(self):
transaction.abort()
self.abort()
for module in ( self.portal.person_module,
self.portal.organisation_module, ):
module.manage_delObjects(list(module.objectIds()))
transaction.commit()
self.tic()
def test_data_coordinate_text_property(self):
......
This diff is collapsed.
This diff is collapsed.
......@@ -29,7 +29,6 @@
##############################################################################
import unittest
import transaction
from AccessControl.SecurityManagement import newSecurityManager
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type.tests.backportUnittest import expectedFailure
......@@ -71,10 +70,9 @@ class TestERP5Discussion(ERP5TypeTestCase):
self.auth = '%s:%s' % (self.manager_username, self.manager_password)
def beforeTearDown(self):
transaction.abort()
self.abort()
for module in (self.portal.discussion_thread_module,):
module.manage_delObjects(list(module.objectIds()))
transaction.commit()
self.tic()
def stepCreateThread(self):
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -30,7 +30,6 @@
import unittest
import time
import transaction
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type.tests.backportUnittest import expectedFailure
from Products.Formulator.Errors import ValidationError
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment