[IMP] improvement in YML test cases in marketing_campaign module

bzr revid: tpa@tinyerp.com-20111213052238-kuk13vidnoa3fwhq
This commit is contained in:
Turkesh Patel (Open ERP)
2011-12-13 10:52:38 +05:30
parent cb6496799f
commit f9524f5dba
2 changed files with 50 additions and 5 deletions
@@ -164,11 +164,12 @@ Normal - the campaign runs normally and automatically sends all emails and repor
self.write(cr, uid, ids, {'state': 'cancelled'})
return True
# dead code
def signal(self, cr, uid, model, res_id, signal, run_existing=True, context=None):
record = self.pool.get(model).browse(cr, uid, res_id, context)
return self._signal(cr, uid, record, signal, run_existing, context)
#dead code
def _signal(self, cr, uid, record, signal, run_existing=True, context=None):
if not signal:
raise ValueError('signal cannot be False')
@@ -461,6 +462,7 @@ class marketing_campaign_activity(osv.osv):
return super(marketing_campaign_activity, self).search(cr, uid, args,
offset, limit, order, context, count)
#dead code
def _process_wi_report(self, cr, uid, activity, workitem, context=None):
service = netsvc.LocalService('report.%s'%activity.report_id.report_name)
(report_data, format) = service.create(cr, uid, [], {}, {})
@@ -481,6 +483,7 @@ class marketing_campaign_activity(osv.osv):
activity.email_template_id.id,
workitem.res_id, context=context)
#dead code
def _process_wi_action(self, cr, uid, activity, workitem, context=None):
if context is None:
context = {}
@@ -20,7 +20,27 @@
I synchronized segment manually to see all step of activity and process covered on this campaign.
-
!python {model: marketing.campaign.segment}: |
segment_id = self.browse(cr ,uid ,ref("marketing_campaign_segment0") ,context)
assert segment_id.date_next_sync, 'Next Synchronization date is not calculated.'
self.synchroniz(cr, uid, [ref("marketing_campaign_segment0")])
-
I cancel Marketing Workitems.
-
!python {model: marketing.campaign.workitem}: |
ids = self.search(cr, uid, [('segment_id', '=', ref('marketing_campaign_segment0')),
('campaign_id', '=', ref('marketing_campaign_openerppartnerchannel'))])
self.button_cancel(cr, uid, ids)
record = self.browse(cr, uid, ids[0])
assert record.state == 'cancelled' or record.state == 'done' , 'Marketing Workitem shoud be in cancel state.'
-
I set Marketing Workitems in draft state.
-
!python {model: marketing.campaign.workitem}: |
ids = self.search(cr, uid, [('segment_id', '=', ref('marketing_campaign_segment0')),
('campaign_id', '=', ref('marketing_campaign_openerppartnerchannel'))])
self.button_draft(cr, uid, ids)
record = self.browse(cr, uid, ids[0])
assert record.state == 'todo' or record.state == 'done' , 'Marketing Workitem shoud be in draft state.'
-
I check followup detail of first activity.
-
@@ -28,7 +48,9 @@
ids = self.search(cr, uid, [('segment_id', '=', ref('marketing_campaign_segment0')),
('campaign_id', '=', ref('marketing_campaign_openerppartnerchannel')), ('activity_id', '=', ref('marketing_campaign_activity_0'))])
assert ids, 'Followup item is not created for first activity.'
-
work_item_id = self.browse(cr ,uid ,ids[0] ,context)
assert work_item_id.res_name, 'Resource Name is not defined.'
-
I process followup of first activity.
-
!python {model: marketing.campaign.workitem}: |
@@ -49,7 +71,7 @@
-
!python {model: res.partner}: |
self.write(cr, uid, [ref("base.res_partner_agrolait")], {'credit_limit':41000}, context=context)
-
-
I process followup of second activity after set draft.
-
!python {model: marketing.campaign.workitem}: |
@@ -71,7 +93,7 @@
-
!python {model: res.partner}: |
self.write(cr, uid, [ref("base.res_partner_agrolait")], {'credit_limit':151000}, context=context)
-
-
I process followup of third activity after set draft.
-
!python {model: marketing.campaign.workitem}: |
@@ -89,7 +111,27 @@
('campaign_id', '=', ref('marketing_campaign_openerppartnerchannel')), ('activity_id', '=', ref('marketing_campaign_activity_2'))])
self.preview(cr, uid, ids)
-
I close segmentation After completion of all activity.
I cancel segmentation because of some activity.
-
!workflow {model: marketing.campaign.segment, action: state_cancel_set, ref: marketing_campaign_segment0}
-
I check the segmentation is canceled.
-
!assert {model: marketing.campaign.segment, id: marketing_campaign_segment0}:
- state == 'cancelled'
-
I reopen the segmentation.
-
!workflow {model: marketing.campaign.segment, action: state_draft_set, ref: marketing_campaign_segment0}
-
!workflow {model: marketing.campaign.segment, action: state_running_set, ref: marketing_campaign_segment0}
-
I check the segment on Running mode after started.
-
!assert {model: marketing.campaign.segment, id: marketing_campaign_segment0}:
- state == 'running'
-
I close segmentation After completion of all activity.
-
!workflow {model: marketing.campaign.segment, action: state_done_set, ref: marketing_campaign_segment0}
-