Commit d2c45581 authored by Łukasz Nowak's avatar Łukasz Nowak

Drop duplicated code.

parent 72dae5ec
......@@ -15,6 +15,26 @@ import tempfile
from DateTime import DateTime
from Products.ERP5Type.DateUtils import addToDate
class Simulator:
def __init__(self, outfile, method, to_return=None):
self.outfile = outfile
open(self.outfile, 'w').write(repr([]))
self.method = method
self.to_return = to_return
def __call__(self, *args, **kwargs):
"""Simulation Method"""
old = open(self.outfile, 'r').read()
if old:
l = eval(old)
else:
l = []
l.append({'recmethod': self.method,
'recargs': args,
'reckwargs': kwargs})
open(self.outfile, 'w').write(repr(l))
return self.to_return
def simulateInstance_solveInvoicingGeneration(func):
@functools.wraps(func)
def wrapped(self, *args, **kwargs):
......@@ -1072,26 +1092,6 @@ class TestHostingSubscription_requestUpdateOpenSaleOrder(testSlapOSMixin):
self.assertEqual(request_time_2, validated_line_2.getStartDate())
self.assertEqual(stop_date_2, validated_line_2.getStopDate())
class Simulator:
def __init__(self, outfile, method, to_return=None):
self.outfile = outfile
open(self.outfile, 'w').write(repr([]))
self.method = method
self.to_return = to_return
def __call__(self, *args, **kwargs):
"""Simulation Method"""
old = open(self.outfile, 'r').read()
if old:
l = eval(old)
else:
l = []
l.append({'recmethod': self.method,
'recargs': args,
'reckwargs': kwargs})
open(self.outfile, 'w').write(repr(l))
return self.to_return
def simulateSimulationMovement_buildSlapOS(func):
@functools.wraps(func)
def wrapped(self, *args, **kwargs):
......@@ -1297,26 +1297,6 @@ class TestSlapOSTriggerBuildAlarm(testSlapOSMixin):
if os.path.exists(activate_simulator):
os.unlink(activate_simulator)
class Simulator:
def __init__(self, outfile, method, to_return=None):
self.outfile = outfile
open(self.outfile, 'w').write(repr([]))
self.method = method
self.to_return = to_return
def __call__(self, *args, **kwargs):
"""Simulation Method"""
old = open(self.outfile, 'r').read()
if old:
l = eval(old)
else:
l = []
l.append({'recmethod': self.method,
'recargs': args,
'reckwargs': kwargs})
open(self.outfile, 'w').write(repr(l))
return self.to_return
def simulateDelivery_manageBuildingCalculatingDelivery(func):
@functools.wraps(func)
def wrapped(self, *args, **kwargs):
......
170
\ No newline at end of file
171
\ No newline at end of file
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