diff options
| author | Mayur Maheshwari (OpenERP) <mma@tinyerp.com> | 2011-12-21 18:07:24 +0530 |
|---|---|---|
| committer | Mayur Maheshwari (OpenERP) <mma@tinyerp.com> | 2011-12-21 18:07:24 +0530 |
| commit | 357f3fca2feed21d1ef639bee53b5d7a2d70b71e (patch) | |
| tree | 911b21d5e5226c09f8d96b33161d290e452ffa8d /addons/project_long_term/test/phase_process.yml | |
| parent | cd8a031e926f6e511b4edfe961b36b8fef0ce6b0 (diff) | |
| parent | cb5339c3d92a90bce430bfe637e2ed408ebf6c55 (diff) | |
[MERGE]: Merge with lp:openobject-addons
bzr revid: mma@tinyerp.com-20111221123724-buifqfz9zvmu9s8n
Diffstat (limited to 'addons/project_long_term/test/phase_process.yml')
| -rw-r--r-- | addons/project_long_term/test/phase_process.yml | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/addons/project_long_term/test/phase_process.yml b/addons/project_long_term/test/phase_process.yml new file mode 100644 index 00000000000..725c5b2a97d --- /dev/null +++ b/addons/project_long_term/test/phase_process.yml @@ -0,0 +1,79 @@ +- + In order to test process of Phases, +- + I create a record to schedule the phase of project. +- + !record {model: project.compute.phases, id: project_compute_phases01}: + target_project: 'one' + project_id: project.project_integrate_openerp +- + I schedule the phases. +- + !python {model: project.compute.phases}: | + self.check_selection(cr, uid, [ref("project_compute_phases01")]) +- + I check the starting date and ending date on the phases after scheduling. +- + !python {model: project.project}: | + project = self.browse(cr, uid, ref("project.project_integrate_openerp"), context=context) + def _convert(date): + import time + return time.strptime(date, '%Y-%m-%d %H:%M:%S') + def _check(phase, _convert, _check): #TOFIX: why need to pass function ? + for next_phase in phase.next_phase_ids: + assert _convert(next_phase.date_start) >= _convert(phase.date_end), "Phase does not start in proper date." + _check(next_phase, _convert, _check) + return True + + for phase in project.phase_ids: + + assert phase.date_start, "Start date should be computed." + assert phase.date_end, "End date should be computed." + if not phase.previous_phase_ids and phase.constraint_date_start: + assert _convert(phase.date_start) >= _convert(phase.constraint_date_start), "Phase does not start in proper date." + _check(phase, _convert, _check) +- + I open phase. +- + !python {model: project.phase}: | + self.set_open(cr, uid, [ref("project_phase_1")]) +- + I check state of phase after opened. +- + !assert {model: project.phase, id: project_phase_1, severity: error, string: Phase should be in open state}: + - state == "open" +- + I put phase in pending state. +- + !python {model: project.phase}: | + self.set_pending(cr, uid, [ref("project_phase_1")]) +- + I check state of phase after put in pending. +- + !assert {model: project.phase, id: project_phase_1, severity: error, string: Phase should be in pending state}: + - state == "pending" +- + I make Phase in cancel state. +- + !python {model: project.phase}: | + self.set_cancel(cr, uid, [ref("project_phase_1")]) +- + I check state of phase after cancelled. +- + !assert {model: project.phase, id: project_phase_1, severity: error, string: Phase should be in cancel state}: + - state == "cancelled" +- + I put again in draft phase. +- + !python {model: project.phase}: | + self.set_draft(cr, uid, [ref("project_phase_1")]) +- + I close phase. +- + !python {model: project.phase}: | + self.set_done(cr, uid, [ref("project_phase_1")]) +- + I check state of phase after closed. +- + !assert {model: project.phase, id: project_phase_1, severity: error, string: Phase should be in done state}: + - state == "done" |
