From dc456e15857a5a67adfa2a67cfb86cfe0208868e Mon Sep 17 00:00:00 2001 From: "atp (Open ERP)" Date: Wed, 21 Apr 2010 20:09:30 +0530 Subject: [PATCH] [ADD]: idea: Develop Yaml test case bzr revid: atp@tinyerp.co.in-20100421143930-3tvyfatres2ckp2j --- addons/idea/__openerp__.py | 1 + addons/idea/test/test_idea.yml | 94 ++++++++++++++++++++++++++++++++++ 2 files changed, 95 insertions(+) create mode 100644 addons/idea/test/test_idea.yml diff --git a/addons/idea/__openerp__.py b/addons/idea/__openerp__.py index c5794346f4d..4730fd4637c 100644 --- a/addons/idea/__openerp__.py +++ b/addons/idea/__openerp__.py @@ -43,6 +43,7 @@ 'security/ir.model.access.csv', ], 'demo_xml': [], + 'test':['test/test_idea.yml'], 'installable': True, 'certificate': '0071515601309', } diff --git a/addons/idea/test/test_idea.yml b/addons/idea/test/test_idea.yml new file mode 100644 index 00000000000..bc67bcd49b4 --- /dev/null +++ b/addons/idea/test/test_idea.yml @@ -0,0 +1,94 @@ +- | + In order to test the Idea module in OpenERP, + we will create a full flow, from the idea definition up to the votes and discussions on the idea. +- | + Given that I have an Idea category "Technical". +- + !record {model: idea.category, id: idea_category_technical0}: + name: Technical +- | + I create a New Idea of "Technical presentation for 1 hours in every day" and specify category "Technical". + +- + !record {model: idea.idea, id: idea_idea_0}: + category_id: idea_category_technical0 + description: I want that Technical presentation are arranged for 1 hours in every + day.\nso, on that presentation, we can know all things what improvement and development + are done in our company.\n\n\n\n\n + title: Technical presentation for 1 hours in every day + user_id: base.user_root +- | + I check that idea on draft state. +- + !assert {model: idea.idea, id: idea_idea_0}: + - state == 'draft' +- | + I open this idea by click on "Open" button. +- + !workflow {model: idea.idea, action: idea_open, ref: idea_idea_0} +- | + In order to check voting statistics in real systems I will create 2 new Users "user1" and user2" +- + !record {model: res.users, id: res_users_user0}: + company_id: base.main_company + context_lang: en_US + login: user1 + name: user1 + password: user1 + +- + !record {model: res.users, id: res_users_user1}: + company_id: base.main_company + context_lang: en_US + login: user2 + name: user2 + password: user2 + +- + In order to post vote I connect as user1 and open the idea page + I click on "Vote" wizard and vote the idea as "Normal" +- + !record {model: idea.post.vote, id: idea_post_vote_0}: + vote: 50 +- + !python {model: idea.post.vote}: | + uid = ref('res_users_user0') + self.do_vote(cr, uid, [ref("idea_post_vote_0")], {'active_id': ref('idea_idea_0')}) +- + To add other vote I connect as user2 and open the idea page + I click on "Vote" wizard and vote the idea as "Very Good" +- + !record {model: idea.post.vote, id: idea_post_vote_1}: + vote: 100 + +- + !python {model: idea.post.vote}: | + uid = ref('res_users_user1') + self.do_vote(cr, uid, [ref("idea_post_vote_1")], {'active_id': ref('idea_idea_0')}) + +- + I can see that the Average score changed in "Average score" field with value 75 +- + !record {model: idea.idea, id: idea_idea_0}: + vote_avg: 75 + +- + I put one comment "We can learn many things from technical presentation" for the idea +- + !record {model: idea.idea, id: idea.idea_idea_0}: + comment_ids: + - content: We can learn many things from technical presentation + idea_id: idea.idea_idea_0 + user_id: base.user_root + +- + I close this idea by click on "Close" button. +- + !workflow {model: idea.idea, action: idea_close, ref: idea_idea_0} + +- + I check that the idea's state is now Accepted +- + !assert {model: idea.idea, id: idea_idea_0}: + - state == 'close' + \ No newline at end of file