From 3c413986833c8c5a4072b1db7290e9d4cd1dfe3c Mon Sep 17 00:00:00 2001 From: "rpa (Open ERP)" Date: Tue, 20 Apr 2010 18:28:48 +0530 Subject: [PATCH] [ADD]: base_calendar: Added yml test cases in base_calendar bzr revid: rpa@tinyerp.com-20100420125848-dzlue5uw6n5yyb6e --- addons/base_calendar/__openerp__.py | 1 + addons/base_calendar/test/base_calendar_test.yml | 77 ++++++++++++++++++++++ 2 files changed, 78 insertions(+) create mode 100644 addons/base_calendar/test/base_calendar_test.yml diff --git a/addons/base_calendar/__openerp__.py b/addons/base_calendar/__openerp__.py index e8b528d..44c3699 100755 --- a/addons/base_calendar/__openerp__.py +++ b/addons/base_calendar/__openerp__.py @@ -40,6 +40,7 @@ 'wizard/base_calendar_invite_attendee_view.xml', 'base_calendar_view.xml' ], + "test" : ['test/base_calendar_test.yml'], "installable" : True, "active" : False, } diff --git a/addons/base_calendar/test/base_calendar_test.yml b/addons/base_calendar/test/base_calendar_test.yml new file mode 100644 index 0000000..14bf162 --- /dev/null +++ b/addons/base_calendar/test/base_calendar_test.yml @@ -0,0 +1,77 @@ +- | + In Order to test base_calendar, I will first create One Simple Event with real data +- + !record {model: calendar.event, id: calendar_event_technicalpresentation0}: + class: private + date: '2010-04-30 16:00:00' + date_deadline: '2010-04-30 18:30:00' + description: The Technical Presentation will cover following topics:\n* Creating OpenERP + class\n* Views\n* Wizards\n* Workflows + duration: 2.5 + location: OpenERP S.A. + name: Technical Presentation + rrule_type: none +- | + Now I will set recurrence for this event to occure monday and friday of week +- + !python {model: calendar.event}: | + self.write(cr, uid, [ref("calendar_event_technicalpresentation0")], {'fr': 1, 'mo': 1, 'interval': 1, 'freq': 'weekly', 'rrule_type': 'custom'}) +- | + In order to check that recurrent events are views successfully in calenadar view, + I will open calendar view of events +- + !python {model: calendar.event}: | + self.fields_view_get(cr, uid, False, 'calendar', context) +- | + In order to check that recurrent events are views successfully in calenadar view, + I will search for one of the recurrent event and count the number of events +- + !python {model: calendar.event}: | + ids = self.search(cr, uid, [('date', '>=', '2010-05-01 00:00:00'), ('date', '<=', '2010-05-31 00:00:00')] ) + assert len(ids) == 9 +- | + Now I will make All day event and test it +- + !record {model: calendar.event, id: calendar_event_alldaytestevent0}: + allday: 1 + class: confidential + date: '2010-04-30 00:00:00' + date_deadline: '2010-04-30 00:00:00' + description: 'All day technical test ' + location: School + name: All day test event + rrule_type: none +- | + In order to check reminder I will first create reminder +- + !record {model: res.alarm, id: res_alarm_daybeforeeventstarts0}: + name: 1 Day before event starts + trigger_duration: 1 + trigger_interval: days + trigger_occurs: before + trigger_related: start +- | + Now I will assign this reminder to all day event +- + !python {model: calendar.event}: | + self.write(cr, uid, [ref("calendar_event_alldaytestevent0")], {'alarm_id': ref("res_alarm_daybeforeeventstarts0")}) +- | + In order to assign attendee I will invite Demo user +- + !record {model: base_calendar.invite.attendee, id: base_calendar_invite_attendee_0}: + type: internal + partner_id: base.res_partner_9 # Put bcz of problem in read + user_ids: + - base.user_demo +- | + Then I click on Invite Button +- + !python {model: base_calendar.invite.attendee}: | + self.do_invite(cr, uid, [ref("base_calendar_invite_attendee_0")], {'active_id': ref("calendar_event_alldaytestevent0"), 'model' : 'calendar.event', 'attendee_field':'attendee_ids'}) +- | + Now I will Accept this invitation +- + !python {model: calendar.attendee}: | + ids = self.search(cr, uid, [('ref', '=', 'calendar.event' + ',' + str(ref("calendar_event_alldaytestevent0")))]) + if ids: + self.do_accept(cr, uid, ids, context=context) -- 1.7.10.4