Commit 16b1573b authored by Jérome Perrin's avatar Jérome Perrin

use transaction module instead of get_transaction


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@26926 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 0e2ae07c
......@@ -38,10 +38,7 @@ then erp5_content.pot and erp5_ui.pot will be made in the current directory.
"""
import unittest
try:
from transaction import get as get_transaction
except ImportError:
pass
import transaction
# we reuse TestXHTML test.
from Products.ERP5.tests.testXHTML import TestXHTML
......
This diff is collapsed.
......@@ -31,6 +31,7 @@
import unittest
import transaction
from DateTime import DateTime
from Products.ERP5.tests.testAccounting import AccountingTestCase
......@@ -57,7 +58,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
# workaround the fact that Balance Transaction Line are not unindexed
# correctly when removed
self.portal.erp5_sql_connection.manage_test('TRUNCATE TABLE stock')
get_transaction().commit()
transaction.commit()
def testJournal(self):
# Journal report.
......@@ -922,7 +923,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
source_credit=400.0)))
t4.stop()
t4.deliver()
get_transaction().commit()
transaction.commit()
self.tic()
# set request variables and render
......
......@@ -44,6 +44,8 @@ import unittest
import os
import random
import transaction
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type.tests.Sequence import Sequence, SequenceList
......@@ -208,7 +210,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)
get_transaction().commit()
transaction.commit()
# and add new content, predicate product_line
predicate_product_notebook = invoice_transaction_rule.newContent(
......
......@@ -27,6 +27,7 @@
##############################################################################
import unittest
import transaction
from Testing import ZopeTestCase
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
......@@ -99,7 +100,7 @@ class TestAlarm(ERP5TypeTestCase):
ZopeTestCase._print('\n%s ' % message)
LOG('Testing... ',0,message)
alarm = self.newAlarm()
get_transaction().commit()
transaction.commit()
self.tic()
now = DateTime()
date = addToDate(now,day=1)
......@@ -119,7 +120,7 @@ class TestAlarm(ERP5TypeTestCase):
date = addToDate(now,day=2)
alarm.setPeriodicityStartDate(date)
alarm.setPeriodicityHourFrequency(1)
get_transaction().commit()
transaction.commit()
self.tic()
alarm.setNextAlarmDate(current_date=now)
self.assertEquals(alarm.getAlarmDate(),date)
......@@ -147,7 +148,7 @@ class TestAlarm(ERP5TypeTestCase):
date = addToDate(now,day=2)
alarm.setPeriodicityStartDate(date)
alarm.setPeriodicityHourFrequency(3)
get_transaction().commit()
transaction.commit()
self.tic()
alarm.setNextAlarmDate(current_date=now)
self.assertEquals(alarm.getAlarmDate(),date)
......@@ -178,7 +179,7 @@ class TestAlarm(ERP5TypeTestCase):
hour_list = (6,10,15,21)
alarm.setPeriodicityStartDate(now)
alarm.setPeriodicityHourList(hour_list)
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEquals(alarm.getAlarmDate(),right_first_date)
alarm.setNextAlarmDate(current_date=right_first_date)
......@@ -203,7 +204,7 @@ class TestAlarm(ERP5TypeTestCase):
alarm.setPeriodicityStartDate(now)
alarm.setPeriodicityDayFrequency(1)
alarm.setPeriodicityHourList((10,))
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEquals(alarm.getAlarmDate(),right_first_date)
alarm.setNextAlarmDate(current_date=right_first_date)
......@@ -227,7 +228,7 @@ class TestAlarm(ERP5TypeTestCase):
alarm.setPeriodicityStartDate(right_first_date)
alarm.setPeriodicityDayFrequency(3)
alarm.setPeriodicityHourList((14,15,17))
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEquals(alarm.getAlarmDate(),right_first_date)
alarm.setNextAlarmDate(current_date=right_first_date)
......@@ -254,7 +255,7 @@ class TestAlarm(ERP5TypeTestCase):
alarm.setPeriodicityStartDate(right_first_date)
alarm.setPeriodicityDayFrequency(4)
alarm.setPeriodicityHourList((14,15,17))
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEquals(alarm.getAlarmDate(),right_first_date)
alarm.setNextAlarmDate(current_date=right_first_date)
......@@ -280,7 +281,7 @@ class TestAlarm(ERP5TypeTestCase):
right_fourth_date = DateTime(self.date_format % (2006,10,2,6,00,00))
right_fifth_date = DateTime(self.date_format % (2006,10,2,15,00,00))
alarm = self.newAlarm()
get_transaction().commit()
transaction.commit()
self.tic()
alarm.setPeriodicityStartDate(right_first_date)
alarm.setPeriodicityWeekDayList(('Monday','Friday'))
......@@ -313,7 +314,7 @@ class TestAlarm(ERP5TypeTestCase):
alarm.setPeriodicityStartDate(right_first_date)
alarm.setPeriodicityMonthDayList((1,15))
alarm.setPeriodicityHourList((12,14))
get_transaction().commit()
transaction.commit()
self.tic()
self.checkDate(alarm, right_first_date, right_second_date, right_third_date, right_fourth_date)
......@@ -333,7 +334,7 @@ class TestAlarm(ERP5TypeTestCase):
alarm.setPeriodicityMonthDayList((1,))
alarm.setPeriodicityMonthFrequency(2)
alarm.setPeriodicityHourList((6,))
get_transaction().commit()
transaction.commit()
self.tic()
self.checkDate(alarm, right_first_date, right_second_date, right_third_date)
......@@ -352,7 +353,7 @@ class TestAlarm(ERP5TypeTestCase):
alarm.setPeriodicityStartDate(right_first_date)
alarm.setPeriodicityHourList((6,))
alarm.setPeriodicityWeekList((41,43))
get_transaction().commit()
transaction.commit()
self.tic()
self.checkDate(alarm, right_first_date, right_second_date, right_third_date,right_fourth_date)
......@@ -369,7 +370,7 @@ class TestAlarm(ERP5TypeTestCase):
date = addToDate(now,day=2)
alarm.setPeriodicityStartDate(date)
alarm.setPeriodicityMinuteFrequency(5)
get_transaction().commit()
transaction.commit()
self.tic()
alarm.setNextAlarmDate(current_date=now)
self.assertEquals(alarm.getAlarmDate(),date)
......@@ -395,7 +396,7 @@ class TestAlarm(ERP5TypeTestCase):
date = addToDate(now,hour=2)
alarm.setPeriodicityStartDate(now)
alarm.setPeriodicityMinuteFrequency(1)
get_transaction().commit()
transaction.commit()
self.tic()
alarm.setNextAlarmDate(current_date=date)
self.assertEquals(alarm.getAlarmDate(),date)
......@@ -410,7 +411,7 @@ class TestAlarm(ERP5TypeTestCase):
active_process = alarm.newActiveProcess()
self.assertEquals('Active Process', active_process.getPortalType())
self.assertEquals(alarm, active_process.getCausalityValue())
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEquals(active_process, alarm.getLastActiveProcess())
......@@ -429,13 +430,13 @@ class TestAlarm(ERP5TypeTestCase):
skin_folder[sense_method_id].ZPythonScript_edit('*args,**kw', 'raise Exception')
del skin_folder
alarm = self.newAlarm()
get_transaction().commit()
transaction.commit()
self.tic()
now = DateTime()
alarm.setActiveSenseMethodId(sense_method_id)
self.assertEquals(alarm.isActive(), 0)
alarm.activeSense()
get_transaction().commit()
transaction.commit()
try:
self.tic()
except RuntimeError:
......@@ -449,7 +450,7 @@ class TestAlarm(ERP5TypeTestCase):
# Make the sense method succeed and leave a trace
self.getPortal().portal_skins[skin_folder_id][sense_method_id].ZPythonScript_edit('*args,**kw', 'context.newActiveProcess()')
alarm.activeSense()
get_transaction().commit()
transaction.commit()
# Note: this call to tic will fail, because the previous message is still there
# This behaviour is logical if we consider that we want to keep errors
# in order to know that an error occured.
......@@ -474,19 +475,19 @@ class TestAlarm(ERP5TypeTestCase):
ZopeTestCase._print('\n%s ' % message)
LOG('Testing... ', 0, message)
alarm = self.newAlarm()
get_transaction().commit()
transaction.commit()
self.tic()
now = DateTime()
date = addToDate(now, day=1)
alarm.setPeriodicityStartDate(date)
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEquals(alarm.getAlarmDate(), date)
# This should not do change the alarm date
alarm.setNextAlarmDate(current_date=now)
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEquals(alarm.getAlarmDate(), date)
......@@ -494,7 +495,7 @@ class TestAlarm(ERP5TypeTestCase):
a_tool = self.getAlarmTool()
alarm_uid = alarm.getUid()
a_tool.manage_delObjects(uids=[alarm_uid])
get_transaction().commit()
transaction.commit()
self.tic()
# Check that related entry was removed
sql_connection = self.getSQLConnection()
......@@ -513,7 +514,7 @@ class TestAlarm(ERP5TypeTestCase):
LOG('Testing... ', 0, message)
alarm = self.newAlarm()
alarm.setEnabled(True)
get_transaction().commit()
transaction.commit()
self.tic()
sense_method_id = 'Alarm_testSenseMethodForTic'
......@@ -526,7 +527,7 @@ class TestAlarm(ERP5TypeTestCase):
'context.setDescription("a")')
del skin_folder
alarm.setActiveSenseMethodId(sense_method_id)
get_transaction().commit()
transaction.commit()
self.tic()
alarm_tool = self.getPortal().portal_alarms
# Nothing should happens yet
......@@ -536,7 +537,7 @@ class TestAlarm(ERP5TypeTestCase):
date = addToDate(now, day=1)
alarm.setPeriodicityStartDate(date)
alarm.setPeriodicityMinuteFrequency(1)
get_transaction().commit()
transaction.commit()
self.tic()
alarm_tool.tic()
self.assertEquals(alarm.getDescription(), 'a')
......@@ -564,10 +565,10 @@ class TestAlarm(ERP5TypeTestCase):
alarm.edit(alarm_notification_mode="always",
active_sense_method_id=sense_method_id,
enabled=True)
get_transaction().commit()
transaction.commit()
self.tic()
alarm.activeSense()
get_transaction().commit()
transaction.commit()
messages_list = self.getActivityTool().getMessageList()
self.assertEquals(2, len(messages_list))
# check tags after activeSense
......@@ -580,7 +581,7 @@ class TestAlarm(ERP5TypeTestCase):
raise AssertionError, m.method_id
# execute alarm sense script and check tags
self.getActivityTool().manageInvoke(alarm.getPhysicalPath(),sense_method_id)
get_transaction().commit()
transaction.commit()
messages_list = self.getActivityTool().getMessageList()
for m in messages_list:
if m.method_id == 'notify':
......
......@@ -274,7 +274,7 @@ class TestBPMMixin(ERP5TypeTestCase):
int_index=3,
membership_criterion_base_category='resource_use',
membership_criterion_category='resource_use/use/normal')
get_transaction().commit()
transaction.commit()
self.tic()
accounting_rule_cell_list = itr.contentValues(
portal_type='Accounting Rule Cell')
......
......@@ -30,6 +30,8 @@
import unittest
import os
import transaction
from Testing import ZopeTestCase
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from AccessControl.SecurityManagement import newSecurityManager
......@@ -169,7 +171,7 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional):
Check if there is a activity in activity queue.
"""
portal = self.getPortal()
get_transaction().commit()
transaction.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 ?
......@@ -1046,7 +1048,7 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional):
"""
self.getPortal().person_module.newContent(portal_type='Person',
title='translate_table_test')
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEquals(1, len(self.getPortal().portal_catalog(
portal_type='Person', title='translate_table_test')))
......
......@@ -29,6 +29,7 @@
import unittest
import transaction
from DateTime import DateTime
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type.tests.Sequence import SequenceList
......@@ -118,7 +119,7 @@ class TestBug(ERP5TypeTestCase):
start_date='1980-01-01',
stop_date='2099-12-31')
assignment.open()
get_transaction().commit()
transaction.commit()
self.tic()
module_list = []
portal_type_list = []
......@@ -136,7 +137,7 @@ class TestBug(ERP5TypeTestCase):
'')
ti.updateRoleMapping()
get_transaction().commit()
transaction.commit()
self.tic()
portal.portal_caches.clearAllCache()
......
......@@ -28,6 +28,8 @@
import unittest
import transaction
from Testing import ZopeTestCase
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from AccessControl.SecurityManagement import newSecurityManager
......@@ -87,7 +89,7 @@ class TestBusinessTemplate(ERP5TypeTestCase, LogInterceptor):
if (content_type_registry is not None and
'any' in content_type_registry.predicate_ids):
content_type_registry.removePredicate('any')
get_transaction().commit()
transaction.commit()
def beforeTearDown(self):
"""Remove objects created tests."""
......@@ -121,7 +123,7 @@ class TestBusinessTemplate(ERP5TypeTestCase, LogInterceptor):
for business_template in self.getTemplateTool().contentValues():
if business_template.getTitle() == 'geek template':
self.getTemplateTool().manage_delObjects([business_template.getId()])
get_transaction().commit()
transaction.commit()
self._ignore_log_errors()
def login(self):
......
This diff is collapsed.
......@@ -26,6 +26,8 @@
#
##############################################################################
import transaction
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5ReportTestCase
from Products.ERP5Type.Base import _aq_reset
from AccessControl.SecurityManagement import newSecurityManager, \
......@@ -102,12 +104,12 @@ class TestCalendar(ERP5ReportTestCase):
self._addPropertySheet('Group Presence Period', 'CalendarPeriodConstraint')
def beforeTearDown(self):
get_transaction().abort()
transaction.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()))
get_transaction().commit()
transaction.commit()
self.tic()
def _addPropertySheet(self, type_info_name, property_sheet_name):
......@@ -823,7 +825,7 @@ class TestCalendar(ERP5ReportTestCase):
person = self.portal.person_module.newContent(portal_type='Person')
assignment = person.newContent(portal_type='Assignment',
calendar_value=group_calendar)
get_transaction().commit()
transaction.commit()
self.tic()
# there is 43200 seconds between self.start_date and self.stop_date
......@@ -858,7 +860,7 @@ class TestCalendar(ERP5ReportTestCase):
leave_request.setDestinationValue(person)
leave_request.confirm()
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEquals(0, person.getAvailableTime(
......@@ -897,7 +899,7 @@ class TestCalendar(ERP5ReportTestCase):
person = self.portal.person_module.newContent(portal_type='Person')
assignment = person.newContent(portal_type='Assignment',
calendar_value=group_calendar)
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEquals((18 - 14 + 12 - 8) * 60 * 60, person.getAvailableTime(
......@@ -931,7 +933,7 @@ class TestCalendar(ERP5ReportTestCase):
leave_request.setDestinationValue(person)
leave_request.confirm()
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEquals(0, person.getAvailableTime(
......@@ -968,7 +970,7 @@ class TestCalendar(ERP5ReportTestCase):
person = self.portal.person_module.newContent(portal_type='Person')
assignment = person.newContent(portal_type='Assignment',
calendar_value=group_calendar)
get_transaction().commit()
transaction.commit()
self.tic()
# 2008/01/07 was a Monday
......@@ -1003,7 +1005,7 @@ class TestCalendar(ERP5ReportTestCase):
leave_request.setDestinationValue(person)
leave_request.confirm()
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEquals(0, person.getAvailableTime(
......@@ -1034,7 +1036,7 @@ class TestCalendar(ERP5ReportTestCase):
person = self.portal.person_module.newContent(portal_type='Person')
assignment = person.newContent(portal_type='Assignment',
calendar_value=group_calendar)
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEquals((18 - 8) * 60 * 60, person.getAvailableTime(
......@@ -1067,7 +1069,7 @@ class TestCalendar(ERP5ReportTestCase):
leave_request.setDestinationValue(person)
leave_request.confirm()
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEquals((9-8 + 18-17) * 60 * 60, person.getAvailableTime(
......@@ -1106,7 +1108,7 @@ class TestCalendar(ERP5ReportTestCase):
person = self.portal.person_module.newContent(portal_type='Person')
assignment = person.newContent(portal_type='Assignment',
calendar_value=group_calendar)
get_transaction().commit()
transaction.commit()
self.tic()
leave_request = self.portal.leave_request_module.newContent(
portal_type='Leave Request')
......@@ -1119,7 +1121,7 @@ class TestCalendar(ERP5ReportTestCase):
leave_request.setDestinationValue(person)
leave_request.confirm()
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEquals((18-9) * 60 * 60, person.getAvailableTime(
......@@ -1155,7 +1157,7 @@ class TestCalendar(ERP5ReportTestCase):
person = self.portal.person_module.newContent(portal_type='Person')
assignment = person.newContent(portal_type='Assignment',
calendar_value=group_calendar)
get_transaction().commit()
transaction.commit()
self.tic()
leave_request = self.portal.leave_request_module.newContent(
portal_type='Leave Request')
......@@ -1168,7 +1170,7 @@ class TestCalendar(ERP5ReportTestCase):
leave_request.setDestinationValue(person)
leave_request.confirm()
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEquals((17-8) * 60 * 60, person.getAvailableTime(
......@@ -1204,7 +1206,7 @@ class TestCalendar(ERP5ReportTestCase):
person = self.portal.person_module.newContent(portal_type='Person')
assignment = person.newContent(portal_type='Assignment',
calendar_value=group_calendar)
get_transaction().commit()
transaction.commit()
self.tic()
leave_request = self.portal.leave_request_module.newContent(
portal_type='Leave Request')
......@@ -1223,7 +1225,7 @@ class TestCalendar(ERP5ReportTestCase):
leave_request.setDestinationValue(person)
leave_request.confirm()
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEquals((18-13 + 12-10 + 9-8) * 60 * 60, person.getAvailableTime(
......@@ -1263,7 +1265,7 @@ class TestCalendar(ERP5ReportTestCase):
person = self.portal.person_module.newContent(portal_type='Person')
assignment = person.newContent(portal_type='Assignment',
calendar_value=group_calendar)
get_transaction().commit()
transaction.commit()
self.tic()
leave_request = self.portal.leave_request_module.newContent(
portal_type='Leave Request')
......@@ -1282,7 +1284,7 @@ class TestCalendar(ERP5ReportTestCase):
leave_request.setDestinationValue(person)
leave_request.confirm()
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEquals((18-11 + 9-8) * 60 * 60, person.getAvailableTime(
......@@ -1320,7 +1322,7 @@ class TestCalendar(ERP5ReportTestCase):
person = self.portal.person_module.newContent(portal_type='Person')
assignment = person.newContent(portal_type='Assignment',
calendar_value=group_calendar)
get_transaction().commit()
transaction.commit()
self.tic()
leave_request = self.portal.leave_request_module.newContent(
portal_type='Leave Request')
......@@ -1339,7 +1341,7 @@ class TestCalendar(ERP5ReportTestCase):
leave_request.setDestinationValue(person)
leave_request.confirm()
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEquals((18-11 + 9-8) * 60 * 60, person.getAvailableTime(
......@@ -1423,7 +1425,7 @@ class TestCalendar(ERP5ReportTestCase):
self.portal.portal_categories.calendar_period_type.type3)
leave_request2.confirm()
get_transaction().commit()
transaction.commit()
self.tic()
# set request variables and render
......
......@@ -28,11 +28,7 @@
import unittest
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
try:
from transaction import get_transaction
except ImportError:
pass
import transaction
class TestContributionRegistryTool(ERP5TypeTestCase):
......@@ -74,7 +70,7 @@ return predicate.getDestinationPortalType()
""")
self.portal.manage_addProduct['PythonScripts'].manage_addPythonScript(id='IngestionFile_testEvent')
self.portal.IngestionFile_testEvent.write(python_script_src)
get_transaction().commit()
transaction.commit()
self.tic()
def setUpMimeType(self):
......@@ -84,7 +80,7 @@ return predicate.getDestinationPortalType()
id='mime_type')
text = mime_type.newContent(portal_type='Category', id='text')
text.newContent(portal_type='Category', id='html')
get_transaction().commit()
transaction.commit()
self.tic()
if getattr(portal_categories, 'mime_type', None) is None:
......@@ -92,7 +88,7 @@ return predicate.getDestinationPortalType()
id='mime_type')
message = mime_type.newContent(portal_type='Category', id='message')
message.newContent(portal_type='Category', id='rfc822')
get_transaction().commit()
transaction.commit()
self.tic()
def setUpPredicate(self):
......@@ -104,7 +100,7 @@ return predicate.getDestinationPortalType()
predicate._setMembershipCriterionCategoryList(['mime_type/text/html'])
predicate._setMembershipCriterionBaseCategoryList(['mime_type'])
predicate.setDestinationPortalType('Web Page')
get_transaction().commit()
transaction.commit()
self.tic()
if getattr(portal_contribution_registry, 'my_predicate', None) is None:
......@@ -116,7 +112,7 @@ return predicate.getDestinationPortalType()
predicate.setCriterion('file_extension', identity=['eml'])
predicate.setDestinationPortalType('Mail Message')
predicate.setTestMethodId('IngestionFile_testEvent')
get_transaction().commit()
transaction.commit()
self.tic()
def testFindPortalTypeName(self, quiet=0, run=run_all_test):
......
......@@ -31,10 +31,13 @@
"""Tests Standards ERP5 Crm Reports
"""
import unittest
import transaction
from DateTime import DateTime
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5ReportTestCase
from Products.ERP5Type.tests.utils import reindex
from AccessControl.SecurityManagement import newSecurityManager
from DateTime import DateTime
class CrmTestCase(ERP5ReportTestCase):
"""Tests starts with a preference activated for self.my_organisation, logged in
......@@ -226,14 +229,14 @@ class CrmTestCase(ERP5ReportTestCase):
doc.validate()
# and all this available to catalog
get_transaction().commit()
transaction.commit()
self.tic()
def beforeTearDown(self):
"""Remove all documents.
"""
get_transaction().abort()
transaction.abort()
self.campaign_module.manage_delObjects(
list(self.campaign_module.objectIds()))
self.meeting_module.manage_delObjects(
......@@ -250,7 +253,7 @@ class CrmTestCase(ERP5ReportTestCase):
self.event_module.manage_delObjects(
list(self.event_module.objectIds()))
get_transaction().commit()
transaction.commit()
self.tic()
def getBusinessTemplateList(self):
......@@ -366,7 +369,7 @@ class TestCrmReports(CrmTestCase):
causality=eventOut1.getRelativeUrl(),
follow_up=second.getRelativeUrl())
get_transaction().commit()
transaction.commit()
self.tic()
request_form = self.portal.REQUEST.other
request_form['from_date'] = DateTime(2007, 1, 1)
......@@ -513,7 +516,7 @@ class TestCrmReports(CrmTestCase):
causality=second_event_out1.getRelativeUrl(),
follow_up=second.getRelativeUrl())
get_transaction().commit()
transaction.commit()
self.tic()
# set request variables and render
request_form = self.portal.REQUEST.other
......@@ -677,7 +680,7 @@ class TestCrmReports(CrmTestCase):
causality=eventOut1.getRelativeUrl(),
follow_up=second.getRelativeUrl())
get_transaction().commit()
transaction.commit()
self.tic()
# set request variables and render
request_form = self.portal.REQUEST.other
......@@ -823,7 +826,7 @@ class TestCrmReports(CrmTestCase):
causality=second_event_out1.getRelativeUrl(),
follow_up=second.getRelativeUrl())
get_transaction().commit()
transaction.commit()
self.tic()
# set request variables and render
request_form = self.portal.REQUEST.other
......@@ -987,7 +990,7 @@ class TestCrmReports(CrmTestCase):
causality=second_event_inc1.getRelativeUrl(),
follow_up=second.getRelativeUrl())
get_transaction().commit()
transaction.commit()
self.tic()
# set request variables and render
request_form = self.portal.REQUEST.other
......@@ -1133,7 +1136,7 @@ class TestCrmReports(CrmTestCase):
causality=second_event_inc1.getRelativeUrl(),
follow_up=second.getRelativeUrl())
get_transaction().commit()
transaction.commit()
self.tic()
# set request variables and render
request_form = self.portal.REQUEST.other
......@@ -1297,7 +1300,7 @@ class TestCrmReports(CrmTestCase):
causality=eventOut1.getRelativeUrl(),
follow_up=second.getRelativeUrl())
get_transaction().commit()
transaction.commit()
self.tic()
# set request variables and render
request_form = self.portal.REQUEST.other
......@@ -1443,7 +1446,7 @@ class TestCrmReports(CrmTestCase):
causality=second_event_out1.getRelativeUrl(),
follow_up=second.getRelativeUrl())
get_transaction().commit()
transaction.commit()
self.tic()
# set request variables and render
request_form = self.portal.REQUEST.other
......@@ -1702,7 +1705,7 @@ class TestCrmReports(CrmTestCase):
causality=event6.getRelativeUrl(),
follow_up=campaign.getRelativeUrl())
get_transaction().commit()
transaction.commit()
self.tic()
# set request variables and render
request_form = self.portal.REQUEST.other
......@@ -2045,7 +2048,7 @@ class TestCrmReports(CrmTestCase):
causality=event6.getRelativeUrl(),
follow_up=campaign.getRelativeUrl())
get_transaction().commit()
transaction.commit()
self.tic()
# set request variables and render
request_form = self.portal.REQUEST.other
......
......@@ -28,6 +28,8 @@
import unittest
import transaction
from Products.ERP5.tests.testPredicate import TestPredicateMixIn, REGION_FRANCE_PATH, REGION_GERMANY_PATH, GROUP_STOREVER_PATH, GROUP_OTHER_PATH
from DateTime import DateTime
from AccessControl.SecurityManagement import newSecurityManager
......@@ -115,7 +117,7 @@ class TestDomainTool(TestPredicateMixIn):
if not 'asia' in portal_categories[bc].objectIds():
big_region = portal_categories[bc].newContent(id='asia',portal_type='Category')
get_transaction().commit()
transaction.commit()
self.tic()
def checkPredicate(self, test=None):
......@@ -145,7 +147,7 @@ class TestDomainTool(TestPredicateMixIn):
# Test with order line not none and predicate to none
order_line.setQuantity(45)
get_transaction().commit()
transaction.commit()
self.tic()
predicate_list = domain_tool.searchPredicateList(order_line,test=test,
portal_type=rule_query)
......@@ -155,13 +157,13 @@ class TestDomainTool(TestPredicateMixIn):
order_line.setQuantity(45)
kw = {'portal_type':'Mapped Value'}
predicate.setCriterion('quantity',identity=45,min=None,max=None)
get_transaction().commit()
transaction.commit()
self.tic()
predicate_list = domain_tool.searchPredicateList(order_line,test=test,**kw)
self.assertEquals(len(predicate_list),1)
order_line.setQuantity(40)
get_transaction().commit()
transaction.commit()
self.tic()
predicate_list = domain_tool.searchPredicateList(order_line,test=test,**kw)
self.assertEquals(len(predicate_list),0)
......@@ -170,13 +172,13 @@ class TestDomainTool(TestPredicateMixIn):
order_line.setQuantity(45)
predicate = self.getPredicate()
predicate.setCriterion('quantity',identity=None,min=30,max=None)
get_transaction().commit()
transaction.commit()
self.tic()
predicate_list = domain_tool.searchPredicateList(order_line,test=test,**kw)
self.assertEquals(len(predicate_list),1)
order_line.setQuantity(10)
get_transaction().commit()
transaction.commit()
self.tic()
predicate_list = domain_tool.searchPredicateList(order_line,test=test,
portal_type=rule_query)
......@@ -186,13 +188,13 @@ class TestDomainTool(TestPredicateMixIn):
order_line.setQuantity(45)
predicate = self.getPredicate()
predicate.setCriterion('quantity',identity=None,min=None,max=50)
get_transaction().commit()
transaction.commit()
self.tic()
predicate_list = domain_tool.searchPredicateList(order_line,test=test,**kw)
self.assertEquals(len(predicate_list),1)
order_line.setQuantity(60)
get_transaction().commit()
transaction.commit()
self.tic()
predicate_list = domain_tool.searchPredicateList(order_line,test=test,**kw)
self.assertEquals(len(predicate_list),0)
......@@ -201,20 +203,20 @@ class TestDomainTool(TestPredicateMixIn):
order_line.setQuantity(20)
predicate = self.getPredicate()
predicate.setCriterion('quantity',identity=None,min=30,max=50)
get_transaction().commit()
transaction.commit()
self.tic()
predicate_list = domain_tool.searchPredicateList(order_line,test=test,**kw)
self.assertEquals(len(predicate_list),0)
order_line.setQuantity(60)
get_transaction().commit()
transaction.commit()
self.tic()
predicate_list = domain_tool.searchPredicateList(order_line,test=test,**kw)
self.assertEquals(len(predicate_list),0)
order_line.setQuantity(45)
predicate_list = domain_tool.searchPredicateList(order_line,test=test,**kw)
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEquals(len(predicate_list),1)
......@@ -222,25 +224,25 @@ class TestDomainTool(TestPredicateMixIn):
# and also predicate to a category
predicate.setMembershipCriterionBaseCategoryList(['region'])
predicate.setMembershipCriterionCategoryList(['region/europe'])
get_transaction().commit()
transaction.commit()
self.tic()
predicate_list = domain_tool.searchPredicateList(order_line,test=test,**kw)
self.assertEquals(len(predicate_list),0)
order_line.setCategoryList(['region/africa'])
get_transaction().commit()
transaction.commit()
self.tic()
predicate_list = domain_tool.searchPredicateList(order_line,test=test,**kw)
self.assertEquals(len(predicate_list),0)
order_line.setCategoryList(['region/europe'])
get_transaction().commit()
transaction.commit()
self.tic()
predicate_list = domain_tool.searchPredicateList(order_line,test=test,**kw)
self.assertEquals(len(predicate_list),1)
order_line.setQuantity(60)
get_transaction().commit()
transaction.commit()
self.tic()
predicate_list = domain_tool.searchPredicateList(order_line,test=test,**kw)
self.assertEquals(len(predicate_list),0)
......@@ -259,14 +261,14 @@ class TestDomainTool(TestPredicateMixIn):
self.supply_line.setStartDateRangeMax(date2)
current_date = DateTime('2005/04/1 10:47:26.388 GMT-4')
order_line.setStartDate(current_date)
get_transaction().commit()
transaction.commit()
self.tic()
predicate_list = domain_tool.searchPredicateList(order_line,test=test,**kw)
self.assertEquals(len(predicate_list),0)
current_date = DateTime('2005/04/09 10:47:26.388 GMT-4')
order_line.setStartDate(current_date)
get_transaction().commit()
transaction.commit()
self.tic()
predicate_list = domain_tool.searchPredicateList(order_line,test=test,**kw)
self.assertEquals(len(predicate_list),1)
......@@ -297,7 +299,7 @@ class TestDomainTool(TestPredicateMixIn):
#self.supply_line.setMultimembershipCriterionBaseCategoryList(['resource'])
self.supply_line.setMappedValuePropertyList(['base_price','priced_quantity'])
#self.supply_line.setMembershipCriterionCategoryList(['resource/%s' % self.resource.getRelativeUrl()])
get_transaction().commit()
transaction.commit()
self.tic()
domain_tool = self.getDomainTool()
context = self.resource.asContext(categories=['resource/%s' % self.resource.getRelativeUrl()])
......@@ -319,7 +321,7 @@ class TestDomainTool(TestPredicateMixIn):
LOG('Test04, supply_line.getStartDateRangeMin',0,self.supply_line.getStartDateRangeMin())
LOG('Test04, supply_line.getStartDateRangeMax',0,self.supply_line.getStartDateRangeMax())
self.supply_line.setMappedValuePropertyList(['base_price','priced_quantity'])
get_transaction().commit()
transaction.commit()
self.tic()
domain_tool = self.getDomainTool()
order_line = self.getOrderLine()
......@@ -380,7 +382,7 @@ class TestDomainTool(TestPredicateMixIn):
hasCellContent = getattr(x, 'hasCellContent', None)
return bool(hasCellContent and hasCellContent(base_id='path'))
get_transaction().commit()
transaction.commit()
self.tic()
domain_tool = self.getDomainTool()
context = self.resource.asContext(
......@@ -419,7 +421,7 @@ class TestDomainTool(TestPredicateMixIn):
membership_criterion_category_list=[GROUP_STOREVER_PATH, REGION_GERMANY_PATH])
document = self.createDocument(group='nexedi/storever',
region='europe/western_europe/france')
get_transaction().commit()
transaction.commit()
self.tic()
portal_domains = self.getPortalObject().portal_domains
# Basic sanity checks
......
......@@ -537,7 +537,7 @@ class TestERP5Base(ERP5TypeTestCase):
self.assertEquals(person.getCareerFunctionTitle(), function_title)
self.assertEquals(person.getCareerFunctionValue(), function_object)
# function must be acquired on person
person.reindexObject(); get_transaction().commit(); self.tic()
person.reindexObject(); transaction.commit(); self.tic()
self.failUnless(person in function_object.getFunctionRelatedValueList())
# Set & Check role
......@@ -550,7 +550,7 @@ class TestERP5Base(ERP5TypeTestCase):
self.assertEquals(person.getCareerRoleTitle(), role_title)
self.assertEquals(person.getCareerRoleValue(), role_object)
# role must be acquired on person
person.reindexObject(); get_transaction().commit(); self.tic()
person.reindexObject(); transaction.commit(); self.tic()
self.failUnless(person in role_object.getRoleRelatedValueList())
# Set & Check grade
......@@ -563,7 +563,7 @@ class TestERP5Base(ERP5TypeTestCase):
self.assertEquals(person.getCareerGradeTitle(), grade_title)
self.assertEquals(person.getCareerGradeValue(), grade_object)
# grade must be acquired on person
person.reindexObject(); get_transaction().commit(); self.tic()
person.reindexObject(); transaction.commit(); self.tic()
self.failUnless(person in grade_object.getGradeRelatedValueList())
# Set & Check salary level
......@@ -578,7 +578,7 @@ class TestERP5Base(ERP5TypeTestCase):
self.assertEquals(person.getCareerSalaryLevelTitle(), salary_level_title)
self.assertEquals(person.getCareerSalaryLevelValue(), salary_level_object)
# salary_level must be acquired on person
person.reindexObject(); get_transaction().commit(); self.tic()
person.reindexObject(); transaction.commit(); self.tic()
self.failUnless(person in
salary_level_object.getSalaryLevelRelatedValueList())
......@@ -601,7 +601,7 @@ class TestERP5Base(ERP5TypeTestCase):
self.assertEquals(person.getCareerSkillTitle(), skill_title_list[0])
self.assertEquals(person.getCareerSkillValue(), skill_object_list[0])
# skill must be acquired on person
person.reindexObject(); get_transaction().commit(); self.tic()
person.reindexObject(); transaction.commit(); self.tic()
for skill_object in skill_object_list:
self.failUnless(person in skill_object.getSkillRelatedValueList())
self.assertEquals(person.getSkillValue(), skill_object_list[0])
......
......@@ -27,6 +27,7 @@
import unittest
import transaction
from zLOG import LOG
from Testing import ZopeTestCase
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
......@@ -146,7 +147,7 @@ class TestBudget(ERP5TypeTestCase):
self.getAccountingModule().manage_addLocalRoles('maurice',
('Assignor','Assignee','Manager','Owner',))
# flush activities
get_transaction().commit()
transaction.commit()
self.tic()
# When using light install, only base categories are created
if len(self.portal_categories.region.contentValues()) == 0 :
......@@ -310,7 +311,7 @@ class TestBudget(ERP5TypeTestCase):
stop_date='2005/05/01 18:06:26.388 GMT-4')
# flush activities
get_transaction().commit()
transaction.commit()
self.tic()
def getAccountModule(self):
......
......@@ -27,6 +27,7 @@
##############################################################################
import unittest
import transaction
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type.Base import _aq_reset
from AccessControl.SecurityManagement import newSecurityManager
......@@ -139,7 +140,7 @@ class TestERP5Category(ERP5TypeTestCase):
predicate.setCriterion('quantity', identity=None, min=None, max=None)
self.predicate = predicate
get_transaction().commit() # If we don't commit, then we can't rename
transaction.commit() # If we don't commit, then we can't rename
self.tic()
def beforeTearDown(self):
......@@ -168,7 +169,7 @@ class TestERP5Category(ERP5TypeTestCase):
def commitAndTic(self):
"""Just to save one line.
"""
get_transaction().commit()
transaction.commit()
self.tic()
def test_01_RenameCategory(self, quiet=quiet, run=run_all_test):
......@@ -340,7 +341,7 @@ class TestERP5Category(ERP5TypeTestCase):
self.assertEquals([], ctool.getAcquiredCategoryList(doc))
# XXX this test's beforeTearDown commits transaction
get_transaction().abort()
transaction.abort()
def test_suite():
......
......@@ -30,6 +30,7 @@
import unittest
import md5
import transaction
from AccessControl.SecurityManagement import newSecurityManager
from Testing import ZopeTestCase
from Products.PageTemplates.GlobalTranslationService import \
......@@ -67,11 +68,11 @@ class TestERP5Core(ERP5TypeTestCase, ZopeTestCase.Functional):
self.auth = '%s:%s' % (self.manager_username, self.manager_password)
def beforeTearDown(self):
get_transaction().abort()
transaction.abort()
if 'test_folder' in self.portal.objectIds():
self.portal.manage_delObjects(['test_folder'])
self.portal.portal_selections.setSelectionFor('test_selection', None)
get_transaction().commit()
transaction.commit()
self.tic()
def test_01_ERP5Site_createModule(self, quiet=quiet, run=run_all_test):
......@@ -284,12 +285,12 @@ class TestERP5Core(ERP5TypeTestCase, ZopeTestCase.Functional):
# Login as the above user
newSecurityManager(None, user)
self.auth = '%s:%s' % (login_name, password)
get_transaction().commit()
transaction.commit()
# Create preference
portal.portal_preferences.newContent('Preference', title='My Test Preference')
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEqual(
......@@ -306,14 +307,14 @@ class TestERP5Core(ERP5TypeTestCase, ZopeTestCase.Functional):
uid_list = [document_1.getUid(), document_2.getUid()]
self.portal.portal_selections.setSelectionParamsFor(
'test_selection', dict(uids=uid_list))
get_transaction().commit()
transaction.commit()
self.tic()
md5_string = md5.new(str(sorted([str(x) for x in uid_list]))).hexdigest()
redirect = module.Folder_delete(selection_name='test_selection',
uids=uid_list,
md5_object_uid_list=md5_string)
self.assert_('Deleted.' in redirect, redirect)
get_transaction().commit(1)
transaction.commit(1)
self.assertEquals(len(module.objectValues()), 0)
def test_Folder_delete_related_object(self):
......@@ -328,7 +329,7 @@ class TestERP5Core(ERP5TypeTestCase, ZopeTestCase.Functional):
uid_list = [document_1.getUid(), document_2.getUid()]
self.portal.portal_selections.setSelectionParamsFor(
'test_selection', dict(uids=uid_list))
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEquals([document_1],
self.portal.portal_categories.getRelatedValueList(document_2))
......@@ -337,7 +338,7 @@ class TestERP5Core(ERP5TypeTestCase, ZopeTestCase.Functional):
uids=uid_list,
md5_object_uid_list=md5_string)
self.assert_('Sorry, 1 item is in use.' in redirect, redirect)
get_transaction().commit(1)
transaction.commit(1)
self.assertEquals(len(module.objectValues()), 2)
......@@ -354,7 +355,7 @@ class TestERP5Core(ERP5TypeTestCase, ZopeTestCase.Functional):
uid_list = [document_2.getUid(), ]
self.portal.portal_selections.setSelectionParamsFor(
'test_selection', dict(uids=uid_list))
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEquals([document_1],
self.portal.portal_categories.getRelatedValueList(document_2))
......@@ -366,7 +367,7 @@ class TestERP5Core(ERP5TypeTestCase, ZopeTestCase.Functional):
uids=uid_list,
md5_object_uid_list=md5_string)
self.assert_('Sorry, 1 item is in use.' in redirect, redirect)
get_transaction().commit(1)
transaction.commit(1)
self.assertEquals(len(module.objectValues()), 2)
......
......@@ -27,6 +27,7 @@
##############################################################################
import unittest
import os
import transaction
from DateTime import DateTime
from zLOG import LOG
from Products.CMFCore.utils import _checkPermission
......@@ -61,7 +62,7 @@ class TestERP5CurrencyMixin(AccountingTestCase,ERP5TypeTestCase):
"""
username = 'username'
def beforeTearDown(self):
get_transaction().abort()
transaction.abort()
# clear modules if necessary
currency_list = ('euro', 'yen', 'usd')
module = self.portal.currency_module
......@@ -73,7 +74,7 @@ class TestERP5CurrencyMixin(AccountingTestCase,ERP5TypeTestCase):
currency.manage_delObjects([x.getId() for x in
currency.objectValues(
portal_type='Currency Exchange Line')])
get_transaction().commit()
transaction.commit()
self.tic()
def login(self,name=username, quiet=0, run=run_all_test):
......@@ -141,7 +142,7 @@ class TestERP5CurrencyMixin(AccountingTestCase,ERP5TypeTestCase):
new_currency.setReference('XOF')
new_currency.setTitle('Francs CFA')
new_currency.setBaseUnitQuantity(1.00)
get_transaction().commit()
transaction.commit()
self.tic()#execute transaction
self.organisation1.edit(
price_currency=new_currency.getRelativeUrl())
......@@ -198,7 +199,7 @@ class TestERP5CurrencyMixin(AccountingTestCase,ERP5TypeTestCase):
new_currency.setReference('XOF')
new_currency.setTitle('Francs CFA')
new_currency.setBaseUnitQuantity(1.00)
get_transaction().commit()
transaction.commit()
self.tic()#execute transaction
self.organisation1.edit(
price_currency=new_currency.getRelativeUrl())
......@@ -268,7 +269,7 @@ class TestERP5CurrencyMixin(AccountingTestCase,ERP5TypeTestCase):
new_currency.setReference('XOF')
new_currency.setTitle('Francs CFA')
new_currency.setBaseUnitQuantity(1.00)
get_transaction().commit()
transaction.commit()
self.tic()#execute transaction
self.organisation1.edit(
price_currency=new_currency.getRelativeUrl())
......@@ -322,7 +323,7 @@ class TestERP5CurrencyMixin(AccountingTestCase,ERP5TypeTestCase):
new_currency.setReference('XOF')
new_currency.setTitle('Francs CFA')
new_currency.setBaseUnitQuantity(1.00)
get_transaction().commit()
transaction.commit()
self.tic()#execute transaction
self.organisation1.edit(
price_currency=new_currency.getRelativeUrl())
......@@ -365,7 +366,7 @@ class TestERP5CurrencyMixin(AccountingTestCase,ERP5TypeTestCase):
new_currency.setReference('XOF')
new_currency.setTitle('Francs CFA')
new_currency.setBaseUnitQuantity(1.00)
get_transaction().commit()
transaction.commit()
self.tic()#execute transaction
self.organisation1.edit(
price_currency=new_currency.getRelativeUrl())
......@@ -435,7 +436,7 @@ class TestERP5CurrencyMixin(AccountingTestCase,ERP5TypeTestCase):
new_currency.setReference('XOF')
new_currency.setTitle('Francs CFA')
new_currency.setBaseUnitQuantity(1.00)
get_transaction().commit()
transaction.commit()
self.tic()#execute transaction
self.organisation1.edit(
price_currency=new_currency.getRelativeUrl())
......@@ -491,7 +492,7 @@ class TestERP5CurrencyMixin(AccountingTestCase,ERP5TypeTestCase):
new_currency.setReference('XOF')
new_currency.setTitle('Francs CFA')
new_currency.setBaseUnitQuantity(1.00)
get_transaction().commit()
transaction.commit()
self.tic()#execute transaction
self.organisation1.edit(
price_currency=new_currency.getRelativeUrl())
......
This diff is collapsed.
......@@ -31,6 +31,7 @@ import re
import unittest
import random
import transaction
from AccessControl import Unauthorized
from AccessControl.SecurityManagement import newSecurityManager
from AccessControl.SecurityManagement import getSecurityManager
......@@ -78,7 +79,7 @@ class TestERP5WebWithDms(ERP5TypeTestCase, ZopeTestCase.Functional):
def clearModule(self, module):
module.manage_delObjects(list(module.objectIds()))
get_transaction().commit()
transaction.commit()
self.tic()
def beforeTearDown(self):
......@@ -103,7 +104,7 @@ class TestERP5WebWithDms(ERP5TypeTestCase, ZopeTestCase.Functional):
website = self.getPortal().web_site_module.newContent(portal_type = 'Web Site',
id = self.website_id,
**kw)
get_transaction().commit()
transaction.commit()
self.tic()
return website
......@@ -124,7 +125,7 @@ class TestERP5WebWithDms(ERP5TypeTestCase, ZopeTestCase.Functional):
max='',
min='')
get_transaction().commit()
transaction.commit()
self.tic()
return websection
......@@ -152,7 +153,7 @@ class TestERP5WebWithDms(ERP5TypeTestCase, ZopeTestCase.Functional):
language=language,
**kw)
webpage.publish()
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEquals(language, webpage.getLanguage())
self.assertEquals(reference, webpage.getReference())
......@@ -196,7 +197,7 @@ class TestERP5WebWithDms(ERP5TypeTestCase, ZopeTestCase.Functional):
language = 'en')
en_02.publish()
en_02.reindexObject()
get_transaction().commit()
transaction.commit()
self.tic()
# is old archived?
......@@ -231,7 +232,7 @@ class TestERP5WebWithDms(ERP5TypeTestCase, ZopeTestCase.Functional):
document.release()
website.setAuthorizationForced(0)
websection.setAuthorizationForced(0)
get_transaction().commit()
transaction.commit()
self.tic()
# make sure that _getExtensibleContent will return the same document
......@@ -273,7 +274,7 @@ class TestERP5WebWithDms(ERP5TypeTestCase, ZopeTestCase.Functional):
websection.edit(membership_criterion_base_category = ['publication_section'],
membership_criterion_category=['publication_section/%s'
%publication_section_category_id_list[0]])
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEquals(0, len(websection.getDocumentValueList()))
......@@ -282,7 +283,7 @@ class TestERP5WebWithDms(ERP5TypeTestCase, ZopeTestCase.Functional):
language = 'en',
publication_section_list=publication_section_category_id_list[:1])
web_page_en.publish()
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEquals(1, len(websection.getDocumentValueList(language='en')))
self.assertEquals(web_page_en, websection.getDocumentValueList(language='en')[0].getObject())
......@@ -292,20 +293,20 @@ class TestERP5WebWithDms(ERP5TypeTestCase, ZopeTestCase.Functional):
language = 'bg',
publication_section_list=publication_section_category_id_list[:1])
web_page_bg.publish()
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEquals(1, len(websection.getDocumentValueList(language='bg')))
self.assertEquals(web_page_bg, websection.getDocumentValueList(language='bg')[0].getObject())
# reject page
web_page_bg.reject()
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEquals(0, len(websection.getDocumentValueList(language='bg')))
# publish page and search without a language (by default system should return 'en' docs only)
web_page_bg.publish()
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEquals(1, len(websection.getDocumentValueList()))
self.assertEquals(web_page_en, websection.getDocumentValueList()[0].getObject())
......@@ -331,7 +332,7 @@ class TestERP5WebWithDms(ERP5TypeTestCase, ZopeTestCase.Functional):
web_page_en.releaseAlive()
websection.setAggregateValue(web_page_en)
websection.setAuthorizationForced(1)
get_transaction().commit()
transaction.commit()
self.tic()
# make sure that getDefaultDocumentValue() will return the same document for logged in user
......@@ -347,7 +348,7 @@ class TestERP5WebWithDms(ERP5TypeTestCase, ZopeTestCase.Functional):
# Anonymous User should not get Unauthorized when authorization_forced is not set
self.login()
websection.setAuthorizationForced(0)
get_transaction().commit()
transaction.commit()
self.tic()
self.logout()
......@@ -365,11 +366,11 @@ class TestERP5WebWithDms(ERP5TypeTestCase, ZopeTestCase.Functional):
language = 'en',)
web_page.publish()
self.tic()
get_transaction().commit()
transaction.commit()
web_page_list.append(web_page)
websection.setAggregateValueList(web_page_list)
self.tic()
get_transaction().commit()
transaction.commit()
self.assertEqual(5, len(websection.getDocumentValueList(limit=5)))
def test_05_deadProxyFields(self, quiet=quiet, run=run_all_test):
......
......@@ -41,15 +41,12 @@
import unittest
import transaction
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from AccessControl.SecurityManagement import newSecurityManager
from Products.ERP5Form.Form import ERP5Form
try:
from transaction import get as get_transaction
except ImportError:
pass
class TestICal(ERP5TypeTestCase):
......@@ -83,7 +80,7 @@ class TestICal(ERP5TypeTestCase):
if hasattr(self.portal.person_module, 'one'):
self.portal.person_module.manage_delObjects(['one'])
one = self.portal.person_module.newContent(id="one", title="One", description="Person One")
get_transaction().commit()
transaction.commit()
self.tic()
def parseICalFeed(self, feed_string):
......@@ -121,7 +118,7 @@ class TestICal(ERP5TypeTestCase):
if not run: return
module = self.portal.event_module
event = module.newContent(id='one', title='Event One', portal_type='Phone Call')
get_transaction().commit()
transaction.commit()
self.tic()
feed_dict = self.getICalFeed(module)
......@@ -147,7 +144,7 @@ class TestICal(ERP5TypeTestCase):
event.receive()
event.setStartDate('2007/08/15 10:30')
event.setDescription('Event One description')
get_transaction().commit()
transaction.commit()
self.tic()
feed_dict = self.getICalFeed(module)
......@@ -161,7 +158,7 @@ class TestICal(ERP5TypeTestCase):
# check categorization
sale_op = self.portal.sale_opportunity_module.newContent(portal_type='Sale Opportunity', title='New Opportunity', reference='NEWSALEOP')
event.setFollowUp(sale_op.getRelativeUrl())
get_transaction().commit()
transaction.commit()
self.tic()
feed_dict = self.getICalFeed(module)
......@@ -170,7 +167,7 @@ class TestICal(ERP5TypeTestCase):
# set stop date and change workflow state - assigned
event.assign()
event.setStopDate('2007/08/15 15:30')
get_transaction().commit()
transaction.commit()
self.tic()
feed_dict = self.getICalFeed(module)
......@@ -179,7 +176,7 @@ class TestICal(ERP5TypeTestCase):
# cancel event
event.cancel()
get_transaction().commit()
transaction.commit()
self.tic()
feed_dict = self.getICalFeed(module)
......@@ -195,7 +192,7 @@ class TestICal(ERP5TypeTestCase):
if not run: return
module = self.portal.task_module
task = module.newContent(id='one', title='Task One', start_date='2007/08/15')
get_transaction().commit()
transaction.commit()
self.tic()
# current workflow state - draft
......@@ -212,7 +209,7 @@ class TestICal(ERP5TypeTestCase):
title='New Project',
reference='NEWPROJ')
task.setSourceProjectValue(project)
get_transaction().commit()
transaction.commit()
self.tic()
feed_dict = self.getICalFeed(module)
......@@ -220,7 +217,7 @@ class TestICal(ERP5TypeTestCase):
# change workflow state - planned
task.plan()
get_transaction().commit()
transaction.commit()
self.tic()
feed_dict = self.getICalFeed(module)
......@@ -229,7 +226,7 @@ class TestICal(ERP5TypeTestCase):
# change workflow state - ordered
task.order()
get_transaction().commit()
transaction.commit()
self.tic()
feed_dict = self.getICalFeed(module)
......@@ -238,7 +235,7 @@ class TestICal(ERP5TypeTestCase):
# change workflow state - confirmed
task.confirm()
get_transaction().commit()
transaction.commit()
self.tic()
feed_dict = self.getICalFeed(module)
......
......@@ -27,6 +27,7 @@
##############################################################################
import unittest
import transaction
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from DateTime import DateTime
......@@ -61,19 +62,19 @@ class TestIdTool(ERP5TypeTestCase):
idtool = self.portal.portal_ids
# test with value stored into zodb
new_id = idtool.generateNewLengthId(id_group=4, store=1)
get_transaction().commit()
transaction.commit()
self.tic()
last_id = idtool.getLastLengthGeneratedId(id_group=4)
self.assertEqual(new_id, last_id)
# same test without storing value into zodb
new_id = idtool.generateNewLengthId(id_group=5, store=0)
get_transaction().commit()
transaction.commit()
self.tic()
last_id = idtool.getLastLengthGeneratedId(id_group=5)
self.assertEqual(new_id, last_id)
# test with id_group as tuple
new_id = idtool.generateNewLengthId(id_group=(6,), store=0)
get_transaction().commit()
transaction.commit()
self.tic()
last_id = idtool.getLastLengthGeneratedId(id_group=(6,),)
self.assertEqual(new_id, last_id)
......
......@@ -28,6 +28,7 @@
import unittest
import transaction
from Testing import ZopeTestCase
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type.tests.Sequence import SequenceList
......@@ -35,10 +36,6 @@ from DateTime import DateTime
from zLOG import LOG
from Products.ERP5.Document.ImmobilisationMovement import UNIMMOBILISING_METHOD, NO_CHANGE_METHOD
try:
from transaction import get as get_transaction
except ImportError:
pass
class TestImmobilisationMixin(ERP5TypeTestCase):
run_all_test = 1
......@@ -73,7 +70,7 @@ class TestImmobilisationMixin(ERP5TypeTestCase):
"""
For debugging
"""
get_transaction().commit()
transaction.commit()
def getBusinessTemplateList(self):
"""
......@@ -231,7 +228,7 @@ class TestImmobilisationMixin(ERP5TypeTestCase):
self.createAccountList()
self.createItemList()
self.validateRules()
get_transaction().commit()
transaction.commit()
self.tic()
self.workflow_tool = self.getWorkflowTool()
......@@ -244,7 +241,7 @@ class TestImmobilisationMixin(ERP5TypeTestCase):
self.logout()
self.login('manager')
get_transaction().commit()
transaction.commit()
self.tic()
simulation_id_list = [r for r in self.getPortal().portal_simulation.objectIds()]
......@@ -261,7 +258,7 @@ class TestImmobilisationMixin(ERP5TypeTestCase):
id_list = [r for r in self.getAccountingModule().objectIds()]
self.getAccountingModule().manage_delObjects(id_list)
get_transaction().commit()
transaction.commit()
self.tic()
def createCategories(self):
......@@ -352,7 +349,7 @@ class TestImmobilisationMixin(ERP5TypeTestCase):
mapping = mapping,
)
##We need to commit here because edit organisation doesn't apply
#get_transaction().commit()
#transaction.commit()
#self.tic()
for organisation_id in ['A','Aa','Ab','B','Ba','Bb','standalone']:
organisation = organisation_module[organisation_id]
......@@ -459,14 +456,14 @@ class TestImmobilisationMixin(ERP5TypeTestCase):
pl = sequence.get('packing_list')
if pl is None: pl = sequence.get('packing_list_list', [])[-1]
self.workflow_tool.doActionFor(pl, 'confirm_action', wf_id='packing_list_workflow')
get_transaction().commit()
transaction.commit()
self.tic()
self.workflow_tool.doActionFor(pl, 'set_ready_action', wf_id='packing_list_workflow')
self.workflow_tool.doActionFor(pl, 'start_action', wf_id='packing_list_workflow')
get_transaction().commit()
transaction.commit()
self.tic()
self.workflow_tool.doActionFor(pl, 'stop_action', wf_id='packing_list_workflow')
get_transaction().commit()
transaction.commit()
self.tic()
#self.workflow_tool.doActionFor(pl, 'deliver_action', wf_id='packing_list_workflow')
......@@ -495,7 +492,7 @@ class TestImmobilisationMixin(ERP5TypeTestCase):
pl_line = pl.newContent(portal_type = self.packing_list_line_portal_type)
pl_line.edit(aggregate_value_list = item_list,
resource_value=resource_value, **parameter_dict)
get_transaction().commit()
transaction.commit()
self.tic()
#pl.calculateImmobilisationValidity()
......@@ -576,10 +573,10 @@ class TestImmobilisationMixin(ERP5TypeTestCase):
def stepValidateAccounting(self, sequence=None, sequence_list=None, **kw):
for transaction in self.getAccountingModule().contentValues():
transaction.stop()
get_transaction().commit()
transaction.commit()
self.tic()
transaction.deliver()
get_transaction().commit()
transaction.commit()
self.tic()
def stepTestPackingListInvalidImmobilisationState(self, sequence=None, sequence_list=None, **kw):
......@@ -935,7 +932,7 @@ class TestImmobilisationMixin(ERP5TypeTestCase):
self.stepCreatePackingList(sequence=sequence)
self.stepAggregateItems(sequence=sequence)
self.stepDeliverPackingList(sequence=sequence)
get_transaction().commit()
transaction.commit()
self.tic()
for property in ('amortisation_start_price','amortisation_duration','immobilisation_vat',
'extra_cost_price','disposal_price'):
......@@ -949,7 +946,7 @@ class TestImmobilisationMixin(ERP5TypeTestCase):
self.stepCreatePackingList(sequence=sequence)
self.stepAggregateItems(sequence=sequence)
self.stepDeliverPackingList(sequence=sequence)
get_transaction().commit()
transaction.commit()
self.tic()
parameter_dict.update(self.monthly_dict)
sequence.edit(datetime = DateTime('2002/04/16'),
......@@ -957,7 +954,7 @@ class TestImmobilisationMixin(ERP5TypeTestCase):
self.stepCreatePackingList(sequence=sequence)
self.stepAggregateItems(sequence=sequence)
self.stepDeliverPackingList(sequence=sequence)
get_transaction().commit()
transaction.commit()
self.tic()
sequence.edit(datetime = DateTime('2002/05/16'),
parameter_dict = parameter_dict,
......@@ -965,7 +962,7 @@ class TestImmobilisationMixin(ERP5TypeTestCase):
self.stepCreatePackingList(sequence=sequence)
self.stepAggregateItems(sequence=sequence)
self.stepDeliverPackingList(sequence=sequence)
get_transaction().commit()
transaction.commit()
self.tic()
sequence.edit(datetime = DateTime('2002/06/16'),
parameter_dict = parameter_dict,
......@@ -973,7 +970,7 @@ class TestImmobilisationMixin(ERP5TypeTestCase):
self.stepCreatePackingList(sequence=sequence)
self.stepAggregateItems(sequence=sequence)
self.stepDeliverPackingList(sequence=sequence)
get_transaction().commit()
transaction.commit()
self.tic()
def stepBuildAccounting(self, sequence=None, sequence_list=None, **kw):
......@@ -3646,7 +3643,7 @@ class TestImmobilisation(TestImmobilisationMixin):
'currency_module/EUR')
wf_tool = self.getWorkflowTool()
wf_tool.doActionFor(preference,'enable_action',wf_id='preference_workflow')
get_transaction().commit()
transaction.commit()
self.tic()
# Now we can check several Accounting methods
account = self.getPortal().account_module.account3
......@@ -3654,7 +3651,7 @@ class TestImmobilisation(TestImmobilisationMixin):
self.assertEquals(10000.0,account.AccountModule_getTotalSourceCredit(brain=account))
preference.edit(preferred_accounting_transaction_section_category=\
'group/group B')
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEquals('group/group B',
preference_tool.getPreferredAccountingTransactionSectionCategory())
......
......@@ -28,6 +28,7 @@
import unittest
import transaction
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type.Base import _aq_reset
from AccessControl.SecurityManagement import newSecurityManager
......@@ -524,7 +525,7 @@ context.setDescription('%s,%s,%s' % (d, args, result))
self.assertEquals(organisation.getDescription(), 'bad')
organisation.getProperty('description', d='toto')
self.assertEquals(organisation.getDescription(), 'bad')
get_transaction().commit()
transaction.commit()
self.assertEquals(organisation.getDescription(), "toto,('description',),bad")
def test_17_activity_interaction(self, quiet=0, run=run_all_test):
......@@ -548,7 +549,7 @@ context.setTitle('Bar')
organisation.setTitle('Foo')
organisation.setGroupValue(organisation)
self.assertEquals(organisation.getTitle(), 'Foo')
get_transaction().commit()
transaction.commit()
self.assertEquals(organisation.getTitle(), 'Foo')
self.tic()
self.assertEquals(organisation.getTitle(), 'Bar')
......
......@@ -40,6 +40,8 @@
import unittest
import transaction
from Products.ERP5Type.Utils import cartesianProduct
from copy import copy
......@@ -307,14 +309,14 @@ class TestInventory(TestOrderMixin, ERP5TypeTestCase):
workflow_tool = self.getPortal().portal_workflow
workflow_tool.doActionFor(packing_list,
"confirm_action", "packing_list_workflow")
get_transaction().commit()
transaction.commit()
# Apply tic so that the packing list is not in building state
self.tic() # acceptable here because this is not the job
# of the test to check if can do all transition
# without processing messages
workflow_tool.doActionFor(packing_list,
"set_ready_action", "packing_list_workflow")
get_transaction().commit()
transaction.commit()
self.tic()
workflow_tool.doActionFor(packing_list,
"start_action", "packing_list_workflow")
......@@ -1194,7 +1196,7 @@ class TestInventory(TestOrderMixin, ERP5TypeTestCase):
LOG("Transiting '%s' on packing list %s" % (action, transition_step['id']), 0, '')
workflow_tool.doActionFor(transited_pl, action, packing_list_workflow)
transited_pl.recursiveImmediateReindexObject() # XXX
get_transaction().commit()
transaction.commit()
self.stepTic()
for omit_transit in (0,1):
......@@ -1685,9 +1687,9 @@ class TestInventory(TestOrderMixin, ERP5TypeTestCase):
)
sequence.edit(packing_list_list = packing_list_list)
get_transaction().commit()
transaction.commit()
self.stepTic()
get_transaction().commit()
transaction.commit()
# Then test the next negative date
next_date = simulation.getNextNegativeInventoryDate(
......
......@@ -36,6 +36,7 @@ import os
import random
import unittest
import transaction
from AccessControl.SecurityManagement import newSecurityManager
from DateTime import DateTime
from Testing import ZopeTestCase
......@@ -127,7 +128,7 @@ class InventoryAPITestCase(ERP5TypeTestCase):
def _safeTic(self):
"""Like tic, but swallowing errors, usefull for teardown"""
try:
get_transaction().commit()
transaction.commit()
self.tic()
except RuntimeError:
pass
......@@ -153,7 +154,7 @@ class InventoryAPITestCase(ERP5TypeTestCase):
activity_tool.manageCancel(message.object_path, message.method_id)
ZopeTestCase._print('\nCancelling active message %s.%s()\n'
% (message.object_path, message.method_id) )
get_transaction().commit()
transaction.commit()
def login(self, quiet=0, run=1):
uf = self.getPortal().acl_users
......@@ -228,7 +229,7 @@ class InventoryAPITestCase(ERP5TypeTestCase):
"""Creates a product."""
product = self.getProductModule().newContent(
portal_type = 'Product', **kw)
get_transaction().commit()
transaction.commit()
self.tic()
return product
_makeResource = _makeProduct
......@@ -297,7 +298,7 @@ class TestInventory(InventoryAPITestCase):
sim_mvt.setDeliveryValue(mvt)
self.failIf(sim_mvt.isAccountable())
# not accountable movement are not counted by getInventory
get_transaction().commit(); self.tic() # (after reindexing of course)
transaction.commit(); self.tic() # (after reindexing of course)
self.assertEquals(100, getInventory(section_uid=self.section.getUid()))
def test_OmitSimulation(self):
......@@ -330,7 +331,7 @@ class TestInventory(InventoryAPITestCase):
self.assertEquals(getInventory(
section_category_strict_membership=['group/level1']), 0)
self.section.setGroup('level1')
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEquals(getInventory(
section_category_strict_membership=['group/level1']), 100)
......@@ -363,7 +364,7 @@ class TestInventory(InventoryAPITestCase):
self.assertEquals(getInventory(
mirror_section_category_strict_membership=['group/level1']), 0)
self.mirror_section.setGroup('level1')
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEquals(getInventory(
mirror_section_category_strict_membership=['group/level1']), 100)
......@@ -387,7 +388,7 @@ class TestInventory(InventoryAPITestCase):
self.assertEquals(getInventory(
node_category_strict_membership=['group/level1']), 0)
self.node.setGroup('level1')
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEquals(getInventory(
node_category_strict_membership=['group/level1']), 100)
......@@ -405,7 +406,7 @@ class TestInventory(InventoryAPITestCase):
self.assertEquals(getInventory(
resource_category_strict_membership=['product_line/level1']), 0)
self.resource.setProductLine('level1')
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEquals(getInventory(
resource_category_strict_membership=['product_line/level1']), 100)
......@@ -426,7 +427,7 @@ class TestInventory(InventoryAPITestCase):
self.assertEquals(getInventory(
payment_category_strict_membership=['product_line/level1']), 0)
self.payment_node.setProductLine('level1')
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEquals(getInventory(
payment_category_strict_membership=['product_line/level1']), 100)
......@@ -2003,7 +2004,7 @@ class TestInventoryDocument(InventoryAPITestCase):
# everything must be consistent after reindexation
inventory_module = self.getPortal().getDefaultModule(portal_type='Inventory')
inventory_module.recursiveReindexObject()
get_transaction().commit()
transaction.commit()
self.tic()
inventory_kw={'node_uid': self.node_uid,
'at_date': self.INVENTORY_DATE_3}
......@@ -2050,7 +2051,7 @@ class TestInventoryDocument(InventoryAPITestCase):
self.workflow_tool.doActionFor(inventory, transition_id,
wf_id=workflow_id)
self.assertEquals('delivered', inventory.getSimulationState())
get_transaction().commit()
transaction.commit()
self.tic()
# We should detect the previous inventory and fails
......@@ -2069,7 +2070,7 @@ class TestInventoryDocument(InventoryAPITestCase):
self.workflow_tool.doActionFor(new_inventory, transition_id,
wf_id=workflow_id)
self.assertEquals('delivered', new_inventory.getSimulationState())
get_transaction().commit()
transaction.commit()
self.tic()
new_inventory = new_inventory.Base_createCloneDocument(batch_mode=1)
......@@ -2089,7 +2090,7 @@ class TestInventoryDocument(InventoryAPITestCase):
if psheet in ps_list:
ps_list.remove(psheet)
ti.property_sheet_list = ps_list
get_transaction().commit()
transaction.commit()
_aq_reset()
......
This diff is collapsed.
......@@ -32,6 +32,7 @@ Warning: this tests an obsolete API; the test is disabled.
"""
import unittest
import transaction
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from AccessControl.SecurityManagement import newSecurityManager
......@@ -63,7 +64,7 @@ class TestInvoiceVAT(ERP5TypeTestCase):
def _safeTic(self):
"""Like tic, but swallowing errors, usefull for teardown"""
try:
get_transaction().commit()
transaction.commit()
self.tic()
except RuntimeError:
pass
......@@ -93,7 +94,7 @@ class TestInvoiceVAT(ERP5TypeTestCase):
activity_tool.manageCancel(message.object_path, message.method_id)
_print('\nCancelling active message %s.%s()\n'
% (message.object_path, message.method_id) )
get_transaction().commit()
transaction.commit()
def login(self, quiet=0, run=1):
uf = self.getPortal().acl_users
......@@ -148,7 +149,7 @@ class TestInvoiceVAT(ERP5TypeTestCase):
account = self.getPortal().account_module.newContent(
portal_type='Account',
**kw)
get_transaction().commit()
transaction.commit()
self.tic()
return account
......@@ -157,7 +158,7 @@ class TestInvoiceVAT(ERP5TypeTestCase):
org = self.getPortal().organisation_module.newContent(
portal_type='Organisation',
**kw)
get_transaction().commit()
transaction.commit()
self.tic()
return org
......@@ -166,7 +167,7 @@ class TestInvoiceVAT(ERP5TypeTestCase):
spl = self.getPortal().sale_packing_list_module.newContent(
portal_type='Sale Packing List',)
spl.edit(**kw)
get_transaction().commit()
transaction.commit()
self.tic()
return spl
......@@ -176,7 +177,7 @@ class TestInvoiceVAT(ERP5TypeTestCase):
portal_type='Sale Invoice Transaction',
created_by_builder=created_by_builder)
sit.edit(**kw)
get_transaction().commit()
transaction.commit()
self.tic()
return sit
......@@ -184,7 +185,7 @@ class TestInvoiceVAT(ERP5TypeTestCase):
"""Creates a currency."""
currency = self.getCurrencyModule().newContent(
portal_type = 'Currency', **kw)
get_transaction().commit()
transaction.commit()
self.tic()
return currency
......@@ -192,7 +193,7 @@ class TestInvoiceVAT(ERP5TypeTestCase):
"""Creates a resource."""
resource = self.getPortal().product_module.newContent(
portal_type='Product', **kw)
get_transaction().commit()
transaction.commit()
self.tic()
return resource
......@@ -214,7 +215,7 @@ class TestInvoiceVAT(ERP5TypeTestCase):
pred.setMembershipCriterionBaseCategoryList('resource')
pred.setMembershipCriterionCategoryList(['resource/%s' %
resource.getRelativeUrl()])
get_transaction().commit()
transaction.commit()
self.tic()
itr.updateMatrix()
......@@ -241,11 +242,11 @@ class TestInvoiceVAT(ERP5TypeTestCase):
packing_list.confirm()
packing_list.setReady()
packing_list.start()
get_transaction().commit()
transaction.commit()
self.tic()
packing_list.stop()
self.assertEquals(packing_list.getSimulationState(), 'stopped')
get_transaction().commit()
transaction.commit()
self.tic()
def _makeOnePackingList(self):
......@@ -344,7 +345,7 @@ class TestInvoiceVAT(ERP5TypeTestCase):
# confirm the invoice,
invoice.confirm()
get_transaction().commit()
transaction.commit()
self.tic()
# this will generate accounting lines
self.assertNotEquals(len(invoice.getMovementList(
......@@ -373,7 +374,7 @@ class TestInvoiceVAT(ERP5TypeTestCase):
price=100,
resource_value=resource )
invoice.plan()
get_transaction().commit();
transaction.commit();
self.tic()
# actual values on invoice line should be:
......@@ -398,7 +399,7 @@ class TestInvoiceVAT(ERP5TypeTestCase):
price=100,
resource_value=resource )
invoice.plan()
get_transaction().commit();
transaction.commit();
self.tic()
# actual values on invoice line should be:
......@@ -433,7 +434,7 @@ class TestInvoiceVAT(ERP5TypeTestCase):
price=100,
resource_value=res )
invoice.plan()
get_transaction().commit();
transaction.commit();
self.tic()
# actual values on invoice line should be:
......
......@@ -28,6 +28,7 @@
import unittest
import transaction
from Testing import ZopeTestCase
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from AccessControl.SecurityManagement import newSecurityManager
......@@ -75,17 +76,17 @@ class TestNotificationMessageModule(ERP5TypeTestCase):
portal._setObject('MailHost', DummyMailHost('MailHost'))
portal.email_from_address = 'site@example.invalid'
self.portal.portal_caches.clearAllCache()
get_transaction().commit()
transaction.commit()
self.tic()
self.changeUser('erp5user')
def beforeTearDown(self):
get_transaction().abort()
transaction.abort()
# clear modules if necessary
module_list = (self.getNotificationMessageModule(),)
for module in module_list:
module.manage_delObjects(list(module.objectIds()))
get_transaction().commit()
transaction.commit()
self.tic()
def test_01_get_document(self, quiet=quiet, run=run_all_test):
......@@ -102,7 +103,7 @@ class TestNotificationMessageModule(ERP5TypeTestCase):
language='en',
version='01')
n_m_en.validate()
get_transaction().commit()
transaction.commit()
self.tic()
result = tool.getDocumentValue(reference='A')
self.assertEqual(result.getRelativeUrl(), n_m_en.getRelativeUrl())
......@@ -112,7 +113,7 @@ class TestNotificationMessageModule(ERP5TypeTestCase):
language='fr',
version='01')
n_m_fr.validate()
get_transaction().commit()
transaction.commit()
self.tic()
result = tool.getDocumentValue(reference='A', language='fr')
self.assertEqual(result.getRelativeUrl(), n_m_fr.getRelativeUrl())
......@@ -122,7 +123,7 @@ class TestNotificationMessageModule(ERP5TypeTestCase):
language='fr',
version='02')
n_m_fr_02.validate()
get_transaction().commit()
transaction.commit()
self.tic()
result = tool.getDocumentValue(reference='A', language='fr')
self.assertEqual(result.getRelativeUrl(), n_m_fr_02.getRelativeUrl())
......
......@@ -28,6 +28,7 @@
import unittest
import transaction
from Testing import ZopeTestCase
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from AccessControl.SecurityManagement import newSecurityManager
......@@ -134,16 +135,16 @@ class TestNotificationTool(ERP5TypeTestCase):
portal._setObject('MailHost', DummyMailHost('MailHost'))
portal.email_from_address = 'site@example.invalid'
self.portal.portal_caches.clearAllCache()
get_transaction().commit()
transaction.commit()
self.tic()
self.changeUser('erp5user')
def beforeTearDown(self):
get_transaction().abort()
transaction.abort()
# clear modules if necessary
self.portal.person_module.manage_delObjects(
list(self.portal.person_module.objectIds()))
get_transaction().commit()
transaction.commit()
self.tic()
def stepTic(self,**kw):
......@@ -588,7 +589,7 @@ class TestNotificationToolWithCRM(TestNotificationTool):
TestNotificationTool.beforeTearDown(self)
self.portal.event_module.manage_delObjects(
list(self.portal.event_module.objectIds()))
get_transaction().commit()
transaction.commit()
self.tic()
def test_store_as_event(self):
......@@ -603,7 +604,7 @@ class TestNotificationToolWithCRM(TestNotificationTool):
recipient=person,
subject='Subject',
message='Message')
get_transaction().commit()
transaction.commit()
self.tic()
last_message = self.portal.MailHost._last_message
self.assertNotEquals((), last_message)
......
......@@ -25,10 +25,10 @@
#
##############################################################################
import unittest
from transaction import get as get_transaction
from AccessControl.SecurityManagement import newSecurityManager
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from DateTime import DateTime
import transaction
class TestOpenOrder(ERP5TypeTestCase):
......@@ -170,7 +170,7 @@ class TestOpenOrder(ERP5TypeTestCase):
)
self.portal._run_after_setup = True
get_transaction().commit()
transaction.commit()
self.tic()
def testPeriodicityDateList(self):
......@@ -244,7 +244,7 @@ class TestOpenOrder(ERP5TypeTestCase):
open_sale_order.Order_applyTradeCondition(open_sale_order.getSpecialiseValue())
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEqual(open_sale_order_line.getPrice(), 100)
......@@ -255,7 +255,7 @@ class TestOpenOrder(ERP5TypeTestCase):
open_sale_order.order()
open_sale_order.start()
get_transaction().commit()
transaction.commit()
self.tic()
applied_rule = open_sale_order.getCausalityRelatedValue(portal_type='Applied Rule')
......@@ -265,7 +265,7 @@ class TestOpenOrder(ERP5TypeTestCase):
applied_rule,
calculation_base_date=DateTime(3000,2,9))
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEqual(len(applied_rule.objectIds()), 1)
......@@ -277,7 +277,7 @@ class TestOpenOrder(ERP5TypeTestCase):
applied_rule,
calculation_base_date=DateTime(3000,2,9))
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEqual(len(applied_rule.objectIds()), 2)
......@@ -288,7 +288,7 @@ class TestOpenOrder(ERP5TypeTestCase):
applied_rule,
calculation_base_date=DateTime(3000,3,1))
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEqual(len(applied_rule.objectIds()), 5)
......@@ -305,7 +305,7 @@ class TestOpenOrder(ERP5TypeTestCase):
applied_rule,
calculation_base_date=DateTime(3000,3,1))
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEqual(len(applied_rule.objectIds()), 5)
......@@ -315,7 +315,7 @@ class TestOpenOrder(ERP5TypeTestCase):
applied_rule,
calculation_base_date=DateTime(3000,3,30))
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEqual(len(applied_rule.objectIds()), 6)
......@@ -344,7 +344,7 @@ class TestOpenOrder(ERP5TypeTestCase):
# Remove other test's side effect.
self.portal.sale_trade_condition_module.main_trade_condition.setExpirationDate(None)
get_transaction().commit()
transaction.commit()
self.tic()
open_sale_order.newContent(
......@@ -373,13 +373,13 @@ class TestOpenOrder(ERP5TypeTestCase):
open_sale_order.Order_applyTradeCondition(open_sale_order.getSpecialiseValue())
get_transaction().commit()
transaction.commit()
self.tic()
open_sale_order.order()
open_sale_order.start()
get_transaction().commit()
transaction.commit()
self.tic()
applied_rule = open_sale_order.getCausalityRelatedValue(portal_type='Applied Rule')
......@@ -387,7 +387,7 @@ class TestOpenOrder(ERP5TypeTestCase):
open_sale_order.autoOrderPeriodically(comment='Test', calculation_base_date=DateTime(3000,2,9))
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEqual(len(applied_rule.objectIds()), 9)
......@@ -396,7 +396,7 @@ class TestOpenOrder(ERP5TypeTestCase):
# Do the same thing and nothing happens.
open_sale_order.autoOrderPeriodically(comment='Test', calculation_base_date=DateTime(3000,2,9))
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEqual(len(applied_rule.objectIds()), 9)
......@@ -405,7 +405,7 @@ class TestOpenOrder(ERP5TypeTestCase):
# Next
open_sale_order.autoOrderPeriodically(comment='Test', calculation_base_date=DateTime(3000,2,14))
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEqual(len(applied_rule.objectIds()), 19)
......
......@@ -30,6 +30,7 @@
import unittest
import os
import transaction
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type.tests.utils import FileUpload
from AccessControl.SecurityManagement import newSecurityManager
......@@ -2053,7 +2054,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
resource_value=resource,
price=2,
quantity=3)
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEquals(order_line.isMovement(), True)
......@@ -2079,7 +2080,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
price=3, quantity=4,
predicate_category_list=cell_key,
variation_category_list=cell_key)
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEquals(order_line.isMovement(), False)
......@@ -2101,7 +2102,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
# if cell has no price, the total price is None, but a default value can be
# provided
cell.setPrice(None)
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEquals(order_line.isMovement(), False)
......@@ -2122,7 +2123,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
# restore the price on the line
cell.setPrice(3)
get_transaction().commit()
transaction.commit()
self.tic()
# add sub_line to line, cell and line are not movements
......@@ -2130,7 +2131,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
portal_type=self.order_line_portal_type,
price=4,
quantity=5)
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEquals(order_line.isMovement(), False)
......@@ -2157,7 +2158,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
# if this line has no price, getTotalPrice returns 0
sub_order_line.setPrice(None)
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEquals(order_line.isMovement(), False)
self.assertEquals(cell.isMovement(), False)
......@@ -2183,7 +2184,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
# restore price on the sub line
sub_order_line.setPrice(4)
get_transaction().commit()
transaction.commit()
self.tic()
......@@ -2198,7 +2199,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
price=5, quantity=6,
predicate_category_list=cell_key,
variation_category_list=cell_key)
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEquals(order_line.isMovement(), False)
......@@ -2229,7 +2230,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
# delete sub_line, cell is movement again
order_line.manage_delObjects([sub_order_line.getId()])
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEquals(order_line.isMovement(), False)
......@@ -2251,7 +2252,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
# delete cell, line is movement again
order_line.manage_delObjects([cell.getId()])
order_line.setVariationCategoryList([])
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEquals(order_line.isMovement(), True)
......@@ -2447,7 +2448,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
portal_type='Payment Condition')))
order.confirm()
get_transaction().commit()
transaction.commit()
self.tic()
related_packing_list = order.getCausalityRelatedValue(
portal_type=self.packing_list_portal_type)
......@@ -2477,7 +2478,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
quantity=10,
price=3)
order.confirm()
get_transaction().commit()
transaction.commit()
self.tic()
odt = order.Order_viewAsODT()
......@@ -2509,7 +2510,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
quantity=10,
price=3)
order.confirm()
get_transaction().commit()
transaction.commit()
self.tic()
odt = order.Order_viewAsODT()
......@@ -2546,7 +2547,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
quantity=10,
price=3)
order.confirm()
get_transaction().commit()
transaction.commit()
self.tic()
odt = order.Order_viewAsODT()
......@@ -2586,7 +2587,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
quantity=10,
price=3)
order.confirm()
get_transaction().commit()
transaction.commit()
self.tic()
odt = order.Order_viewAsODT()
......@@ -2628,7 +2629,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
quantity=30,
price=.26)
order.confirm()
get_transaction().commit()
transaction.commit()
self.tic()
odt = order.Order_viewAsODT()
......@@ -2667,7 +2668,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
quantity=10,
price=3)
order.confirm()
get_transaction().commit()
transaction.commit()
self.tic()
odt = order.Order_viewAsODT()
......
......@@ -29,6 +29,7 @@
import unittest
import transaction
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from DateTime import DateTime
from zLOG import LOG
......@@ -312,7 +313,7 @@ class TestOrderBuilderMixin(TestOrderMixin):
list(self.decrease_quantity_matrix.iterkeys())
)
get_transaction().commit()
transaction.commit()
self.tic()
base_id = 'movement'
......
......@@ -28,6 +28,8 @@
import unittest
import transaction
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from zLOG import LOG
from Products.ERP5Type.tests.Sequence import SequenceList
......@@ -846,7 +848,7 @@ class TestPackingListMixin(TestOrderMixin):
"""
if packing_list is None:
packing_list = sequence.get('packing_list')
get_transaction().commit()
transaction.commit()
self.assertEquals(1,packing_list.isPacked())
self.assertEquals('packed',packing_list.getContainerState())
......@@ -1338,7 +1340,7 @@ class TestPackingList(TestPackingListMixin, ERP5TypeTestCase) :
quantity=10,
price=3)
packing_list.confirm()
get_transaction().commit()
transaction.commit()
self.tic()
odt = packing_list.PackingList_viewAsODT()
......
......@@ -60,16 +60,16 @@ class TestPasswordTool(ERP5TypeTestCase):
self.portal.portal_caches.clearAllCache()
def beforeTearDown(self):
get_transaction().abort()
transaction.abort()
# clear modules if necessary
self.portal.person_module.manage_delObjects(list(self.portal.person_module.objectIds()))
# reset password tool internal structure
self.portal.portal_password.password_request_dict.clear()
get_transaction().commit()
transaction.commit()
self.tic()
def stepTic(self,**kw):
get_transaction().commit()
transaction.commit()
self.tic()
def getUserFolder(self):
......
......@@ -30,6 +30,8 @@
import unittest
import transaction
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from zLOG import LOG
from Products.ERP5Type.tests.Sequence import SequenceList
......@@ -85,7 +87,7 @@ class TestProductionOrderMixin(TestOrderMixin):
)
system_preference.enable()
get_transaction().commit()
transaction.commit()
self.tic()
def afterSetUp(self):
......
......@@ -29,6 +29,7 @@ import unittest
import os
from AccessControl.SecurityManagement import newSecurityManager
import transaction
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type.tests.utils import DummyMailHost
......@@ -48,11 +49,11 @@ class TestQueryModule(ERP5TypeTestCase):
portal._setObject('MailHost', DummyMailHost('MailHost'))
def beforeTearDown(self):
get_transaction().abort()
transaction.abort()
# clear modules if necessary
for module in (self.portal.person_module, self.portal.query_module,):
module.manage_delObjects(list(module.objectIds()))
get_transaction().commit()
transaction.commit()
self.tic()
def test_post_query_action_visible(self):
......@@ -99,7 +100,7 @@ class TestQueryModule(ERP5TypeTestCase):
default_email_text='question_user@example.invalid')
assignment = question_person.newContent(portal_type='Assignment')
assignment.validate()
get_transaction().commit()
transaction.commit()
self.tic()
uf = self.portal.acl_users
owner_user = uf.getUser('owner_user').__of__(uf)
......
......@@ -33,10 +33,7 @@ from Products.ERP5Form.Form import ERP5Form
from xml.dom.minidom import parseString
try:
from transaction import get as get_transaction
except ImportError:
pass
import transaction
def getNodeContent(node):
......@@ -82,7 +79,7 @@ class TestRSS(ERP5TypeTestCase):
self.portal.person_module.manage_delObjects(['two'])
one = self.portal.person_module.newContent(id="one", title="One", description="Person One")
two = self.portal.person_module.newContent(id="two", title="Two", description="Person Two")
get_transaction().commit()
transaction.commit()
one.reindexObject()
two.reindexObject()
self.tic()
......
......@@ -27,7 +27,7 @@
##############################################################################
import unittest
import transaction
from Testing import ZopeTestCase
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from AccessControl.SecurityManagement import newSecurityManager
......@@ -79,7 +79,7 @@ class TestResource(ERP5TypeTestCase):
self.createCategories()
def beforeTearDown(self):
get_transaction().abort()
transaction.abort()
for folder in (
self.portal.getDefaultModule(self.resource_portal_type),
self.portal.getDefaultModule(self.sale_supply_portal_type),
......@@ -88,7 +88,7 @@ class TestResource(ERP5TypeTestCase):
self.portal.getDefaultModule("Sale Order"),
self.portal.getDefaultModule("Purchase Order"),):
folder.manage_delObjects([i for i in folder.objectIds()])
get_transaction().commit()
transaction.commit()
self.tic()
def createCategories(self):
......@@ -579,7 +579,7 @@ class TestResource(ERP5TypeTestCase):
supply_line.setProperty(key, pricing_param)
# Commit transaction
self.logMessage("Commit transaction...", tab=1)
get_transaction().commit()
transaction.commit()
# Tic
self.logMessage("Tic...", tab=1)
self.tic()
......@@ -598,7 +598,7 @@ class TestResource(ERP5TypeTestCase):
preference = self.portal.portal_preferences.default_site_preference
preference.setPreferredProductOptionalVariationBaseCategoryList(['industrial_phase'])
preference.enable()
get_transaction().commit()
transaction.commit()
self.tic()
# Create another product/supply, in order to be sure that the
# nothing will be generated from this supply!
......@@ -654,7 +654,7 @@ class TestResource(ERP5TypeTestCase):
cell2.setMembershipCriterionCategory('industrial_phase/phase2')
# Commit transaction
self.logMessage("Commit transaction...", tab=1)
get_transaction().commit()
transaction.commit()
# Tic
self.logMessage("Tic...", tab=1)
self.tic()
......@@ -738,7 +738,7 @@ class TestResource(ERP5TypeTestCase):
test_case_list.append((product, None, j))
# Commit transaction
self.logMessage("Commit transaction...", tab=1)
get_transaction().commit()
transaction.commit()
# Tic
self.logMessage("Tic...", tab=1)
self.tic()
......@@ -857,7 +857,7 @@ class TestResource(ERP5TypeTestCase):
# Commit transaction
self.logMessage("Commit transaction...", tab=1)
get_transaction().commit()
transaction.commit()
# Tic
self.logMessage("Tic...", tab=1)
self.tic()
......@@ -937,11 +937,11 @@ class TestResource(ERP5TypeTestCase):
sale_order_line = sale_order.newContent(
portal_type="Sale Order Line",
resource_value=product)
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEquals(sale_order_line.getPrice(), 400.0)
sale_order.setDestinationSectionValue(orga2)
get_transaction().commit()
transaction.commit()
self.tic()
sale_order_line.setPrice(None)
self.assertEquals(sale_order_line.getPrice(), 200.0)
......@@ -953,11 +953,11 @@ class TestResource(ERP5TypeTestCase):
purchase_order_line = purchase_order.newContent(
portal_type="Purchase Order Line",
resource_value=product)
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEquals(purchase_order_line.getPrice(), 40.0)
purchase_order.setSourceSectionValue(orga2)
get_transaction().commit()
transaction.commit()
self.tic()
purchase_order_line.setPrice(None)
self.assertEquals(purchase_order_line.getPrice(), 20.0)
......@@ -969,7 +969,7 @@ class TestResource(ERP5TypeTestCase):
supply_line = resource.newContent(
portal_type=self.sale_supply_line_portal_type)
supply_line.setBasePrice(1000)
get_transaction().commit()
transaction.commit()
self.tic()
sale_order = self.portal.getDefaultModule("Sale Order").newContent(
portal_type='Sale Order',)
......
......@@ -32,6 +32,7 @@
Tests Resource Variations
"""
import unittest
import transaction
from Testing import ZopeTestCase
from zLOG import LOG
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
......@@ -222,13 +223,13 @@ class ResourceVariationTestCase(ERP5TypeTestCase):
'option_colour',
'individual_aspect']
get_transaction().commit()
transaction.commit()
self.tic()
def beforeTearDown(self):
"""Remove all documents.
"""
get_transaction().abort()
transaction.abort()
self.product_module.manage_delObjects(
list(self.service_module.objectIds()))
self.service_module.manage_delObjects(
......@@ -238,7 +239,7 @@ class ResourceVariationTestCase(ERP5TypeTestCase):
self.portal_categories.manage_delObjects((['required_size',
'individual_aspect','option_colour']))
get_transaction().commit()
transaction.commit()
self.tic()
def getBusinessTemplateList(self):
......
......@@ -27,6 +27,8 @@
import unittest
import transaction
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type.tests.utils import createZODBPythonScript
from zLOG import LOG
......@@ -65,7 +67,7 @@ class TestRuleMixin(TestOrderMixin):
self.getSimulationTool().manage_delObjects(
ids=list(self.getSimulationTool().objectIds()))
# commit
get_transaction().commit()
transaction.commit()
self.tic()
......@@ -74,7 +76,7 @@ class TestRuleMixin(TestOrderMixin):
container.manage_delObjects(ids=[id])
self.getSimulationTool().manage_delObjects(
ids=list(self.getSimulationTool().objectIds()))
get_transaction().commit()
transaction.commit()
self.tic()
def getTitle(self):
......@@ -96,10 +98,10 @@ class TestRuleMixin(TestOrderMixin):
source_section='group/a', destination_section='group/b')
pl.newContent(portal_type=self.packing_list_line_portal_type, id='line')
pl.setStartDate("2007-07-01")
get_transaction().commit()
transaction.commit()
self.tic()
pl.confirm()
get_transaction().commit()
transaction.commit()
self.tic()
return pl
......@@ -118,7 +120,7 @@ class TestRule(TestRuleMixin, ERP5TypeTestCase) :
delivery_rule = self.getRuleTool().searchFolder(
reference='default_delivery_rule')[0]
delivery_rule.validate()
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEquals(self.getRuleTool().countFolder(
......@@ -138,7 +140,7 @@ class TestRule(TestRuleMixin, ERP5TypeTestCase) :
reference='default_delivery_rule')[0]
delivery_rule.setTestMethodId('wrong_script')
delivery_rule.validate()
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEquals(self.getRuleTool().countFolder(
......@@ -158,7 +160,7 @@ class TestRule(TestRuleMixin, ERP5TypeTestCase) :
reference='default_delivery_rule')[0]
delivery_rule.setTestMethodId('good_script')
delivery_rule.validate()
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEquals(self.getRuleTool().countFolder(
......@@ -180,7 +182,7 @@ class TestRule(TestRuleMixin, ERP5TypeTestCase) :
delivery_rule.setTestMethodId('good_script')
delivery_rule.validate()
delivery_rule.invalidate()
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEquals(self.getRuleTool().countFolder(
......@@ -200,7 +202,7 @@ class TestRule(TestRuleMixin, ERP5TypeTestCase) :
reference='default_delivery_rule')[0]
delivery_rule.setTestMethodId('good_script')
delivery_rule.validate()
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEquals(self.getRuleTool().countFolder(
......@@ -223,7 +225,7 @@ class TestRule(TestRuleMixin, ERP5TypeTestCase) :
delivery_rule.setStartDateRangeMin('2007-06-01')
delivery_rule.setStartDateRangeMax('2007-06-04')
delivery_rule.validate()
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEquals(self.getRuleTool().countFolder(
......@@ -246,7 +248,7 @@ class TestRule(TestRuleMixin, ERP5TypeTestCase) :
delivery_rule.setStartDateRangeMin('2007-06-01')
delivery_rule.setStartDateRangeMax('2007-08-01')
delivery_rule.validate()
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEquals(self.getRuleTool().countFolder(
......@@ -282,12 +284,12 @@ class TestRule(TestRuleMixin, ERP5TypeTestCase) :
version='2')
delivery_rule_2.setTestMethodId('rule_script')
delivery_rule_2.validate()
get_transaction().commit()
transaction.commit()
self.tic()
# delivery_rule_2 should be applied
self.pl.updateAppliedRule('default_delivery_rule')
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEquals(self.pl.getCausalityRelatedValue().getSpecialise(),
delivery_rule_2.getRelativeUrl())
......@@ -297,12 +299,12 @@ class TestRule(TestRuleMixin, ERP5TypeTestCase) :
# increase version of delivery_rule_1
delivery_rule_1.setVersion("3")
get_transaction().commit()
transaction.commit()
self.tic()
# delivery_rule_1 should be applied
self.pl.updateAppliedRule('default_delivery_rule')
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEquals(self.pl.getCausalityRelatedValue().getSpecialise(),
delivery_rule_1.getRelativeUrl())
......@@ -344,11 +346,11 @@ class TestRule(TestRuleMixin, ERP5TypeTestCase) :
# clear simulation
self.getSimulationTool().manage_delObjects(
ids=list(self.getSimulationTool().objectIds()))
get_transaction().commit()
transaction.commit()
self.tic()
self.pl.updateAppliedRule('default_delivery_rule')
get_transaction().commit()
transaction.commit()
self.tic()
# check that only one invoicing rule (higher version) was applied
......@@ -367,11 +369,11 @@ class TestRule(TestRuleMixin, ERP5TypeTestCase) :
self.getSimulationTool().manage_delObjects(
ids=[self.pl.getCausalityRelatedId()])
invoicing_rule_1.setVersion('3')
get_transaction().commit()
transaction.commit()
self.tic()
self.pl.updateAppliedRule('default_delivery_rule')
get_transaction().commit()
transaction.commit()
self.tic()
# check that only one invoicing rule (higher version) was applied
......@@ -418,11 +420,11 @@ class TestRule(TestRuleMixin, ERP5TypeTestCase) :
# clear simulation
self.getSimulationTool().manage_delObjects(
ids=list(self.getSimulationTool().objectIds()))
get_transaction().commit()
transaction.commit()
self.tic()
self.pl.updateAppliedRule('default_delivery_rule')
get_transaction().commit()
transaction.commit()
self.tic()
root_applied_rule = self.pl.getCausalityRelatedValue()
......@@ -436,7 +438,7 @@ class TestRule(TestRuleMixin, ERP5TypeTestCase) :
# change rule script so that it matches and test again
invoicing_rule_1.setTestMethodId('invoice_rule_script')
root_applied_rule.expand()
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEquals(root_applied_rule.getRelativeUrl(),
......@@ -464,10 +466,10 @@ class TestRule(TestRuleMixin, ERP5TypeTestCase) :
portal_type="Invoicing Rule", reference='default_invoicing_rule_2',
version='2', test_method_id='invoice_rule_script')
invoicing_rule_n.validate()
get_transaction().commit()
transaction.commit()
self.tic()
root_applied_rule.expand()
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEquals(root_applied_rule.getRelativeUrl(),
......@@ -516,11 +518,11 @@ class TestRule(TestRuleMixin, ERP5TypeTestCase) :
self.getSimulationTool().manage_delObjects(
ids=list(self.getSimulationTool().objectIds()))
get_transaction().commit()
transaction.commit()
self.tic()
self.pl.updateAppliedRule('default_delivery_rule')
get_transaction().commit()
transaction.commit()
self.tic()
root_applied_rule = self.pl.getCausalityRelatedValue()
......@@ -536,11 +538,11 @@ class TestRule(TestRuleMixin, ERP5TypeTestCase) :
# invalidate the rule and test that it is still there
invoicing_rule_1.invalidate()
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEquals(invoicing_rule_1.getValidationState(), 'invalidated')
root_applied_rule.expand()
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEquals(root_applied_rule.getRelativeUrl(),
......@@ -558,7 +560,7 @@ class TestRule(TestRuleMixin, ERP5TypeTestCase) :
# removed
invoicing_rule_1.setTestMethodId('delivery_rule_script')
root_applied_rule.expand()
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEquals(root_applied_rule.getRelativeUrl(),
......@@ -574,11 +576,11 @@ class TestRule(TestRuleMixin, ERP5TypeTestCase) :
# that the rule is still there
invoicing_rule_1.setTestMethodId('invoice_rule_script')
invoicing_rule_1.validate()
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEquals(invoicing_rule_1.getValidationState(), 'validated')
root_applied_rule.expand()
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEquals(root_applied_rule.getRelativeUrl(),
......@@ -598,7 +600,7 @@ class TestRule(TestRuleMixin, ERP5TypeTestCase) :
invoicing_rule_1.setTestMethodId('delivery_rule_script')
root_applied_rule.expand()
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEquals(root_applied_rule.getRelativeUrl(),
......@@ -653,11 +655,11 @@ class TestRule(TestRuleMixin, ERP5TypeTestCase) :
self.getSimulationTool().manage_delObjects(
ids=list(self.getSimulationTool().objectIds()))
get_transaction().commit()
transaction.commit()
self.tic()
self.pl.updateAppliedRule('default_delivery_rule')
get_transaction().commit()
transaction.commit()
self.tic()
root_applied_rule = self.pl.getCausalityRelatedValue()
......@@ -675,7 +677,7 @@ class TestRule(TestRuleMixin, ERP5TypeTestCase) :
# replaced by invoicing rule 1
invoicing_rule_2.setTestMethodId('delivery_rule_script')
root_applied_rule.expand()
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEquals(root_applied_rule.getRelativeUrl(),
......@@ -695,7 +697,7 @@ class TestRule(TestRuleMixin, ERP5TypeTestCase) :
sub_movement = applied_rule.objectValues()[0]
sub_movement.setDeliveryValue(self.pl.line)
root_applied_rule.expand()
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEquals(root_applied_rule.getRelativeUrl(),
......
......@@ -28,6 +28,7 @@
import unittest
import transaction
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type.tests.utils import reindex
from DateTime import DateTime
......@@ -105,7 +106,7 @@ class TestSaleSupply(TestSupplyMixin, ERP5TypeTestCase):
start_date_range_max='2009/01/31')
supply_line = self._makeSupplyLine(supply)
get_transaction().commit()
transaction.commit()
self.tic()
res = self.domain_tool.searchPredicateList(movement,
......@@ -118,7 +119,7 @@ class TestSaleSupply(TestSupplyMixin, ERP5TypeTestCase):
supply.edit(start_date_range_min='2009/02/01',
start_date_range_max='2009/02/28')
get_transaction().commit()
transaction.commit()
self.tic()
res = self.domain_tool.searchPredicateList(movement,
......@@ -130,7 +131,7 @@ class TestSaleSupply(TestSupplyMixin, ERP5TypeTestCase):
# movement is going back into timeframe...
movement.edit(start_date='2009/02/15')
get_transaction().commit()
transaction.commit()
self.tic()
res = self.domain_tool.searchPredicateList(movement,
......@@ -166,7 +167,7 @@ class TestSaleSupply(TestSupplyMixin, ERP5TypeTestCase):
# set new date on supply...
supply.edit(start_date_range_min=new_date)
get_transaction().commit()
transaction.commit()
self.tic()
# ...and check supply line
......
......@@ -28,6 +28,7 @@
"""Tests Template functionality"""
import unittest
import transaction
from AccessControl.SecurityManagement import newSecurityManager
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type import Permissions
......@@ -67,19 +68,19 @@ class TestTemplate(ERP5TypeTestCase):
preference.priority = Priority.USER
preference.enable()
get_transaction().commit()
transaction.commit()
self.tic()
document = self.portal.foo_module.newContent(portal_type='Foo')
document.edit(title='My Foo 1')
document.newContent(portal_type='Foo Line')
get_transaction().commit()
transaction.commit()
self.tic()
document.Base_makeTemplateFromDocument(form_id=None)
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEqual(len(preference.objectIds()), 1)
......@@ -90,7 +91,7 @@ class TestTemplate(ERP5TypeTestCase):
self.portal.foo_module.manage_delObjects(ids=[document.getId()])
get_transaction().commit()
transaction.commit()
self.tic()
template = preference.objectValues()[0]
......@@ -101,7 +102,7 @@ class TestTemplate(ERP5TypeTestCase):
new_document = self.portal.foo_module[new_document_id]
new_document.makeTemplateInstance()
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEqual(new_document.getTitle(), 'My Foo 1')
......@@ -116,11 +117,11 @@ class TestTemplate(ERP5TypeTestCase):
preference_id_list = list(self.portal.portal_preferences.objectIds())
document = self.portal.foo_module.newContent(portal_type='Foo')
get_transaction().commit()
transaction.commit()
self.tic()
document.Base_makeTemplateFromDocument(form_id=None)
get_transaction().commit()
transaction.commit()
self.tic()
# a new preference is created
......@@ -145,18 +146,18 @@ class TestTemplate(ERP5TypeTestCase):
preference.priority = Priority.USER
preference.enable()
get_transaction().commit()
transaction.commit()
self.tic()
document = self.portal.foo_module.newContent(portal_type='Foo')
document.edit(title='My Foo 1')
document.newContent(portal_type='Foo Line')
get_transaction().commit()
transaction.commit()
self.tic()
document.Base_makeTemplateFromDocument(form_id=None)
get_transaction().commit()
transaction.commit()
self.tic()
self.assertTrue(document.isIndexable)
self.assertEqual(len(preference.objectIds()), 1)
......@@ -166,7 +167,7 @@ class TestTemplate(ERP5TypeTestCase):
# and this is still true if you create two templates from the same document
# #929
document.Base_makeTemplateFromDocument(form_id=None)
get_transaction().commit()
transaction.commit()
self.tic()
self.assertTrue(document.isIndexable)
......
......@@ -33,11 +33,6 @@ from DateTime import DateTime
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
try:
from transaction import get as get_transaction
except ImportError:
pass
class TradeConditionTestCase(ERP5TypeTestCase):
"""Tests for Trade Conditions and Tax
"""
......@@ -82,7 +77,7 @@ class TradeConditionTestCase(ERP5TypeTestCase):
title='Order')
def beforeTearDown(self):
get_transaction().abort()
transaction.abort()
for module in (self.portal.tax_module,
self.portal.organisation_module,
self.portal.currency_module,
......@@ -96,7 +91,7 @@ class TradeConditionTestCase(ERP5TypeTestCase):
self.portal.portal_categories.size,
):
module.manage_delObjects(list(module.objectIds()))
get_transaction().commit()
transaction.commit()
self.tic()
......@@ -154,7 +149,7 @@ class AccountingBuildTestCase(TradeConditionTestCase):
title='Resource Tax',
int_index=2,
test_method_id='SimulationMovement_isTaxMovement' )
get_transaction().commit()
transaction.commit()
self.tic()
accounting_rule_cell_list = itr.contentValues(
portal_type='Accounting Rule Cell')
......@@ -185,13 +180,13 @@ class AccountingBuildTestCase(TradeConditionTestCase):
destination_value=self.refundable_tax_account,
quantity=1)
itr.validate()
get_transaction().commit()
transaction.commit()
self.tic()
def beforeTearDown(self):
TradeConditionTestCase.beforeTearDown(self)
self.portal.portal_rules.manage_delObjects('test_invoice_transaction_rule')
get_transaction().commit()
transaction.commit()
self.tic()
class TestApplyTradeCondition(TradeConditionTestCase):
......@@ -1121,7 +1116,7 @@ class TestTaxLineOrderSimulation(AccountingBuildTestCase):
order.plan()
order.confirm()
self.assertEquals('confirmed', order.getSimulationState())
get_transaction().commit()
transaction.commit()
self.tic()
related_applied_rule_list = order.getCausalityRelatedValueList(
portal_type='Applied Rule')
......@@ -1206,7 +1201,7 @@ class TestTaxLineOrderSimulation(AccountingBuildTestCase):
order.plan()
order.confirm()
self.assertEquals('confirmed', order.getSimulationState())
get_transaction().commit()
transaction.commit()
self.tic()
related_applied_rule_list = order.getCausalityRelatedValueList(
portal_type='Applied Rule')
......@@ -1280,7 +1275,7 @@ class TestTaxLineOrderSimulation(AccountingBuildTestCase):
order.plan()
order.confirm()
self.assertEquals('confirmed', order.getSimulationState())
get_transaction().commit()
transaction.commit()
self.tic()
related_delivery = order.getCausalityRelatedValue(
portal_type=('Purchase Packing List', 'Sale Packing List'))
......@@ -1290,7 +1285,7 @@ class TestTaxLineOrderSimulation(AccountingBuildTestCase):
related_delivery.stop()
related_delivery.deliver()
self.assertEquals('delivered', related_delivery.getSimulationState())
get_transaction().commit()
transaction.commit()
self.tic()
related_invoice = related_delivery.getCausalityRelatedValue(
......@@ -1351,7 +1346,7 @@ class TestTaxLineOrderSimulation(AccountingBuildTestCase):
order.plan()
order.confirm()
self.assertEquals('confirmed', order.getSimulationState())
get_transaction().commit()
transaction.commit()
self.tic()
related_delivery = order.getCausalityRelatedValue(
portal_type=('Purchase Packing List', 'Sale Packing List'))
......@@ -1361,7 +1356,7 @@ class TestTaxLineOrderSimulation(AccountingBuildTestCase):
related_delivery.stop()
related_delivery.deliver()
self.assertEquals('delivered', related_delivery.getSimulationState())
get_transaction().commit()
transaction.commit()
self.tic()
related_invoice = related_delivery.getCausalityRelatedValue(
......@@ -1375,7 +1370,7 @@ class TestTaxLineOrderSimulation(AccountingBuildTestCase):
self.assertEquals(0, len(accounting_line_list))
related_invoice.start()
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEquals('started', related_invoice.getSimulationState())
self.assertEquals('solved', related_invoice.getCausalityState())
......@@ -1457,7 +1452,7 @@ class TestTaxLineOrderSimulation(AccountingBuildTestCase):
order.plan()
order.confirm()
self.assertEquals('confirmed', order.getSimulationState())
get_transaction().commit()
transaction.commit()
self.tic()
related_delivery = order.getCausalityRelatedValue(
portal_type=('Purchase Packing List', 'Sale Packing List'))
......@@ -1467,7 +1462,7 @@ class TestTaxLineOrderSimulation(AccountingBuildTestCase):
related_delivery.stop()
related_delivery.deliver()
self.assertEquals('delivered', related_delivery.getSimulationState())
get_transaction().commit()
transaction.commit()
self.tic()
related_invoice = related_delivery.getCausalityRelatedValue(
......@@ -1519,7 +1514,7 @@ class TestTaxLineOrderSimulation(AccountingBuildTestCase):
order.plan()
order.confirm()
self.assertEquals('confirmed', order.getSimulationState())
get_transaction().commit()
transaction.commit()
self.tic()
related_delivery = order.getCausalityRelatedValue(
portal_type=('Purchase Packing List', 'Sale Packing List'))
......@@ -1529,7 +1524,7 @@ class TestTaxLineOrderSimulation(AccountingBuildTestCase):
related_delivery.stop()
related_delivery.deliver()
self.assertEquals('delivered', related_delivery.getSimulationState())
get_transaction().commit()
transaction.commit()
self.tic()
related_invoice = related_delivery.getCausalityRelatedValue(
......@@ -1554,7 +1549,7 @@ class TestTaxLineOrderSimulation(AccountingBuildTestCase):
invoice_line = invoice_line_list[0]
# change a total price on the invoice_line,
invoice_line.setQuantity(3)
get_transaction().commit()
transaction.commit()
self.tic()
# it will be reflected on the tax line
self.assertEquals(45, tax_line.getQuantity())
......@@ -1599,7 +1594,7 @@ class TestTaxLineInvoiceSimulation(AccountingBuildTestCase):
invoice.confirm()
invoice.start()
self.assertEquals('started', invoice.getSimulationState())
get_transaction().commit()
transaction.commit()
self.tic()
related_applied_rule_list = invoice.getCausalityRelatedValueList(
portal_type='Applied Rule')
......@@ -1633,7 +1628,7 @@ class TestTaxLineInvoiceSimulation(AccountingBuildTestCase):
invoice_simulation_movement.getResourceValue())
invoice.start()
self.assertEquals('started', invoice.getSimulationState())
get_transaction().commit()
transaction.commit()
self.tic()
accounting_line_list = invoice.getMovementList(
portal_type=('Sale Invoice Transaction Line',
......@@ -1705,7 +1700,7 @@ class TestTradeConditionSupplyLine(TradeConditionTestCase):
base_price=123)
self.order.setSpecialiseValue(self.trade_condition)
get_transaction().commit()
transaction.commit()
self.tic()
line = self.order.newContent(portal_type=self.order_line_type,
......@@ -1731,7 +1726,7 @@ class TestTradeConditionSupplyLine(TradeConditionTestCase):
self.order.setSpecialiseValue(self.trade_condition)
self.order.setSourceSectionValue(self.vendor)
self.order.setDestinationSectionValue(self.vendor)
get_transaction().commit()
transaction.commit()
self.tic()
line = self.order.newContent(portal_type=self.order_line_type,
......@@ -1765,7 +1760,7 @@ class TestTradeConditionSupplyLine(TradeConditionTestCase):
self.order.setSourceSectionValue(self.vendor)
self.order.setDestinationSectionValue(self.client)
get_transaction().commit()
transaction.commit()
self.tic()
line = self.order.newContent(portal_type=self.order_line_type,
......
......@@ -29,6 +29,7 @@
"""Tests Standards ERP5 Trade Reports
"""
import unittest
import transaction
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5ReportTestCase
from Products.ERP5Type.tests.utils import reindex
from AccessControl.SecurityManagement import newSecurityManager
......@@ -158,14 +159,14 @@ class TestTradeReports(ERP5ReportTestCase):
)
# and all this available to catalog
get_transaction().commit()
transaction.commit()
self.tic()
self.loginAsUser()
def beforeTearDown(self):
"""Remove all documents.
"""
get_transaction().abort()
transaction.abort()
self.organisation_module.manage_delObjects(
list(self.organisation_module.objectIds()))
......@@ -180,7 +181,7 @@ class TestTradeReports(ERP5ReportTestCase):
self.sale_order_module.manage_delObjects(
list(self.sale_order_module.objectIds()))
get_transaction().commit()
transaction.commit()
self.tic()
@reindex
......@@ -273,7 +274,7 @@ class TestTradeReports(ERP5ReportTestCase):
cancel=True
)
get_transaction().commit()
transaction.commit()
self.tic()
......@@ -688,7 +689,7 @@ class TestTradeReports(ERP5ReportTestCase):
quantity=11,
)
get_transaction().commit()
transaction.commit()
self.tic()
request = self.portal.REQUEST
......@@ -847,7 +848,7 @@ class TestTradeReports(ERP5ReportTestCase):
quantity=11,
)
get_transaction().commit()
transaction.commit()
self.tic()
request = self.portal.REQUEST
......
......@@ -33,6 +33,7 @@
from random import randint
import transaction
import os, sys
if __name__ == '__main__':
execfile(os.path.join(sys.path[0], 'framework.py'))
......@@ -111,7 +112,7 @@ class TestTransformation(TestOrderMixin, ERP5TypeTestCase):
variations = [variation1, variation2]
# Commit and catalog
get_transaction().commit()
transaction.commit()
self.tic()
component.setVariationBaseCategoryList(['variation'])
......
......@@ -29,6 +29,7 @@
import unittest
import transaction
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from AccessControl.SecurityManagement import newSecurityManager
from Products.ERP5Type.tests.Sequence import SequenceList
......@@ -111,7 +112,7 @@ class TestWorklist(ERP5TypeTestCase):
)
assignment.open()
# Reindexing is required for the security to work
get_transaction().commit()
transaction.commit()
self.tic()
def createUsers(self):
......@@ -215,7 +216,7 @@ class TestWorklist(ERP5TypeTestCase):
self.logMessage("Create document as Manager")
document = self.createDocument()
get_transaction().commit()
transaction.commit()
self.tic()
self.clearCache()
......@@ -242,7 +243,7 @@ class TestWorklist(ERP5TypeTestCase):
self.logMessage("Give %s %s role" % (user_id, role))
document.manage_addLocalRoles(user_id, [role])
document.reindexObject()
get_transaction().commit()
transaction.commit()
self.tic()
self.clearCache()
......@@ -269,7 +270,7 @@ class TestWorklist(ERP5TypeTestCase):
# Change int value on document
new_value = self.int_value + 1
document.setProperty(self.int_catalogued_variable_id, new_value)
get_transaction().commit()
transaction.commit()
self.tic()
self.clearCache()
......@@ -306,7 +307,7 @@ class TestWorklist(ERP5TypeTestCase):
for i, count in enumerate(count_list):
document.manage_permission('View', local_role_list[:i], 0)
document.reindexObject()
get_transaction().commit()
transaction.commit()
self.tic()
self.clearCache()
......@@ -321,7 +322,7 @@ class TestWorklist(ERP5TypeTestCase):
current_sql_catalog_local_role_keys = \
sql_catalog.sql_catalog_local_role_keys
sql_catalog.sql_catalog_local_role_keys = ('Owner | owner', )
get_transaction().commit()
transaction.commit()
self.portal.portal_caches.clearAllCache()
try:
......@@ -329,7 +330,7 @@ class TestWorklist(ERP5TypeTestCase):
finally:
sql_catalog.sql_catalog_local_role_keys = \
current_sql_catalog_local_role_keys
get_transaction().commit()
transaction.commit()
def test_02_related_key(self, quiet=0, run=run_all_test):
"""
......@@ -360,7 +361,7 @@ class TestWorklist(ERP5TypeTestCase):
base_category_id='role')
document = self.createDocument()
get_transaction().commit()
transaction.commit()
self.tic()
self.clearCache()
self.logMessage(" Check no document has region/role categories defined")
......@@ -373,7 +374,7 @@ class TestWorklist(ERP5TypeTestCase):
self.createDocument(region='somewhere')
self.createDocument(region='elsewhere')
get_transaction().commit()
transaction.commit()
self.tic()
self.clearCache()
self.logMessage(
......
......@@ -40,11 +40,6 @@ from xml.dom import minidom
from glob import glob
try:
from transaction import get as get_transaction
except ImportError:
pass
#
# Test Setting
#
......
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