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

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
......
......@@ -33,6 +33,7 @@
import unittest
import os
import transaction
from DateTime import DateTime
from Products.CMFCore.utils import _checkPermission
......@@ -191,7 +192,7 @@ class AccountingTestCase(ERP5TypeTestCase):
self.validateRules()
# and all this available to catalog
get_transaction().commit()
transaction.commit()
self.tic()
......@@ -200,7 +201,7 @@ class AccountingTestCase(ERP5TypeTestCase):
"""
if os.environ.get('erp5_save_data_fs'):
return
get_transaction().abort()
transaction.abort()
self.accounting_module.manage_delObjects(
list(self.accounting_module.objectIds()))
organisation_list = ('my_organisation', 'client_1', 'client_2', 'supplier')
......@@ -224,7 +225,7 @@ class AccountingTestCase(ERP5TypeTestCase):
and x.getPriority() != Priority.SITE])
self.portal.portal_simulation.manage_delObjects(list(
self.portal.portal_simulation.objectIds()))
get_transaction().commit()
transaction.commit()
self.tic()
ERP5TypeTestCase.tearDown(self)
......@@ -299,7 +300,7 @@ class TestTransactionValidation(AccountingTestCase):
start_date=DateTime('2007/01/01'),
stop_date=DateTime('2007/12/31'))
accounting_period_2007.start()
get_transaction().commit()
transaction.commit()
self.tic()
def test_SaleInvoiceTransactionValidationDate(self):
......@@ -806,12 +807,12 @@ class TestClosingPeriod(AccountingTestCase):
"""Various tests for closing the period.
"""
def beforeTearDown(self):
get_transaction().abort()
transaction.abort()
# we manually remove the content of stock table, because unindexObject
# might not work correctly on Balance Transaction, and we don't want
# leave something in stock table that will change the next test.
self.portal.erp5_sql_connection.manage_test('truncate stock')
get_transaction().commit()
transaction.commit()
def test_createBalanceOnNode(self):
period = self.section.newContent(portal_type='Accounting Period')
......@@ -995,7 +996,7 @@ class TestClosingPeriod(AccountingTestCase):
self.assertEquals(None, pl_movement.getDestinationTotalAssetPrice())
self.assertEquals(None, pl_movement.getSourceTotalAssetPrice())
self.assertEquals(300., pl_movement.getDestinationDebit())
get_transaction().commit()
transaction.commit()
self.tic()
def test_createBalanceOnPayment(self):
......@@ -1242,7 +1243,7 @@ class TestClosingPeriod(AccountingTestCase):
pl_movement.getDestinationDebit(),
accounting_currency_precision)
get_transaction().commit()
transaction.commit()
self.tic()
# now check content of stock table
......@@ -1312,7 +1313,7 @@ class TestClosingPeriod(AccountingTestCase):
dict(source_value=self.account_module.receivable,
source_asset_credit=2.2,
source_credit=200)))
get_transaction().commit()
transaction.commit()
self.tic()
period.AccountingPeriod_createBalanceTransaction(
......@@ -1374,7 +1375,7 @@ class TestClosingPeriod(AccountingTestCase):
self.assertEquals(None, dollar_movement.getSourceTotalAssetPrice())
self.assertEquals(200, dollar_movement.getDestinationCredit())
get_transaction().commit()
transaction.commit()
self.tic()
# now check content of stock table
......@@ -1450,7 +1451,7 @@ class TestClosingPeriod(AccountingTestCase):
period, 'deliver_action',
profit_and_loss_account=pl_account.getRelativeUrl())
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEquals('delivered', period.getSimulationState())
......@@ -1694,7 +1695,7 @@ class TestClosingPeriod(AccountingTestCase):
destination_value=self.account_module.stocks,
destination_credit=90,)
balance.stop()
get_transaction().commit()
transaction.commit()
self.tic()
stool = self.portal.portal_simulation
......@@ -1733,7 +1734,7 @@ class TestClosingPeriod(AccountingTestCase):
destination_debit=30,)
balance.stop()
get_transaction().commit()
transaction.commit()
self.tic()
stool = self.portal.portal_simulation
......@@ -1770,7 +1771,7 @@ class TestClosingPeriod(AccountingTestCase):
destination_value=self.account_module.payable,
destination_credit=100,)
balance.stop()
get_transaction().commit()
transaction.commit()
self.tic()
stool = self.portal.portal_simulation
......@@ -1827,7 +1828,7 @@ class TestClosingPeriod(AccountingTestCase):
destination_credit=100,)
balance.stop()
balance.deliver()
get_transaction().commit()
transaction.commit()
self.tic()
stool = self.portal.portal_simulation
......@@ -1852,11 +1853,11 @@ class TestClosingPeriod(AccountingTestCase):
source_debit=50),
dict(source_value=self.account_module.receivable,
source_credit=50)))
get_transaction().commit()
transaction.commit()
self.tic()
# let's try to reindex and check if values are still OK
balance.reindexObject()
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEquals(-150, stool.getInventory(
......@@ -1880,7 +1881,7 @@ class TestClosingPeriod(AccountingTestCase):
destination_value=self.account_module.receivable,
destination_debit=100,)
balance.stop()
get_transaction().commit()
transaction.commit()
self.tic()
stool = self.portal.portal_simulation
......@@ -1918,7 +1919,7 @@ class TestClosingPeriod(AccountingTestCase):
destination_value=self.account_module.receivable,
destination_debit=100,)
balance.stop()
get_transaction().commit()
transaction.commit()
self.tic()
stool = self.portal.portal_simulation
......@@ -2179,7 +2180,7 @@ class TestTransactions(AccountingTestCase):
self.portal.portal_workflow.doActionFor(accounting_transaction,
'stop_action')
self.assertEquals('stopped', accounting_transaction.getSimulationState())
get_transaction().commit()
transaction.commit()
self.tic()
payment = invoice.Invoice_createRelatedPaymentTransaction(
......@@ -2210,7 +2211,7 @@ class TestTransactions(AccountingTestCase):
self.portal.portal_workflow.doActionFor(accounting_transaction,
'stop_action')
self.assertEquals('stopped', accounting_transaction.getSimulationState())
get_transaction().commit()
transaction.commit()
self.tic()
payment = invoice.Invoice_createRelatedPaymentTransaction(
......@@ -2247,7 +2248,7 @@ class TestTransactions(AccountingTestCase):
source_debit=20),))
other_accounting_transaction.cancel()
get_transaction().commit()
transaction.commit()
self.tic()
payment = invoice.Invoice_createRelatedPaymentTransaction(
......@@ -2383,7 +2384,7 @@ class TestTransactions(AccountingTestCase):
# when restarting, grouping is removed
invoice.restart()
get_transaction().commit()
transaction.commit()
self.tic()
self.failIf(invoice_line.getGroupingReference())
self.failIf(payment_line.getGroupingReference())
......@@ -2490,7 +2491,7 @@ class TestTransactions(AccountingTestCase):
self.failUnless(payment_line.getGroupingReference())
invoice.cancel()
get_transaction().commit()
transaction.commit()
self.tic()
self.failIf(invoice_line.getGroupingReference())
self.failIf(payment_line.getGroupingReference())
......@@ -2662,10 +2663,10 @@ class TestAccountingWithSequences(AccountingTestCase):
"""Cleanup for next test.
All tests uses the same accounts and same entities, so we just cleanup
accounting module and simulation. """
get_transaction().abort()
transaction.abort()
for folder in (self.accounting_module, self.portal.portal_simulation):
folder.manage_delObjects([i for i in folder.objectIds()])
get_transaction().commit()
transaction.commit()
self.tic()
def login(self) :
......@@ -2727,7 +2728,7 @@ class TestAccountingWithSequences(AccountingTestCase):
for entity in (self.client, self.vendor, self.other_vendor):
entity.setRegion(self.default_region)
self.getWorkflowTool().doActionFor(entity, 'validate_action')
get_transaction().commit()
transaction.commit()
self.tic()
def stepCreateEntities(self, sequence, **kw) :
......@@ -2816,7 +2817,7 @@ class TestAccountingWithSequences(AccountingTestCase):
self.YEN = currency_module.newContent(
portal_type = self.currency_portal_type,
reference = "YEN", id = "YEN" )
get_transaction().commit()
transaction.commit()
self.tic()
else:
self.EUR = currency_module.EUR
......@@ -2883,7 +2884,7 @@ class TestAccountingWithSequences(AccountingTestCase):
account.validate()
self.failUnless('Site Error' not in account.view())
self.assertEquals(account.getValidationState(), 'validated')
get_transaction().commit()
transaction.commit()
self.tic()
def stepCreateAccounts(self, sequence, **kw) :
......@@ -3241,7 +3242,7 @@ class TestAccountingWithSequences(AccountingTestCase):
self.failUnless(receivable.getSource() != None)
self.failUnless(receivable.getDestination() != None)
if reindex:
get_transaction().commit()
transaction.commit()
self.tic()
if check_consistency:
self.failUnless(len(transaction.checkConsistency()) == 0,
......@@ -3791,7 +3792,7 @@ class TestAccountingTransactionTemplate(AccountingTestCase):
preference.priority = Priority.USER
preference.enable()
get_transaction().commit()
transaction.commit()
self.tic()
document = self.accounting_module.newContent(
......@@ -3799,7 +3800,7 @@ class TestAccountingTransactionTemplate(AccountingTestCase):
document.edit(title='My Accounting Transaction')
document.Base_makeTemplateFromDocument(form_id=None)
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEqual(len(preference.objectIds()), 1)
......@@ -3810,7 +3811,7 @@ class TestAccountingTransactionTemplate(AccountingTestCase):
self.accounting_module.manage_delObjects(ids=[document.getId()])
get_transaction().commit()
transaction.commit()
self.tic()
template = preference.objectValues()[0]
......@@ -3822,7 +3823,7 @@ class TestAccountingTransactionTemplate(AccountingTestCase):
new_document = self.accounting_module[new_document_id]
new_document.makeTemplateInstance()
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEqual(new_document.getTitle(), 'My Accounting Transaction')
......@@ -3836,7 +3837,7 @@ class TestAccountingTransactionTemplate(AccountingTestCase):
preference.priority = Priority.USER
preference.enable()
get_transaction().commit()
transaction.commit()
self.tic()
document = self.accounting_module.newContent(
......
......@@ -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):
......
......@@ -30,6 +30,8 @@ import os
import email
import email.Header
import transaction
from Products.CMFCore.WorkflowCore import WorkflowException
from Products.ERP5Type.tests.utils import DummyMailHost
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
......@@ -65,7 +67,7 @@ class TestCRM(ERP5TypeTestCase):
self.assertEqual(len(event.getCausalityRelatedValueList()), 0)
get_transaction().commit()
transaction.commit()
self.tic()
portal_workflow.doActionFor(event, 'create_related_event_action',
......@@ -73,7 +75,7 @@ class TestCRM(ERP5TypeTestCase):
related_event_title='New Title',
related_event_description='New Desc')
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEqual(len(event.getCausalityRelatedValueList()), 1)
......@@ -145,7 +147,7 @@ class TestCRM(ERP5TypeTestCase):
'person_module_selection', [])
self.portal.portal_selections.setSelectionParamsFor(
'person_module_selection', dict(title='Pers1'))
get_transaction().commit()
transaction.commit()
self.tic()
person_module.PersonModule_newEvent(portal_type='Mail Message',
title='The Event Title',
......@@ -156,7 +158,7 @@ class TestCRM(ERP5TypeTestCase):
text_content='Event Content',
form_id='PersonModule_viewPersonList')
get_transaction().commit()
transaction.commit()
self.tic()
related_event = pers1.getDestinationRelatedValue(
......@@ -180,7 +182,7 @@ class TestCRM(ERP5TypeTestCase):
self.portal.portal_selections.setSelectionCheckedUidsFor(
'person_module_selection',
[pers1.getUid(), pers2.getUid()])
get_transaction().commit()
transaction.commit()
self.tic()
person_module.PersonModule_newEvent(portal_type='Mail Message',
title='The Event Title',
......@@ -191,7 +193,7 @@ class TestCRM(ERP5TypeTestCase):
text_content='Event Content',
form_id='PersonModule_viewPersonList')
get_transaction().commit()
transaction.commit()
self.tic()
for person in (pers1, pers2):
......@@ -262,12 +264,12 @@ class TestCRM(ERP5TypeTestCase):
ticket_url = ticket.getRelativeUrl()
event = self.portal.event_module.newContent(portal_type=portal_type,
follow_up=ticket_url)
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEqual(len(event.getCausalityRelatedValueList()), 0)
event.receive()
portal_workflow.doActionFor(event, 'acknowledge_action', create_event=0)
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEqual(len(event.getCausalityRelatedValueList()), 0)
......@@ -278,12 +280,12 @@ class TestCRM(ERP5TypeTestCase):
ticket_url = ticket.getRelativeUrl()
event = self.portal.event_module.newContent(portal_type=portal_type,
follow_up=ticket_url)
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEqual(len(event.getCausalityRelatedValueList()), 0)
event.receive()
portal_workflow.doActionFor(event, 'acknowledge_action', create_event=1)
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEqual(len(event.getCausalityRelatedValueList()), 1)
new_event = event.getCausalityRelatedValue()
......@@ -300,14 +302,14 @@ class TestCRM(ERP5TypeTestCase):
title='Event Title',
text_content='Event Content',
text_format='text/plain')
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEqual(len(event.getCausalityRelatedValueList()), 0)
event.receive()
portal_workflow.doActionFor(event, 'acknowledge_action',
create_event=1,
quote_original_message=1)
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEqual(len(event.getCausalityRelatedValueList()), 1)
new_event = event.getCausalityRelatedValue()
......@@ -360,16 +362,16 @@ class TestCRMMailIngestion(ERP5TypeTestCase):
default_email_text='he@erp5.org')
# make sure customers are available to catalog
get_transaction().commit()
transaction.commit()
self.tic()
def beforeTearDown(self):
get_transaction().abort()
transaction.abort()
# clear modules if necessary
for module in (self.portal.event_module,
self.portal.campaign_module):
module.manage_delObjects(list(module.objectIds()))
get_transaction().commit()
transaction.commit()
self.tic()
def _readTestData(self, filename):
......@@ -417,14 +419,14 @@ class TestCRMMailIngestion(ERP5TypeTestCase):
# source is found automatically, based on the From: header in the mail
event = self._ingestMail('simple')
# metadata discovery is done in an activity
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEquals('person_module/sender', event.getSource())
def test_recipient(self):
# destination is found automatically, based on the To: header in the mail
event = self._ingestMail('simple')
get_transaction().commit()
transaction.commit()
self.tic()
destination_list = event.getDestinationList()
destination_list.sort()
......@@ -437,10 +439,10 @@ class TestCRMMailIngestion(ERP5TypeTestCase):
# But, we don't want it to associate with the first campaign simply
# because we searched against nothing
self.portal.campaign_module.newContent(portal_type='Campaign')
get_transaction().commit()
transaction.commit()
self.tic()
event = self._ingestMail('simple')
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEquals(None, event.getFollowUp())
......@@ -515,7 +517,7 @@ class TestCRMMailIngestion(ERP5TypeTestCase):
"""
document = self._ingestMail(filename='forwarded')
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEqual(document.getContentInformation().get('From'), 'Me <me@erp5.org>')
......@@ -531,7 +533,7 @@ class TestCRMMailIngestion(ERP5TypeTestCase):
"""
document = self._ingestMail(filename='forwarded_attached')
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEqual(document.getContentInformation().get('From'), 'Me <me@erp5.org>')
......@@ -542,7 +544,7 @@ class TestCRMMailIngestion(ERP5TypeTestCase):
def test_encoding(self):
document = self._ingestMail(filename='encoded')
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEqual(document.getContentInformation().get('To'),
......@@ -615,16 +617,16 @@ class TestCRMMailSend(ERP5TypeTestCase):
self.portal._setObject('MailHost', DummyMailHost('MailHost'))
# make sure customers are available to catalog
get_transaction().commit()
transaction.commit()
self.tic()
def beforeTearDown(self):
get_transaction().abort()
transaction.abort()
# clear modules if necessary
for module in (self.portal.event_module,
self.portal.campaign_module,):
module.manage_delObjects(list(module.objectIds()))
get_transaction().commit()
transaction.commit()
self.tic()
def test_MailFromMailMessageEvent(self):
......@@ -637,7 +639,7 @@ class TestCRMMailSend(ERP5TypeTestCase):
event.setTextContent('Mail Content')
self.portal.portal_workflow.doActionFor(event, 'start_action',
send_mail=1)
get_transaction().commit()
transaction.commit()
self.tic()
last_message = self.portal.MailHost._last_message
self.assertNotEquals((), last_message)
......@@ -666,7 +668,7 @@ class TestCRMMailSend(ERP5TypeTestCase):
event.setTextContent('Mail Content')
self.portal.portal_workflow.doActionFor(event, 'start_action',
send_mail=1)
get_transaction().commit()
transaction.commit()
self.tic()
last_message_1, last_message_2 = self.portal.MailHost._message_list[-2:]
self.assertNotEquals((), last_message_1)
......@@ -691,7 +693,7 @@ class TestCRMMailSend(ERP5TypeTestCase):
event.setTextContent('Mail Content')
self.portal.portal_workflow.doActionFor(event, 'start_action',
send_mail=1)
get_transaction().commit()
transaction.commit()
self.tic()
# no mail sent
last_message = self.portal.MailHost._last_message
......@@ -708,7 +710,7 @@ class TestCRMMailSend(ERP5TypeTestCase):
self.portal.portal_workflow.doActionFor(event, 'start_action',
send_mail=1)
get_transaction().commit()
transaction.commit()
self.tic()
# this means no message have been set
self.assertEquals((), self.portal.MailHost._last_message)
......@@ -724,7 +726,7 @@ class TestCRMMailSend(ERP5TypeTestCase):
self.portal.portal_workflow.doActionFor(event, 'receive_action')
self.portal.portal_workflow.doActionFor(event, 'mark_started_action')
get_transaction().commit()
transaction.commit()
self.tic()
# this means no message have been set
self.assertEquals((), self.portal.MailHost._last_message)
......@@ -740,7 +742,7 @@ class TestCRMMailSend(ERP5TypeTestCase):
event.setTextContent('Hello<br/>World')
self.portal.portal_workflow.doActionFor(event, 'start_action',
send_mail=1)
get_transaction().commit()
transaction.commit()
self.tic()
last_message = self.portal.MailHost._last_message
self.assertNotEquals((), last_message)
......@@ -765,7 +767,7 @@ class TestCRMMailSend(ERP5TypeTestCase):
event.setTextContent('Hàhà')
self.portal.portal_workflow.doActionFor(event, 'start_action',
send_mail=1)
get_transaction().commit()
transaction.commit()
self.tic()
last_message = self.portal.MailHost._last_message
self.assertNotEquals((), last_message)
......@@ -799,7 +801,7 @@ class TestCRMMailSend(ERP5TypeTestCase):
document_pdf = add_document('sample_attachment.pdf', '1',
self.portal.document_module, 'PDF')
get_transaction().commit()
transaction.commit()
self.tic()
# Add a ticket
......@@ -855,7 +857,7 @@ class TestCRMMailSend(ERP5TypeTestCase):
document_odt = add_document('sample_attachment.odt', '2',
self.portal.document_module, 'Text')
get_transaction().commit()
transaction.commit()
self.tic()
# Add a ticket
......@@ -911,7 +913,7 @@ class TestCRMMailSend(ERP5TypeTestCase):
document_zip = add_document('sample_attachment.zip', '3',
self.portal.document_module, 'File')
get_transaction().commit()
transaction.commit()
self.tic()
# Add a ticket
......@@ -967,7 +969,7 @@ class TestCRMMailSend(ERP5TypeTestCase):
document_gif = add_document('sample_attachment.gif', '4',
self.portal.image_module, 'Image')
get_transaction().commit()
transaction.commit()
self.tic()
# Add a ticket
......@@ -1018,7 +1020,7 @@ class TestCRMMailSend(ERP5TypeTestCase):
document_html.edit(text_content='<html><body>Hello world!</body></html>',
reference='sample_attachment.html')
get_transaction().commit()
transaction.commit()
self.tic()
# Add a ticket
......@@ -1119,7 +1121,7 @@ class TestCRMMailSend(ERP5TypeTestCase):
document_txt = add_document('sample_attachment.txt', '2',
self.portal.person_module['me'], 'File')
get_transaction().commit()
transaction.commit()
self.tic()
# Add a ticket
......@@ -1177,7 +1179,7 @@ class TestCRMMailSend(ERP5TypeTestCase):
document_gif = add_document('sample_attachment.gif', '1',
self.portal.person_module['me'], 'Image')
get_transaction().commit()
transaction.commit()
self.tic()
# Add a ticket
......
......@@ -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):
......
......@@ -25,8 +25,11 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
import unittest
import os
import transaction
from DateTime import DateTime
from zLOG import LOG
from Products.CMFCore.utils import _checkPermission
......@@ -144,7 +147,7 @@ class TestConversionInSimulation(AccountingTestCase,ERP5TypeTestCase):
self.login()
def beforeTearDown(self):
get_transaction().abort()
transaction.abort()
# clear modules if necessary
currency_list = ('euro', 'yen', 'usd')
module = self.portal.currency_module
......@@ -156,7 +159,7 @@ class TestConversionInSimulation(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):
......@@ -203,7 +206,7 @@ class TestConversionInSimulation(AccountingTestCase,ERP5TypeTestCase):
invoice_rule = portal.portal_rules.default_invoice_transaction_rule
invoice_rule.deleteContent([x.getId()
for x in invoice_rule.objectValues()])
get_transaction().commit()
transaction.commit()
self.tic()
region_predicate = invoice_rule.newContent(portal_type = 'Predicate')
product_line_predicate = invoice_rule.newContent(portal_type = 'Predicate')
......@@ -238,7 +241,7 @@ class TestConversionInSimulation(AccountingTestCase,ERP5TypeTestCase):
destination_value=account_module[line_destination_id])
invoice_rule.validate()
get_transaction().commit()
transaction.commit()
self.tic()
def test_01_simulation_movement_destination_asset_price(self,quiet=0,
......@@ -264,7 +267,7 @@ class TestConversionInSimulation(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
x_curr_ex_line = currency.newContent(
portal_type='Currency Exchange Line',
......@@ -275,7 +278,7 @@ class TestConversionInSimulation(AccountingTestCase,ERP5TypeTestCase):
x_curr_ex_line.setStopDate(DateTime(2008,10,22))
x_curr_ex_line.validate()
self.createInvoiceTransactionRule(currency)
get_transaction().commit()
transaction.commit()
self.tic()#execute transactio
client = self.portal.organisation_module.newContent(
portal_type='Organisation',
......@@ -301,7 +304,7 @@ class TestConversionInSimulation(AccountingTestCase,ERP5TypeTestCase):
price=2)
order.confirm()
get_transaction().commit()
transaction.commit()
self.tic()
related_applied_rule = order.getCausalityRelatedValue(
......@@ -356,7 +359,7 @@ class TestConversionInSimulation(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
x_curr_ex_line = currency.newContent(
portal_type='Currency Exchange Line',
......@@ -367,7 +370,7 @@ class TestConversionInSimulation(AccountingTestCase,ERP5TypeTestCase):
x_curr_ex_line.setStopDate(DateTime(2008,10,22))
x_curr_ex_line.validate()
self.createInvoiceTransactionRule(currency)
get_transaction().commit()
transaction.commit()
self.tic()#execute transactio
client = self.portal.organisation_module.newContent(
portal_type='Organisation',
......@@ -393,7 +396,7 @@ class TestConversionInSimulation(AccountingTestCase,ERP5TypeTestCase):
price=2)
order.confirm()
get_transaction().commit()
transaction.commit()
self.tic()
related_applied_rule = order.getCausalityRelatedValue(
......@@ -441,7 +444,7 @@ class TestConversionInSimulation(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
x_curr_ex_line = currency.newContent(
portal_type='Currency Exchange Line',
......@@ -452,7 +455,7 @@ class TestConversionInSimulation(AccountingTestCase,ERP5TypeTestCase):
x_curr_ex_line.setStopDate(DateTime(2008,10,22))
x_curr_ex_line.validate()
self.createInvoiceTransactionRule(currency)
get_transaction().commit()
transaction.commit()
self.tic()#execute transaction
client = self.portal.organisation_module.newContent(
portal_type='Organisation',
......@@ -477,14 +480,14 @@ class TestConversionInSimulation(AccountingTestCase,ERP5TypeTestCase):
quantity=1,
price=2)
order.confirm()
get_transaction().commit()
transaction.commit()
self.tic()
related_packing_list = order.getCausalityRelatedValue(
portal_type='Sale Packing List')
self.assertNotEquals(related_packing_list, None)
related_packing_list.start()
related_packing_list.stop()
get_transaction().commit()
transaction.commit()
self.tic()
related_applied_rule = order.getCausalityRelatedValue(
portal_type='Applied Rule')
......@@ -493,7 +496,7 @@ class TestConversionInSimulation(AccountingTestCase,ERP5TypeTestCase):
portal_type='Sale Invoice Transaction')
self.assertNotEquals(related_invoice, None)
related_invoice.start()
get_transaction().commit()
transaction.commit()
self.tic()
line_list= related_invoice.contentValues(
portal_type=self.portal.getPortalAccountingMovementTypeList())
......@@ -531,7 +534,7 @@ class TestConversionInSimulation(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
x_curr_ex_line = currency.newContent(
portal_type='Currency Exchange Line',
......@@ -542,7 +545,7 @@ class TestConversionInSimulation(AccountingTestCase,ERP5TypeTestCase):
x_curr_ex_line.setStopDate(DateTime(2008,10,22))
x_curr_ex_line.validate()
self.createInvoiceTransactionRule(currency)
get_transaction().commit()
transaction.commit()
self.tic()#execute transaction
client = self.portal.organisation_module.newContent(
portal_type='Organisation',
......@@ -567,7 +570,7 @@ class TestConversionInSimulation(AccountingTestCase,ERP5TypeTestCase):
quantity=5,
price=2)
order.confirm()
get_transaction().commit()
transaction.commit()
self.tic()
related_packing_list = order.getCausalityRelatedValue(
portal_type='Sale Packing List')
......@@ -579,16 +582,16 @@ class TestConversionInSimulation(AccountingTestCase,ERP5TypeTestCase):
round(655.957*related_packing_list_line.getTotalPrice())
related_packing_list_line.edit(quantity=3.0)
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEquals(related_packing_list.getCausalityState(),
'diverged')
self._solveDivergence(related_packing_list, 'quantity', 'accept')
get_transaction().commit()
transaction.commit()
self.tic()
related_packing_list.start()
related_packing_list.stop()
get_transaction().commit()
transaction.commit()
self.tic()
related_applied_rule = order.getCausalityRelatedValue(
......@@ -631,7 +634,7 @@ class TestConversionInSimulation(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
x_curr_ex_line = currency.newContent(
portal_type='Currency Exchange Line',
......@@ -642,7 +645,7 @@ class TestConversionInSimulation(AccountingTestCase,ERP5TypeTestCase):
x_curr_ex_line.setStopDate(DateTime(2008,10,22))
x_curr_ex_line.validate()
self.createInvoiceTransactionRule(currency)
get_transaction().commit()
transaction.commit()
self.tic()#execute transaction
client = self.portal.organisation_module.newContent(
portal_type='Organisation',
......@@ -667,7 +670,7 @@ class TestConversionInSimulation(AccountingTestCase,ERP5TypeTestCase):
quantity=5,
price=2)
order.confirm()
get_transaction().commit()
transaction.commit()
self.tic()
related_packing_list = order.getCausalityRelatedValue(
portal_type='Purchase Packing List')
......@@ -679,17 +682,17 @@ class TestConversionInSimulation(AccountingTestCase,ERP5TypeTestCase):
round(655.957*related_packing_list_line.getTotalPrice())
related_packing_list_line.edit(quantity=3.0)
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEquals(related_packing_list.getCausalityState(),
'diverged')
self._solveDivergence(related_packing_list, 'quantity','accept')
get_transaction().commit()
transaction.commit()
self.tic()
related_packing_list.start()
related_packing_list.stop()
get_transaction().commit()
transaction.commit()
self.tic()
related_applied_rule = order.getCausalityRelatedValue(
......@@ -731,7 +734,7 @@ class TestConversionInSimulation(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
x_curr_ex_line = currency.newContent(
portal_type='Currency Exchange Line',
......@@ -742,7 +745,7 @@ class TestConversionInSimulation(AccountingTestCase,ERP5TypeTestCase):
x_curr_ex_line.setStopDate(DateTime(2008,10,22))
x_curr_ex_line.validate()
self.createInvoiceTransactionRule(currency)
get_transaction().commit()
transaction.commit()
self.tic()#execute transaction
client = self.portal.organisation_module.newContent(
portal_type='Organisation',
......@@ -769,7 +772,7 @@ class TestConversionInSimulation(AccountingTestCase,ERP5TypeTestCase):
quantity=5,
price=2)
order.confirm()
get_transaction().commit()
transaction.commit()
self.tic()
related_packing_list = order.getCausalityRelatedValue(
portal_type='Sale Packing List')
......@@ -780,7 +783,7 @@ class TestConversionInSimulation(AccountingTestCase,ERP5TypeTestCase):
order.getIncoterm())
related_packing_list.start()
related_packing_list.stop()
get_transaction().commit()
transaction.commit()
self.tic()
related_invoice = related_packing_list.getCausalityRelatedValue(
portal_type='Sale Invoice Transaction')
......@@ -810,7 +813,7 @@ class TestConversionInSimulation(AccountingTestCase,ERP5TypeTestCase):
portal_type='Currency',
title='euro')
currency.setBaseUnitQuantity(0.01)
get_transaction().commit()
transaction.commit()
self.tic()#execute transaction
client = self.portal.organisation_module.newContent(
portal_type='Organisation',
......@@ -844,7 +847,7 @@ class TestConversionInSimulation(AccountingTestCase,ERP5TypeTestCase):
quantity=1.5,
price=2)
order.confirm()
get_transaction().commit()
transaction.commit()
self.tic()
related_packing_list = order.getCausalityRelatedValue(
portal_type='Sale Packing List')
......
......@@ -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())
......
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