diff --git a/addons/survey/__openerp__.py b/addons/survey/__openerp__.py index f98d8168501..c55ce4f41cb 100644 --- a/addons/survey/__openerp__.py +++ b/addons/survey/__openerp__.py @@ -49,10 +49,8 @@ user name and password for the invitation of the survey. ], 'demo': ['survey_demo.xml'], 'test': [ - 'test/draft2open2close_survey.yml', - 'test/draft2open2close_request.yml', - 'test/survey_question_type.yml', 'test/survey_report.yml', + 'survey_response.py', ], 'installable': True, 'auto_install': False, diff --git a/addons/survey/test/draft2open2close_request.yml b/addons/survey/test/draft2open2close_request.yml deleted file mode 100644 index 9d80952855b..00000000000 --- a/addons/survey/test/draft2open2close_request.yml +++ /dev/null @@ -1,50 +0,0 @@ -- - In order to check Survey Request of the survey "Initial Partner Feedback" I create a Survey Request for survey "Initial Partner Feedback". -- - !record {model: survey.request, id: survey_request_1}: - survey_id: survey_Initial_partner_feedback - user_id: base.user_demo -- - !assert {model: survey.request, id: survey_request_1, string: Survey Request should be in draft state}: - - state == 'draft' -- - I set Survey Request for the survey in waiting state. -- - !python {model: survey.request}: | - self.survey_req_waiting_answer(cr, uid, [ref("survey_request_1")], context) -- - I check that state of Survey Request for the survey is waiting or not. -- - !assert {model: survey.request, id: survey_request_1, severity: error, string: Survey Request should be in waiting state}: - - state == 'waiting_answer' -- - I cancel the Survey Request of the survey. -- - !python {model: survey.request}: | - self.survey_req_cancel(cr, uid, [ref("survey_request_1")], context) -- - I check that state of Survey Request of the survey is cancel or not. -- - !assert {model: survey.request, id: survey_request_1, severity: error, string: Survey Request should be in cancel state}: - - state == 'cancel' -- - I set Survey Request of the survey in draft state. -- - !python {model: survey.request}: | - self.survey_req_draft(cr, uid, [ref("survey_request_1")], context) -- - I check that state of Survey request of the survey is draft or not. -- - !assert {model: survey.request, id: survey_request_1, severity: error, string: Survey Request should be in draft state}: - - state == 'draft' -- - I set survey request of the survey in done state. -- - !python {model: survey.request}: | - self.survey_req_waiting_answer(cr, uid, [ref("survey_request_1")], context) - self.survey_req_done(cr, uid, [ref("survey_request_1")], context) -- - I check that state of Survey request of the survey is done or not. -- - !assert {model: survey.request, id: survey_request_1, severity: error, string: Survey Request should be in done state}: - - state == 'done' diff --git a/addons/survey/test/draft2open2close_survey.yml b/addons/survey/test/draft2open2close_survey.yml deleted file mode 100644 index 11734e8172c..00000000000 --- a/addons/survey/test/draft2open2close_survey.yml +++ /dev/null @@ -1,116 +0,0 @@ -- - In order to check the survey module in OpenERP I use the survey "Initial Partner Feedback". -- - I set the survey in Open state. -- - !python {model: survey}: | - self.survey_open(cr, uid, [ref("survey_Initial_partner_feedback")], context) -- - I check state of survey is open or not. -- - !assert {model: survey, id: survey_Initial_partner_feedback, severity: error, string: Survey should be in open state}: - - state == 'open' -- - I check that the survey is reopened or not. -- - !python {model: survey}: | - self.survey_cancel(cr, uid, [ref('survey_Initial_partner_feedback')],context) - self.survey_open(cr, uid, [ref('survey_Initial_partner_feedback')],context) -- - I check that state of survey is open or not. -- - !assert {model: survey, id: survey_Initial_partner_feedback, severity: error, string: Survey should be in open state}: - - state == 'open' -- - I set the state of the survey open. -- - !python {model: survey}: | - self.survey_open(cr, uid, [ref("survey_Initial_partner_feedback")], context) -- - In order to print the survey I click on Print. -- - !python {model: survey.print}: | - id = self.create(cr, uid, {'survey_ids': [(6,0,[ref('survey.survey_Initial_partner_feedback')])]}) - self.action_next(cr, uid, [id], context) -- - In order to answer the survey I click on "Answer a Survey" with a public token. -- - !python {model: survey.question.wiz}: | - ctx = {} - ref_id = ref("survey_Initial_partner_feedback") - survey = self.pool.get('survey').browse(cr, uid, ref_id, ctx) - ctx.update({'survey_id': ref_id, 'survey_token': survey.token}) - fields_view = self.fields_view_get(self, cr, uid, view_id=None, view_type='form', ctx) - id = self.create(cr, uid, {}, ctx) - self.action_next(cr, uid, [id], ctx) -- - I give the answer of the first and second page of the survey. -- - !python {model: survey.question.wiz}: | - ctx = {'active_model':'survey', 'active_id': ref('survey_Initial_partner_feedback'), 'active_ids': [ref('survey_Initial_partner_feedback')]} - self.fields_view_get(cr, uid, ref("survey.view_survey_question_message"),"form", context=ctx) - values = self.default_get(cr, uid, ['name'], ctx) - id = self.create(cr, uid, {str(ref("survey_initial_question_company_name")) +"_single" :'Tiny' , str(ref("survey_initial_question_company_size")) + "_selection" : int(ref("survey.survey_initial_question_company_size_51")), }, context) - self.action_next(cr, uid, [id], context) - id = self.create(cr, uid, {str(ref("survey_initial_question_contract_customers")) + "_selection" : int(ref("survey_initial_answer_sometimes")), str(ref("survey_initial_question_sell_to_your_customers")) + "_selection" : int(ref("survey_initial_answer_maintenance_contract")), }, context) - self.action_next(cr, uid, [id], context) -- - I print the answers of the survey. -- - !python {model: survey.browse.answer}: | - id = self.create(cr, uid, {'survey_id': ref('survey.survey_Initial_partner_feedback')}) - self.action_next(cr, uid, [id], context) -- - I edit questions of the survey as per requirement. -- - !python {model: survey.question.wiz}: | - name_wiz_obj = self.pool.get('survey.name.wiz') - id = name_wiz_obj.create(cr, uid, {'survey_id': ref("survey_Initial_partner_feedback")}) - ctx = {'active_model':'survey', 'active_id': ref('survey_Initial_partner_feedback'), 'active_ids': [ref('survey_Initial_partner_feedback')], 'question_id': ref('survey_initial_question_company_name'), 'page_number': -1,'sur_name_id': id} - self.action_edit_question(cr, uid, [ref('survey_initial_question_company_name')], context = ctx) - self.action_delete_question(cr, uid, [ref('survey_initial_question_company_name')], context = ctx) - self.action_new_question(cr, uid, [], context = ctx) -- - I edit Page of the survey as per requirement. -- - !python {model: survey.question.wiz}: | - name_wiz_obj = self.pool.get('survey.name.wiz') - id = name_wiz_obj.create(cr, uid, {'survey_id': ref("survey_Initial_partner_feedback")}) - ctx = {'active_model':'survey', 'active_id': ref('survey_Initial_partner_feedback'), 'active_ids': [ref('survey_Initial_partner_feedback')], 'page_id': ref('survey_initial_page_Contracts'), 'sur_name_id': id} - self.action_edit_page(cr, uid, [ref('survey_initial_page_Contracts')], context = ctx) - self.action_delete_page(cr, uid, [ref('survey_initial_page_Contracts')], context = ctx) - self.action_new_page(cr, uid, [], context = ctx) -- - In order to send invitation to the users I click on "Send Invitation" wizard. -- - !python {model: survey.send.invitation}: | - context = {'active_model':'survey', 'active_id': ref('survey_Initial_partner_feedback'), 'active_ids': [ref('survey_Initial_partner_feedback')]} - values = self.default_get(cr, uid, ['mail_from', 'mail_subject', 'send_mail_existing', 'mail_subject_existing', 'mail', 'partner_ids', 'send_mail'], context) - values['mail_from'] = 'Surveyor' - new_id = self.create(cr, uid, values) - self.action_send(cr, uid, [new_id], context) -- - I set the value in "Total start survey" field. -- - !record {model: survey, id: survey_Initial_partner_feedback}: - tot_start_survey: 1 -- - I set the survey in Cancel state. -- - !python {model: survey}: | - self.survey_cancel(cr, uid, [ref("survey_Initial_partner_feedback")], context) -- - I check state of survey is cancel or not. -- - !assert {model: survey, id: survey_Initial_partner_feedback, severity: error, string: Survey should be in cancel state}: - - state == 'cancel' -- - I set the survey in close state. -- - !python {model: survey}: | - self.survey_close(cr, uid, [ref("survey_Initial_partner_feedback")], context) -- - I check state of Survey is close or not. -- - !assert {model: survey, id: survey_Initial_partner_feedback, severity: error, string: Survey should be in close state}: - - state == 'close' diff --git a/addons/survey/test/survey_question_type.yml b/addons/survey/test/survey_question_type.yml deleted file mode 100644 index e03d7710ea0..00000000000 --- a/addons/survey/test/survey_question_type.yml +++ /dev/null @@ -1,6 +0,0 @@ -- - I check the question type of the survey "Initial Partner Feedback". -- - !python {model: survey.question}: | - sur_question = self.on_change_type(cr, uid, [ref("survey_Initial_partner_feedback")], 'multiple_textboxes_diff_type') - assert sur_question diff --git a/addons/survey/test/survey_response.py b/addons/survey/test/survey_response.py index ec686d9707d..e76ce0f701c 100644 --- a/addons/survey/test/survey_response.py +++ b/addons/survey/test/survey_response.py @@ -114,3 +114,5 @@ class test_survey_answer(): # I check state of Survey is close or not. self.assertEqual(self.survey_browse.state, 'close', 'Survey should be in cancel state') + + # sur_question = self.on_change_type(cr, uid, [ref("survey_Initial_partner_feedback")], 'multiple_textboxes_diff_type')