From 7ac215e587ea4107a705f1b57ac43ec3fefeb9ee Mon Sep 17 00:00:00 2001 From: "pap (openerp)" Date: Thu, 3 Jun 2010 16:54:20 +0530 Subject: [ADD]:added yml test for project and project_ modules bzr revid: pap@tinyerp.co.in-20100603112420-uofelwn685xlheum --- addons/project/test/test_project.yml | 322 +++++++++++++++++++++++++++++++++++ 1 file changed, 322 insertions(+) create mode 100644 addons/project/test/test_project.yml (limited to 'addons/project/test') diff --git a/addons/project/test/test_project.yml b/addons/project/test/test_project.yml new file mode 100644 index 00000000000..3a4c8f501da --- /dev/null +++ b/addons/project/test/test_project.yml @@ -0,0 +1,322 @@ +- + Test project template functionality +- + Create project 'OpenERP Training Programme' +- + !record {model: project.project, id: project_project_openerptrainingprogramme0}: + company_id: base.main_company + name: OpenERP Training Programme +- + Create task 'Technical Training' for this project +- + !record {model: project.task, id: project_task_technicaltraining0}: + date_start: '2010-05-31 11:48:38' + name: Technical Training + planned_hours: 30.0 + project_id: project_project_openerptrainingprogramme0 + remaining_hours: 30.0 + state: draft +- + Create task 'Functional Training' for this project +- + !record {model: project.task, id: project_task_functionaltraining0}: + date_start: '2010-05-31 11:49:11' + name: Functional Training + planned_hours: 30.0 + project_id: project_project_openerptrainingprogramme0 + remaining_hours: 30.0 + state: draft +- + Set project as project template +- + !python {model: project.project}: | + self.set_template(cr, uid, [ref("project_project_openerptrainingprogramme0")], + {"lang": "en_US", "active_model": "ir.ui.menu", "active_ids": [ref("project.menu_open_view_project_all")], + "tz": False, "active_id": ref("project.menu_open_view_project_all"), }) +- + Check if project in template state +- + !assert {model: project.project, id: project_project_openerptrainingprogramme0, severity: error, string: Project is in template state}: + - state == "template" +- + Create new project based on this template +- + !python {model: project.project}: | + new_prj = self.duplicate_template(cr, uid, [ref("project_project_openerptrainingprogramme0")], + {"lang": "en_US", "active_model": "ir.ui.menu", "active_ids": [ref("project.menu_open_view_project_all")], + "tz": False, "active_id": ref("project.menu_open_view_project_all"), }) + if not new_prj: + raise Exception( "New project based on template not created") + new_id = new_prj['res_id'] + state = self.read(cr, uid, [new_id], ['state'])[0]['state'] + assert state == 'open', "Project in %s state. Project created from template project must be in open state"%state +- + Reset project template to normal project +- + !python {model: project.project}: | + self.reset_project(cr, uid, [ref("project_project_openerptrainingprogramme0")], {"lang": "en_US", "active_ids": + [ref("project.menu_open_view_project_all")], "tz": False, "active_model": + "ir.ui.menu", "project_id": False, "active_id": ref("project.menu_open_view_project_all"), + }) +- + Check if project in open state +- + !assert {model: project.project, id: project_project_openerptrainingprogramme0, severity: error, string: Project is in open state}: + - state == "open" + + + + +- + Test for different project-states +- + Keep project pending +- + !python {model: project.project}: | + self.set_pending(cr, uid, [ref("project_project_openerptrainingprogramme0")], {"lang": "en_US", "active_ids": + [ref("project.menu_open_view_project_all")], "tz": False, "active_model": + "ir.ui.menu", "project_id": False, "active_id": ref("project.menu_open_view_project_all"), + }) +- + Check if project in pending state +- + !assert {model: project.project, id: project_project_openerptrainingprogramme0, severity: error, string: Project is in pending state}: + - state == "pending" +- + Cancel the project +- + !python {model: project.project}: | + self.set_cancel(cr, uid, [ref("project_project_openerptrainingprogramme0")], {"lang": "en_US", "active_ids": + [ref("project.menu_open_view_project_all")], "tz": False, "active_model": + "ir.ui.menu", "project_id": False, "active_id": ref("project.menu_open_view_project_all"), + }) +- + Check if project in cancel state +- + !assert {model: project.project, id: project_project_openerptrainingprogramme0, severity: error, string: Project is in cancel state}: + - state == "cancelled" +- + Re-open the project +- + !python {model: project.project}: | + self.set_open(cr, uid, [ref("project_project_openerptrainingprogramme0")], {"lang": "en_US", "active_ids": [ref("project.menu_open_view_project_all")], + "tz": False, "active_model": "ir.ui.menu", "project_id": False, "active_id": + ref("project.menu_open_view_project_all"), }) +- + Check if project in open state +- + !assert {model: project.project, id: project_project_openerptrainingprogramme0, severity: error, string: Project is in open state}: + - state == "open" + + + +- + Test for task work allocation +- + Check if task 'Technical Training' in draft state +- + !assert {model: project.task, id: project_task_technicaltraining0, severity: error, string: Project is in draft state}: + - state == "draft" +- + Open task 'Technical Training' +- + !python {model: project.task}: | + self.do_open(cr, uid, [ref("project_task_technicaltraining0")], {"lang": "en_US", "active_ids": [ref("project.menu_action_view_task")], + "tz": False, "active_model": "ir.ui.menu", "search_default_project_id": + False, "search_default_user_id": 1, "search_default_current": 1, "project_id": + False, "active_id": ref("project.menu_action_view_task"), }) +- + Check if task 'Technical Training' in open state and for other initial values +- + !assert {model: project.task, id: project_task_technicaltraining0, severity: error, string: Project is in open state}: + - state == "open" + - planned_hours == 30 + - remaining_hours == 30 + - delay_hours == 0.0 + - total_hours == 30 + - effective_hours == 0.0 +- + Make a work task entry 'Training on OpenERP modules, models and classes' of 10 hours +- + !record {model: project.task, id: project_task_technicaltraining0}: + work_ids: + - date: '2010-05-31 15:04:22' + hours: 10.0 + name: Training on OpenERP modules, models and classes + user_id: base.user_root +- + Check for effective hours and remaining hours +- + !assert {model: project.task, id: project_task_technicaltraining0, severity: error, string: After work task of 10 hours effective_hours must be equal to 10}: + - remaining_hours == 20 + - effective_hours == 10.0 + - total_hours == effective_hours + remaining_hours + - delay_hours == total_hours - planned_hours +- + Make a work task entry 'Training on OpenERP xml views' of 10 hours +- + !record {model: project.task, id: project_task_technicaltraining0}: + work_ids: + - date: '2010-06-01 15:04:46' + hours: 10.0 + name: Training on OpenERP xml views + user_id: base.user_root +- + Check for effective hours and remaining hours +- + !assert {model: project.task, id: project_task_technicaltraining0, severity: error, string: After one more work task of 10 hours effective_hours must be equal to 20}: + - remaining_hours == 10 + - effective_hours == 20.0 + - total_hours == effective_hours + remaining_hours + - delay_hours == total_hours - planned_hours +- + Make a work task entry 'Training on workflows' of 10 hours +- + !record {model: project.task, id: project_task_technicaltraining0}: + work_ids: + - date: '2010-06-02 15:05:24' + hours: 10.0 + name: Training on workflows + user_id: base.user_root +- + Check for effective hours and remaining hours +- + !assert {model: project.task, id: project_task_technicaltraining0, severity: error, string: After one more work task of 10 hours effective_hours must be equal to 30}: + - remaining_hours == 0 + - effective_hours == 30.0 + - total_hours == effective_hours + remaining_hours + - delay_hours == total_hours - planned_hours +- + Set remaining hours of 10 hours for reevaluating the task +- + !record {model: config.compute.remaining, id: config_compute_remaining_0}: + remaining_hours: 10.0 +- + Reevaluating the task +- + !python {model: config.compute.remaining}: | + self.compute_hours(cr, uid, [ref("config_compute_remaining_0")], {"lang": "en_US", + "project_id": False, "tz": False, "active_model": "project.task", "search_default_project_id": + False, "search_default_user_id": 1, "search_default_current": 1, "active_ids": + [ref("project_task_technicaltraining0")], "active_id": ref("project_task_technicaltraining0"), }) + +- + Check for effective hours and remaining hours +- + !assert {model: project.task, id: project_task_technicaltraining0, severity: error, string: After reevaluating the task with 10 hours remaining_hours must be 10 while planned_hours remains 30}: + - planned_hours == 30 + - remaining_hours == 10.0 + - effective_hours == 30.0 + - total_hours == effective_hours + remaining_hours + - delay_hours == total_hours - planned_hours +- + Make a work task entry 'Training on reports and wizards' of 10 hours +- + !record {model: project.task, id: project_task_technicaltraining0}: + work_ids: + - date: '2010-05-31 15:08:40' + hours: 10.0 + name: Training on reports and wizards + user_id: base.user_root +- + Check for effective hours and remaining hours +- + !assert {model: project.task, id: project_task_technicaltraining0, severity: error, string: After one more work task of 10 hours effective_hours must be equal to 40 while planned_hours remains 30}: + - planned_hours == 30 + - remaining_hours == 0 + - effective_hours == 40.0 + - total_hours == effective_hours + remaining_hours + - delay_hours == total_hours - planned_hours +- + Close the task +- + !python {model: project.task}: | + self.do_close(cr, uid, [ref("project_task_technicaltraining0")], {"lang": "en_US", "active_ids": [ref("project.menu_action_view_task")], + "tz": False, "active_model": "ir.ui.menu", "search_default_project_id": + False, "search_default_user_id": 1, "search_default_current": 1, "project_id": + False, "active_id": ref("project.menu_action_view_task"), }) +- + Check if task in done state +- + !assert {model: project.task, id: project_task_technicaltraining0, severity: error, string: Task is in done state}: + - state == "done" + + +- + Test for task reactivation +- + Reactivate task +- + !record {model: config.compute.remaining, id: config_compute_remaining_1}: + remaining_hours: 10.0 +- + Reevaluating the task with 10 hours remaining +- + !python {model: config.compute.remaining}: | + self.compute_hours(cr, uid, [ref("config_compute_remaining_1")], {"lang": "en_US", + "project_id": False, "tz": False, "button_reactivate": True, "active_model": + "project.task", "search_default_project_id": False, "search_default_user_id": + 1, "search_default_current": 1, "active_ids": [ref("project_task_technicaltraining0")], "active_id": ref("project_task_technicaltraining0"), + }) +- + Check for effective hours and remaining hours +- + !assert {model: project.task, id: project_task_technicaltraining0, severity: error, string: After reevaluating the task with 10 hours remaining_hours must be 10 while planned_hours remains 30}: + - planned_hours == 30 + - remaining_hours == 10.0 + - effective_hours == 40.0 + - total_hours == effective_hours + remaining_hours + - delay_hours == total_hours - planned_hours +- + Make a work task entry 'Training on yml' of 5 hours +- + !record {model: project.task, id: project_task_technicaltraining0}: + work_ids: + - date: '2010-05-31 16:55:27' + hours: 5.0 + name: Training on yml + user_id: base.user_root +- + Check for effective hours and remaining hours +- + !assert {model: project.task, id: project_task_technicaltraining0, severity: error, string: After work task of 5 hours effective_hours must be equal to 45 and remaining_hours is 5}: + - planned_hours == 30 + - remaining_hours == 5.0 + - effective_hours == 45.0 + - total_hours == effective_hours + remaining_hours + - delay_hours == total_hours - planned_hours +- + Close the task +- + !python {model: project.task}: | + self.do_close(cr, uid, [ref("project_task_technicaltraining0")], {"lang": "en_US", "active_ids": [ref("project.menu_action_view_task")], + "tz": False, "active_model": "ir.ui.menu", "search_default_project_id": + False, "search_default_user_id": 1, "search_default_current": 1, "project_id": + False, "active_id": ref("project.menu_action_view_task"), }) +- + Check if task in done state +- + !assert {model: project.task, id: project_task_technicaltraining0, severity: error}: + - state == "done" +- + Check for effective hours and remaining hours +- + !assert {model: project.task, id: project_task_technicaltraining0, severity: error, string: After closing the task planned_hours must remain 30 effective_hours must be 45 and remaining hours must be 0}: + - planned_hours == 30 + - remaining_hours == 0.0 + - effective_hours == 45.0 + - total_hours == effective_hours + remaining_hours + - delay_hours == total_hours - planned_hours +- + Close project 'OpenERP Training Programme' +- + !python {model: project.project}: | + self.set_done(cr, uid, [ref("project_project_openerptrainingprogramme0")], {"lang": "en_US", "active_ids": [ref("project.menu_open_view_project_all")], + "tz": False, "active_model": "ir.ui.menu", "project_id": False, "active_id": + ref("project.menu_open_view_project_all"), }) +- + Check if project in close state +- + !assert {model: project.project, id: project_project_openerptrainingprogramme0, severity: error}: + - state == "close" + \ No newline at end of file -- cgit v1.2.3 From f1feffec6a9203884cc06d5373d10f46fa5b4e40 Mon Sep 17 00:00:00 2001 From: "pap (openerp)" Date: Fri, 4 Jun 2010 17:59:04 +0530 Subject: [imp]:few changes in ymls bzr revid: pap@tinyerp.co.in-20100604122904-o8gf7d7dj89ljo1w --- addons/project/test/test_project.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'addons/project/test') diff --git a/addons/project/test/test_project.yml b/addons/project/test/test_project.yml index 3a4c8f501da..25b3e94b57f 100644 --- a/addons/project/test/test_project.yml +++ b/addons/project/test/test_project.yml @@ -1,5 +1,5 @@ - - Test project template functionality + Test project template feature - Create project 'OpenERP Training Programme' - @@ -145,7 +145,7 @@ name: Training on OpenERP modules, models and classes user_id: base.user_root - - Check for effective hours and remaining hours + Check for effective hours and remaining hours, effective_hours must be equal to 10 - !assert {model: project.task, id: project_task_technicaltraining0, severity: error, string: After work task of 10 hours effective_hours must be equal to 10}: - remaining_hours == 20 @@ -162,7 +162,7 @@ name: Training on OpenERP xml views user_id: base.user_root - - Check for effective hours and remaining hours + Check for effective hours and remaining hours, effective_hours must be equal to 20 - !assert {model: project.task, id: project_task_technicaltraining0, severity: error, string: After one more work task of 10 hours effective_hours must be equal to 20}: - remaining_hours == 10 @@ -179,7 +179,7 @@ name: Training on workflows user_id: base.user_root - - Check for effective hours and remaining hours + Check for effective hours and remaining hours, effective_hours must be equal to 30 - !assert {model: project.task, id: project_task_technicaltraining0, severity: error, string: After one more work task of 10 hours effective_hours must be equal to 30}: - remaining_hours == 0 @@ -192,7 +192,7 @@ !record {model: config.compute.remaining, id: config_compute_remaining_0}: remaining_hours: 10.0 - - Reevaluating the task + Reevaluate the task - !python {model: config.compute.remaining}: | self.compute_hours(cr, uid, [ref("config_compute_remaining_0")], {"lang": "en_US", @@ -201,7 +201,7 @@ [ref("project_task_technicaltraining0")], "active_id": ref("project_task_technicaltraining0"), }) - - Check for effective hours and remaining hours + Check for effective hours and remaining hours, remaining_hours must be 10 while planned_hours remains 30 - !assert {model: project.task, id: project_task_technicaltraining0, severity: error, string: After reevaluating the task with 10 hours remaining_hours must be 10 while planned_hours remains 30}: - planned_hours == 30 @@ -250,7 +250,7 @@ !record {model: config.compute.remaining, id: config_compute_remaining_1}: remaining_hours: 10.0 - - Reevaluating the task with 10 hours remaining + Reevaluate the task with 10 hours remaining - !python {model: config.compute.remaining}: | self.compute_hours(cr, uid, [ref("config_compute_remaining_1")], {"lang": "en_US", @@ -259,7 +259,7 @@ 1, "search_default_current": 1, "active_ids": [ref("project_task_technicaltraining0")], "active_id": ref("project_task_technicaltraining0"), }) - - Check for effective hours and remaining hours + Check for effective hours and remaining hours, remaining_hours must be 10 while planned_hours remains 30 - !assert {model: project.task, id: project_task_technicaltraining0, severity: error, string: After reevaluating the task with 10 hours remaining_hours must be 10 while planned_hours remains 30}: - planned_hours == 30 -- cgit v1.2.3