From 08d792ecfe4361f793ca6368c7fc4fe5f2159825 Mon Sep 17 00:00:00 2001 From: Jigar Amin - OpenERP Date: Thu, 25 Aug 2011 14:44:30 +0530 Subject: [PATCH] [ADD] crm - added test case for crm lead missing funcnality bzr revid: jam@tinyerp.com-20110825091430-57sx8vu6tibq5csm --- addons/crm/__openerp__.py | 1 + addons/crm/test/test_crm_lead_case2.yml | 121 ++++++++++++++++++++++++ 2 files changed, 122 insertions(+) create mode 100644 addons/crm/test/test_crm_lead_case2.yml diff --git a/addons/crm/__openerp__.py b/addons/crm/__openerp__.py index 5e812207921..72e5d244269 100644 --- a/addons/crm/__openerp__.py +++ b/addons/crm/__openerp__.py @@ -127,6 +127,7 @@ Creates a dashboard for CRM that includes: 'test/test_crm_recurrent_meeting.yml', 'test/test_crm_stage_changes.yml', 'test/test_crm_recurrent_meeting_case2.yml', + 'test/test_crm_lead_case2.yml', ], 'installable': True, 'active': False, diff --git a/addons/crm/test/test_crm_lead_case2.yml b/addons/crm/test/test_crm_lead_case2.yml new file mode 100644 index 00000000000..fb6edf5d130 --- /dev/null +++ b/addons/crm/test/test_crm_lead_case2.yml @@ -0,0 +1,121 @@ +- + In order to do complete test the CRM in OpenERP, + I will create new full configured record and carry test on it. +- | + I Start by creating "Demo Sales Team" with No Unlink. + Creating a crm.case.section record +- + !record {model: crm.case.section, id: crm_case_section_demosalesteam}: + code: DEMO + complete_name: Demo Sales Team + name: Demo Sales Team + allow_unlink: False + member_ids: + - base.user_admin + stage_ids: + - crm.stage_lead1 + - crm.stage_lead2 + - crm.stage_lead3 + - crm.stage_lead4 + - crm.stage_lead5 + - crm.stage_lead6 + working_hours: 0.0 + resource_calendar_id: resource.timesheet_group1 + parent_id: crm.section_sales_department + +- | + Creating a new lead "Demo Customer" and I provide an address to this + demo customer and email "info@democustomer.com" and Also "Demo Sales Team". +- + !record {model: crm.lead, id: crm_lead_democustomer}: + email_from: info@democustomer.com + name: Demo Customer + partner_name: NotSoTinySARL + phone: (+32).81.81.37.00 + mobile: (+32).81.81.37.00 + section_id: crm_case_section_demosalesteam + referred: False + type: lead +- + I check that the lead is in 'draft' state, +- + !assert {model: crm.lead, id: crm_lead_democustomer, string: Lead in Draft}: + - state == "draft" +- + I assigning contact detail to the Lead "Demo Customer". +- + !python {model: crm.lead}: | + self.onchange_partner_address_id(cr, uid, ref("crm_lead_democustomer"), ref("base.res_partner_address_notsotinysarl0"), email=False) + +- + I selecting email "Opt-out" option for the "Demo Customer" Lead. +- + !python {model: crm.lead}: | + self.on_change_optout(cr, uid, ref("crm_lead_democustomer"), True) + +- + Now I change the Opt-out to Opt-in to show email receive preference. +- + !python {model: crm.lead}: | + self.on_change_optin(cr, uid, ref("crm_lead_democustomer"), True) +- + I open lead by click on "Open" button, +- + !python {model: crm.lead}: | + self.case_open(cr, uid, [ref("crm_lead_democustomer")]) +- + I check that lead "Demo Customer" is now in 'open' state. +- + !assert {model: crm.lead, id: crm_lead_democustomer, string: Lead in open state}: + - state == "open" +- + Now i reset the lead "Demo Customer". +- + !python {model: crm.lead}: | + self.case_reset(cr, uid, [ref("crm_lead_democustomer")]) +- + I again opening lead by click on "Open" button, +- + !python {model: crm.lead}: | + self.case_open(cr, uid, [ref("crm_lead_democustomer")]) +- + I setting stage "New" for the lead "Demo Customer". +- + !python {model: crm.lead}: | + self.stage_next(cr, uid, [ref("crm_lead_democustomer")], context={'stage_type': 'lead'}) +- + I try to Unlink the Lead "Demo Customer" demo Lead +- + !python {model: crm.lead}: | + try: + self.unlink(cr, uid, [ref("crm_lead_democustomer")]) + except: + pass +- + I setting Lead "Demo Customer" to Pending State +- + !python {model: crm.lead}: | + self.case_pending(cr, uid, [ref("crm_lead_democustomer")]) +- + I check that lead "Demo Customer" is now in 'Pending' state. +- + !assert {model: crm.lead, id: crm_lead_democustomer, string: Lead in Pending state}: + - state == "pending" +- + Now i Escalate the Lead "Demo Customer" Parent "Sales Team". +- + !python {model: crm.lead}: | + self.case_escalate(cr, uid, [ref("crm_lead_democustomer")]) +- + Now i Copying this lead "Demo Customer" to New Lead. +- + !python {model: crm.lead}: | + self.copy(cr, uid, ref("crm_lead_democustomer")) +- + Checking the Lead Copied or Not. +- + !python {model: crm.lead}: | + sid = self.search(cr, uid, [('name', '=', 'Demo Customer'),('state', '=', 'draft')]) + if not sid: + raise AssertionError("Lead is not copied Successfully") +