402f93f481798310e94134275db416c518171e43
[odoo/odoo.git] / addons / idea / test / test_idea.yml
1 - |
2   In order to test the Idea module in OpenERP, 
3   we will create a full flow, from the idea definition up to the votes and discussions on the idea.
4 - |
5   Given that I have an Idea category "Technical".
6
7   !record {model: idea.category, id: idea_category_technical0}:
8     name: Technical
9 - |
10   I create a New Idea of "Technical  presentation for 1 hours in every day" and specify category "Technical".
11
12   !record {model: idea.idea, id: idea_idea_0}: 
13     category_id: idea_category_technical0
14     created_date: !eval time.strftime('%Y-%m-%d %H:%M:%S')
15     description: I want that Technical presentation are arranged for 1 hours in every
16       day.\nso, on that presentation, we can know all things what improvement and development
17       are done in our company.\n\n\n\n\n
18     name: Technical  presentation for 1 hours in every day
19     user_id: base.user_root
20     
21 - |
22   I check that the idea is in draft state.
23 -
24   !assert {model: idea.idea, id: idea_idea_0}:
25     - state == 'draft'  
26     
27 - |
28   I open this idea by clicking on the "Open" button.
29
30   !workflow {model: idea.idea, action: idea_open, ref: idea_idea_0}
31   
32 - |
33   In order to check voting statistics in real systems I will create 2 new Users "test_idea_user1".
34
35   !record {model: res.users, id: test_idea_user1}: 
36     company_id: base.main_company
37     context_lang: en_US
38     login: test_idea_user1
39     name: Idea test user1
40     password: test_idea_user1
41     groups_id: [ base.group_tool_user, ]
42 - |
43   And I will also create user2.    
44
45   !record {model: res.users, id: test_idea_user2}:
46     company_id: base.main_company
47     context_lang: en_US
48     login: test_idea_user2
49     name: Idea test user2
50     password: test_idea_user2
51     groups_id: [ base.group_tool_user, ]
52 - |
53   In order to post vote I connect as test_idea_user1 and open the idea page
54   I click on  "Submit Vote" wizard  button and vote the idea as "Normal"
55     
56
57   !python {model: idea.post.vote}: |
58     uid2 = ref('test_idea_user1')
59     new_id = self.create(cr, uid2, {'vote': 50}, {"active_ids": [ref("idea_idea_0")]})
60     self.do_vote(cr, uid2, [new_id], {"active_ids": [ref("idea_idea_0")]})
61     
62 - |
63   To add other vote I connect as test_idea_user2 and open the idea page.
64   
65   I click on "Submit Vote" wizard button and vote the idea as "Very Good".
66    
67   and put comment "We can learn many things from technical presentation".
68   
69 -
70   !python {model: idea.post.vote}: |
71     uid2 = ref('test_idea_user2')
72     new_id = self.create(cr, uid2, {'vote': 100, 'note': 'We can learn many things from technical presentation'}, {"active_ids": [ref("idea_idea_0")]})
73     self.do_vote(cr, uid2, [new_id], {'active_ids': [ref('idea_idea_0')]})  
74         
75 - |
76   I can see that the Average score changed in "Average score" field with value 75
77 -
78   !record {model: idea.idea, id: idea_idea_0}: 
79     vote_avg: 75 
80         
81 - |
82   I connect as Manager and  close this idea by click on "Close" button.
83 -
84   !workflow {model: idea.idea, action: idea_close, ref: idea_idea_0}
85   
86 - |
87   I check  that the idea's state is now Accepted
88 -
89   !assert {model: idea.idea, id: idea_idea_0}: 
90     - state == 'close'